:root {
  --ink: #101827;
  --muted: #6d7686;
  --line: #e2e7ee;
  --surface: #ffffff;
  --canvas: #f3f5f8;
  --navy: #0b1220;
  --navy-2: #131e31;
  --cyan: #15c4c8;
  --cyan-dark: #0c9298;
  --red: #dc3d4b;
  --amber: #e6a23c;
  --green: #16a273;
  --shadow: 0 14px 40px rgba(22, 34, 55, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.55 "Microsoft YaHei", "PingFang SC", Inter, Arial, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px 22px; color: white; background:
  radial-gradient(circle at 30% 0%, rgba(21,196,200,.15), transparent 30%),
  linear-gradient(180deg, #0b1220 0%, #101a2b 100%); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 28px; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #061017; background: var(--cyan); font-weight: 900; letter-spacing: -.5px; box-shadow: 0 0 0 5px rgba(21,196,200,.1); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; letter-spacing: .03em; }
.brand span { color: #8ea0b8; font-size: 11px; margin-top: 2px; }
.nav-list { display: grid; gap: 8px; }
.nav-item { width: 100%; border: 0; border-radius: 12px; padding: 13px 14px; color: #9fadc0; background: transparent; text-align: left; display: flex; align-items: center; gap: 13px; transition: .2s ease; }
.nav-item span { color: #65758b; font: 700 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(21,196,200,.22), rgba(21,196,200,.07)); box-shadow: inset 3px 0 var(--cyan); }
.nav-item.active span { color: var(--cyan); }
.privacy-card { margin-top: auto; border: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.14); border-radius: 14px; padding: 14px; display: flex; gap: 10px; }
.privacy-dot { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; flex: 0 0 auto; background: var(--green); box-shadow: 0 0 0 5px rgba(22,162,115,.14); }
.privacy-card strong, .privacy-card span { display: block; }
.privacy-card strong { font-size: 12px; }
.privacy-card span { margin-top: 5px; color: #8090a6; font-size: 10px; line-height: 1.5; }

.main-content { min-width: 0; padding: 0 34px 56px; }
.topbar { height: 110px; display: flex; align-items: center; justify-content: space-between; }
.topbar h1 { margin: 2px 0 0; font-size: 28px; line-height: 1.15; letter-spacing: -.04em; }
.eyebrow, .panel-kicker { margin: 0; color: var(--cyan-dark); font: 800 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.connection-state { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: rgba(255,255,255,.7); }
.connection-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.connection-state.online i { background: var(--green); box-shadow: 0 0 0 4px rgba(22,162,115,.12); }
.connection-state.error i { background: var(--red); }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; font-size: 21px; display: grid; place-items: center; }

.page { display: none; }
.page.active { display: block; animation: page-in .25s ease; }
@keyframes page-in { from { opacity: .5; transform: translateY(4px); } }
.panel { position: relative; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; }
.panel-head.compact { align-items: center; }
.panel h2, .section-toolbar h2 { margin: 5px 0 4px; font-size: 19px; line-height: 1.25; letter-spacing: -.025em; }
.panel h3 { margin: 0 0 12px; font-size: 14px; }
.panel-head p:not(.panel-kicker), .section-toolbar p, .settings-copy { margin: 0; color: var(--muted); }
.button { min-height: 38px; border: 1px solid transparent; border-radius: 10px; padding: 9px 15px; font-weight: 700; font-size: 13px; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #031517; background: var(--cyan); box-shadow: 0 8px 22px rgba(21,196,200,.2); }
.button.primary:hover { background: #25d6d9; }
.button.secondary { color: #fff; background: var(--navy-2); }
.button.ghost { color: #334155; border-color: var(--line); background: #fff; }
.button.danger { color: #fff; background: var(--red); }
.button.danger.subtle { color: var(--red); border-color: #f5cbd0; background: #fff6f7; }
.button.wide { width: 100%; }
.button.tall { min-height: 46px; }
.text-link { border: 0; padding: 0; color: var(--cyan-dark); background: transparent; font-weight: 800; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { min-height: 126px; border: 1px solid var(--line); border-radius: 16px; padding: 19px; background: rgba(255,255,255,.78); }
.stat-card.primary { color: white; border-color: transparent; background: linear-gradient(135deg, #101c2e, #172b43); box-shadow: var(--shadow); }
.stat-card span, .stat-card small, .stat-card strong { display: block; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card.primary span, .stat-card.primary small { color: #9fb1c6; }
.stat-card strong { margin: 8px 0 6px; font-size: 33px; line-height: 1; letter-spacing: -.04em; }
.stat-card small { color: #8a94a3; font-size: 11px; }
.stat-card .address-stat { font-size: 17px; line-height: 1.25; word-break: break-all; margin-top: 13px; }

.discovery-panel { margin-bottom: 26px; overflow: hidden; }
.discovery-panel::after { content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%; right: -100px; bottom: -130px; background: rgba(21,196,200,.08); }
.discovery-form { display: grid; grid-template-columns: 1.1fr 1fr auto; gap: 12px; align-items: end; margin-top: 20px; max-width: 780px; }
label { display: grid; gap: 7px; color: #475569; font-size: 11px; font-weight: 700; }
input, select { width: 100%; min-height: 40px; border: 1px solid #d9e0e8; border-radius: 9px; padding: 8px 11px; color: var(--ink); background: #fbfcfd; outline: none; }
input:focus, select:focus { border-color: var(--cyan-dark); box-shadow: 0 0 0 3px rgba(21,196,200,.11); }
input[type="color"] { padding: 4px; }
input[type="range"] { min-height: 22px; padding: 0; border: 0; background: transparent; accent-color: var(--cyan-dark); box-shadow: none; }
.scan-progress { margin-top: 14px; color: var(--cyan-dark); display: flex; align-items: center; gap: 9px; }
.scan-progress i { width: 15px; height: 15px; border: 2px solid #bfeff0; border-top-color: var(--cyan-dark); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.section-toolbar { margin-bottom: 14px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search-input { width: 220px; background: #fff; }
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(230px, 1fr)); gap: 14px; }
.device-card { border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: hidden; transition: .18s ease; }
.device-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.device-card.selected { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(21,196,200,.12); }
.device-card-head { padding: 17px 17px 12px; display: flex; justify-content: space-between; gap: 12px; }
.device-select { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.device-select input { width: 17px; height: 17px; min-height: 0; margin-top: 2px; accent-color: var(--cyan-dark); }
.device-name { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-id { color: #8791a0; font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.status-badge { flex: 0 0 auto; height: 23px; border-radius: 99px; padding: 3px 9px; font-size: 10px; font-weight: 800; color: #9a3340; background: #fff0f2; }
.status-badge.online { color: #087452; background: #e8f8f2; }
.device-metrics { padding: 0 17px 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.metric { min-width: 0; border-radius: 9px; padding: 8px; background: #f6f8fa; }
.metric span, .metric strong { display: block; }
.metric span { color: #8b95a3; font-size: 9px; }
.metric strong { margin-top: 2px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-footer { border-top: 1px solid #edf0f3; padding: 11px 17px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.device-footer span { color: #7c8796; font-size: 10px; }
.device-footer button { border: 0; color: var(--cyan-dark); background: transparent; font-weight: 800; }
.empty-state { min-height: 270px; border: 1px dashed #ccd4de; border-radius: 18px; display: grid; place-items: center; align-content: center; text-align: center; padding: 30px; background: rgba(255,255,255,.45); }
.empty-state h3 { margin: 14px 0 5px; }
.empty-state p { max-width: 500px; margin: 0; color: var(--muted); }
.empty-orbit { width: 58px; height: 58px; border: 1px solid #b8c5d2; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 0 0 9px rgba(21,196,200,.06); }
.empty-orbit span { font-size: 27px; color: var(--cyan-dark); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.editor-stage { min-width: 0; }
.segmented { border: 1px solid var(--line); border-radius: 9px; padding: 3px; display: flex; background: #f6f7f9; }
.segmented button { border: 0; border-radius: 6px; padding: 6px 11px; color: var(--muted); background: transparent; }
.segmented button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.canvas-wrap { position: relative; margin-top: 18px; overflow: hidden; border-radius: 12px; border: 1px solid #dbe1e7; background: #dfe5eb; }
.canvas-wrap canvas { display: block; width: 100%; height: auto; aspect-ratio: 1024/600; background: white; }
.canvas-caption { margin-top: 11px; color: #7c8796; font-size: 10px; display: flex; justify-content: space-between; }
.control-rail { padding: 0; overflow: hidden; }
.control-section { padding: 19px; border-bottom: 1px solid #edf0f3; }
.control-section:last-child { border: 0; }
.section-inline { display: flex; align-items: center; justify-content: space-between; }
.target-summary { margin-bottom: 10px; border-radius: 10px; padding: 10px; color: #435065; background: #f5f7f9; max-height: 94px; overflow: auto; }
.upload-drop { min-height: 72px; border: 1px dashed #9eb6c7; border-radius: 11px; display: grid; place-items: center; align-content: center; color: var(--cyan-dark); background: #f5fcfc; cursor: pointer; }
.upload-drop span { color: #8a96a5; font-size: 9px; }
.template-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.template-chip { border: 1px solid var(--line); border-radius: 99px; padding: 7px 10px; color: #596579; background: #fff; font-size: 10px; }
.template-chip.active { color: #fff; border-color: var(--navy); background: var(--navy); }
.two-col, .three-col { display: grid; gap: 10px; }
.two-col { grid-template-columns: 1fr 1fr; }
.three-col { grid-template-columns: repeat(3, 1fr); }
.text-layer-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.text-layer { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #fff; color: #647084; font-size: 10px; }
.text-layer.active { color: #fff; border-color: var(--cyan-dark); background: var(--cyan-dark); }
.text-layer .remove { margin-left: 6px; opacity: .7; }
.text-editor { display: grid; gap: 10px; }
.switch-row { display: flex; grid-auto-flow: column; justify-content: start; align-items: center; gap: 8px; }
.switch-row input { width: 17px; height: 17px; min-height: 0; accent-color: var(--cyan-dark); }
.upload-options { display: grid; gap: 12px; }
.task-message { min-height: 18px; color: var(--muted); font-size: 11px; }
.task-message.success { color: var(--green); }
.task-message.error { color: var(--red); }

.batch-step-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.full-span { grid-column: 1 / -1; }
.step-number { position: absolute; top: 18px; right: 21px; color: #dfe5ea; font: 900 42px/1 ui-monospace, monospace; }
.file-summary { margin: 16px 0 12px; border-radius: 9px; padding: 10px 12px; color: #5f6b7d; background: #f6f8fa; }
.mapping-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 13px; }
.table-scroll { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { position: sticky; top: 0; z-index: 1; padding: 9px; color: #708096; background: #f2f5f8; text-align: left; font-size: 10px; }
.data-table td { padding: 6px 8px; border-top: 1px solid #edf0f3; }
.data-table td:first-child { width: 34px; color: #98a2b0; }
.data-table input { min-height: 34px; border-color: transparent; padding: 5px 7px; background: transparent; }
.data-table input:focus { background: #fff; }
.row-remove { border: 0; color: var(--red); background: transparent; }
.batch-canvas { max-width: 660px; }
.layout-controls { display: grid; gap: 9px; }
.color-controls label { display: flex; align-items: center; justify-content: space-between; }
.color-controls input { width: 48px; }
.plan-count { min-width: 92px; text-align: center; }
.plan-count strong, .plan-count span { display: block; }
.plan-count strong { color: var(--cyan-dark); font-size: 32px; }
.plan-count span { color: var(--muted); font-size: 10px; }
.batch-options { margin-top: 18px; display: grid; grid-template-columns: 130px 1fr auto auto; align-items: end; gap: 12px; }
.progress-shell { margin-top: 18px; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 7px; color: #536075; }
.progress-rail { height: 8px; border-radius: 99px; overflow: hidden; background: #e9eef2; }
.progress-rail i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--cyan-dark), var(--cyan)); transition: width .3s ease; }
.apply-list { margin-top: 14px; display: grid; gap: 7px; }
.apply-item { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: center; }
.apply-item span { color: #758195; font-size: 10px; }
.apply-item strong { display: block; }
.apply-state { min-width: 70px; text-align: right; color: var(--muted); font-size: 11px; }
.apply-item.running { border-color: #9ee5e7; background: #f3fdfd; }
.apply-item.success .apply-state { color: var(--green); }
.apply-item.error .apply-state { color: var(--red); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mode-card { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.mode-card strong, .mode-card span { display: block; }
.mode-card span { color: var(--muted); font-size: 10px; margin-top: 3px; }
.mode-card.local { background: #f4fcfc; border-color: #c8eded; }
.info-list { margin: 14px 0 0; }
.info-list div { padding: 10px 0; border-bottom: 1px solid #edf0f3; display: grid; grid-template-columns: 90px 1fr; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; text-align: right; word-break: break-all; }
.settings-device-list { margin-top: 15px; display: grid; gap: 8px; }
.settings-device-row { border: 1px solid var(--line); border-radius: 11px; padding: 10px; display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 9px; align-items: end; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(6,14,24,.36); backdrop-filter: blur(2px); }
.device-drawer { position: fixed; z-index: 60; top: 0; right: 0; width: min(430px, 100%); height: 100vh; padding: 24px; overflow: auto; background: #fff; box-shadow: -20px 0 70px rgba(9,18,31,.2); transform: translateX(105%); transition: transform .25s ease; }
.device-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; gap: 15px; }
.drawer-head h2 { margin: 4px 0 1px; }
.drawer-head span { color: var(--muted); font: 10px ui-monospace, monospace; }
.drawer-status { margin: 18px 0; border-radius: 12px; padding: 13px; background: #f4f7f9; display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.drawer-status div span, .drawer-status div strong { display: block; }
.drawer-status div span { color: var(--muted); font-size: 9px; }
.drawer-status div strong { margin-top: 3px; }
.drawer-section { padding: 18px 0; border-top: 1px solid var(--line); }
.action-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.inline-control { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; align-items: end; margin-top: 9px; }
.brightness-control { display: grid; grid-template-columns: 1fr 42px auto; gap: 8px; align-items: center; }
.brightness-control output { text-align: center; font-weight: 800; }
.danger-zone p { color: var(--muted); font-size: 11px; }

.toast-stack { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(340px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--cyan-dark); border-radius: 10px; color: #314055; background: #fff; box-shadow: var(--shadow); animation: toast-in .22s ease; }
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1160px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .device-grid { grid-template-columns: 1fr 1fr; }
  .workspace-grid { grid-template-columns: 1fr; }
  .control-rail { display: grid; grid-template-columns: 1fr 1fr; }
  .control-section { border-right: 1px solid #edf0f3; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; top: auto; bottom: 0; width: 100%; height: 68px; padding: 7px; z-index: 80; }
  .brand, .privacy-card { display: none; }
  .nav-list { grid-template-columns: repeat(4,1fr); gap: 3px; }
  .nav-item { padding: 8px 4px; display: grid; place-items: center; gap: 4px; font-size: 10px; text-align: center; }
  .nav-item.active { box-shadow: inset 0 -3px var(--cyan); }
  .main-content { padding: 0 14px 90px; }
  .topbar { height: 88px; }
  .topbar h1 { font-size: 23px; }
  .connection-state span { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { min-height: 106px; padding: 14px; }
  .stat-card strong { font-size: 27px; }
  .panel { padding: 18px; }
  .panel-head, .section-toolbar { display: grid; }
  .discovery-form { grid-template-columns: 1fr; }
  .toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .search-input { width: 100%; grid-column: 1 / -1; }
  .device-grid { grid-template-columns: 1fr; }
  .control-rail { display: block; }
  .batch-step-grid, .settings-grid { grid-template-columns: 1fr; }
  .full-span { grid-column: auto; }
  .batch-options { grid-template-columns: 1fr 1fr; }
  .mapping-grid, .three-col { grid-template-columns: 1fr; }
  .settings-device-row { grid-template-columns: 1fr; }
  .mode-card { align-items: stretch; flex-direction: column; }
}

@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 95px; }
  .top-actions { gap: 6px; }
  .canvas-caption { display: grid; gap: 3px; }
  .two-col { grid-template-columns: 1fr; }
  .batch-options { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: 1fr; }
  .inline-control { grid-template-columns: 1fr 1fr; }
  .inline-control label { grid-column: 1 / -1; }
}

/* Lybom 1.1 — warm, quiet and task-first */
:root {
  --ink: #191816; --muted: #77736c; --line: #dedbd4; --surface: #fffefa;
  --canvas: #f4f2ed; --navy: #1b1a18; --navy-2: #292723; --cyan: #a38454;
  --cyan-dark: #82673f; --red: #a5403a; --amber: #b8873b; --green: #47765a;
  --shadow: 0 18px 50px rgba(35,31,24,.055); --radius: 18px;
}
html, body { background: var(--canvas); }
body { color: var(--ink); font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .18; background-image: radial-gradient(rgba(34,31,26,.16) .45px, transparent .45px); background-size: 5px 5px; }
.app-shell { grid-template-columns: 232px minmax(0,1fr); }
.sidebar { padding: 30px 16px 22px; color: var(--ink); background: rgba(249,247,242,.94); border-right: 1px solid var(--line); backdrop-filter: blur(18px); }
.brand { padding: 0 10px 34px; gap: 13px; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; color: #f8f5ef; background: var(--ink); box-shadow: none; font-size: 11px; letter-spacing: .04em; }
.brand strong { font: 600 17px/1.1 Georgia,"Times New Roman",serif; letter-spacing: .08em; }
.brand span { color: #918b81; font: 700 9px/1.2 ui-monospace,Consolas,monospace; letter-spacing: .15em; }
.nav-list { gap: 5px; }
.nav-item { min-height: 46px; padding: 12px 14px; border-radius: 10px; color: #77736c; font-weight: 600; }
.nav-item span { color: #aaa49a; font-size: 9px; }
.nav-item:hover { color: var(--ink); background: #ece9e2; }
.nav-item.active { color: #f7f4ed; background: var(--ink); box-shadow: none; }
.nav-item.active span { color: #c4aa7c; }
.privacy-card { border-color: var(--line); background: transparent; border-radius: 12px; padding: 13px; }
.privacy-card strong { color: #45413b; } .privacy-card span { color: #918c83; }
.privacy-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(71,118,90,.11); }
.main-content { padding: 0 42px 64px; }
.topbar { height: 118px; border-bottom: 1px solid rgba(222,219,212,.75); margin-bottom: 28px; }
.topbar h1 { font: 500 clamp(27px,3vw,38px)/1.08 Georgia,"Songti SC","Times New Roman",serif; letter-spacing: -.04em; }
.eyebrow,.panel-kicker { color: #917449; font-weight: 700; letter-spacing: .18em; }
.connection-state { height: 38px; border-color: var(--line); color: #736f67; background: rgba(255,254,250,.72); }
.icon-btn { border-color: var(--line); border-radius: 50%; color: var(--ink); background: transparent; }
.icon-btn:hover { color: #fff; background: var(--ink); }
.panel { border-color: var(--line); background: rgba(255,254,250,.94); box-shadow: var(--shadow); }
.panel h2,.section-toolbar h2 { color: var(--ink); font-weight: 650; }
.panel-head p:not(.panel-kicker),.section-toolbar p,.settings-copy { color: var(--muted); }
.button { border-radius: 999px; font-weight: 650; box-shadow: none; }
.button:hover { transform: none; }
.button.primary { color: #fffdf8; background: var(--ink); box-shadow: none; }
.button.primary:hover { color: #fff; background: #947649; }
.button.secondary { color: #fff; background: #5e594f; }
.button.ghost { color: #4d4943; border-color: var(--line); background: transparent; }
.button.ghost:hover { border-color: #a69e92; background: #f8f6f1; }
.text-link { color: #806641; }
input:not([type="range"]):not([type="color"]),select { border-color: var(--line)!important; border-radius: 9px!important; background: #fbfaf6!important; }
input:focus,select:focus { outline: 2px solid rgba(147,116,73,.16); border-color: #aa8b5e!important; }
.welcome-strip { display: grid; grid-template-columns: minmax(250px,.85fr) minmax(520px,1.45fr); gap: 42px; align-items: end; margin: 0 0 28px; padding: 4px 2px 28px; border-bottom: 1px solid var(--line); }
.welcome-copy h2 { margin: 7px 0 8px; font: 500 clamp(25px,2.8vw,38px)/1.1 Georgia,"Songti SC",serif; letter-spacing: -.04em; }
.welcome-copy>p:last-child { max-width: 500px; margin: 0; color: var(--muted); }
.quick-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; list-style: none; padding: 0; margin: 0; }
.quick-steps li { display: flex; gap: 11px; min-width: 0; padding: 14px 10px; border-left: 1px solid var(--line); }
.quick-steps li>span { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #bfa77e; border-radius: 50%; color: #8a6b3f; font: 700 10px/1 ui-monospace,Consolas,monospace; }
.quick-steps strong,.quick-steps small { display: block; }
.quick-steps strong { font-size: 12px; } .quick-steps small { margin-top: 4px; color: #969087; font-size: 10px; line-height: 1.45; }
.stats-grid { grid-template-columns: repeat(4,1fr); gap: 0; margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,254,250,.78); }
.stat-card,.stat-card.primary { min-height: 96px; padding: 17px 20px; border: 0; border-right: 1px solid var(--line); border-radius: 0; color: var(--ink); background: transparent; box-shadow: none; }
.stat-card:last-child { border-right: 0; }
.stat-card span { color: #858078; }
.stat-card strong,.stat-card.primary strong { color: var(--ink); font-size: 28px; font-weight: 520; }
.stat-card small,.stat-card.primary small { color: #a19b92; }
.main-task-card { overflow: visible; padding: 27px 28px 22px; border-color: #d6d0c5; background: #fffefa; }
.discovery-panel::after { display: none; }
.hero-action { min-width: 168px; min-height: 46px; }
.advanced-discovery { margin-top: 18px; border-top: 1px solid #ebe7df; }
.advanced-discovery summary { width: max-content; padding: 15px 0 0; color: #817b72; cursor: pointer; font-size: 12px; user-select: none; }
.advanced-discovery[open] summary { color: var(--ink); }
.discovery-form { margin-top: 15px; padding: 16px; border-radius: 12px; background: #f5f2ec; }
.scan-progress { border-color: #ded5c6; color: #7f6a47; background: #f8f3ea; }
.task-shortcuts { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; margin: 14px 0 34px; }
.task-shortcuts button { position: relative; display: grid; gap: 3px; min-height: 82px; padding: 18px 58px 18px 20px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: rgba(255,254,250,.7); text-align: left; }
.task-shortcuts button:hover { border-color: #b5aa9b; background: #fffefa; }
.task-shortcuts span { color: #8f734b; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.task-shortcuts strong { font-size: 14px; font-weight: 550; }
.task-shortcuts i { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-style: normal; }
.section-toolbar { border-bottom-color: var(--line); }
.search-input { border-color: var(--line); background: #fffefa; }
.device-grid { gap: 14px; }
.device-card { border-color: var(--line); border-radius: 15px; background: #fffefa; box-shadow: none; }
.device-card:hover { border-color: #afa697; box-shadow: 0 15px 35px rgba(35,31,24,.07); }
.device-card.selected { border-color: #9a7a4b; box-shadow: inset 0 0 0 1px #9a7a4b; }
.device-card.selected::before { background: #9a7a4b; }
.status-badge.online { color: #3f704f; background: #eef4ef; }
.empty-state { border: 1px dashed #d3cdc3; border-radius: 16px; background: rgba(255,254,250,.5); }
.empty-orbit { border-color: #b79a6e; color: #876a40; background: transparent; box-shadow: none; font: 700 10px/1 ui-monospace,Consolas,monospace; }
.canvas-wrap { border-color: var(--line); background: #e9e6df; }
.control-rail,.control-section { border-color: var(--line); }
.segmented { border-color: var(--line); background: #f1eee8; }
.segmented button.active { color: #fff; background: var(--ink); }
.upload-drop { border-color: #cfc7ba; color: #6f5a3b; background: #faf7f1; }
.upload-drop:hover { border-color: #9e8258; background: #f7f1e7; }
.template-chip { border-color: var(--line); background: transparent; }
.template-chip.active { color: #fff; border-color: var(--ink); background: var(--ink); box-shadow: none; }
.target-summary,.file-summary { border-color: #ded8ce; color: #706b63; background: #f7f4ee; }
.step-number { color: #fff; background: var(--ink); box-shadow: 0 0 0 5px var(--canvas); }
.data-table th { color: #79736a; background: #f2efe9; }
.data-table th,.data-table td { border-color: var(--line); }
.plan-count strong { color: #8b6d41; }
.progress-rail i { background: linear-gradient(90deg,#80623a,#b99b6f); }
.apply-item.running { border-color: #b89c72; background: #faf5ec; }
.mode-card.local { border-color: #c6bda8; background: #f6f3eb; }
.mode-card.cloud { border-color: var(--line); background: #faf9f6; }
.settings-device-row.selected { border-color: #a68a60; background: #faf5ec; }
.device-drawer { border-left: 1px solid var(--line); background: #fbfaf6; box-shadow: -22px 0 60px rgba(29,26,21,.10); }
.drawer-head,.drawer-section { border-color: var(--line); }
.drawer-status,.metric,.info-list>div { background: #f2efe9; }
.toast { border: 1px solid var(--line); background: #fffefa; box-shadow: 0 14px 36px rgba(35,31,24,.12); }
@media (max-width:1100px) { .welcome-strip { grid-template-columns:1fr; gap:18px; } }
@media (max-width:820px) {
  .app-shell { display:block; } .sidebar { background:#f8f6f1; border-right:0; border-top:1px solid var(--line); }
  .nav-item.active { box-shadow:none; } .main-content { padding-left:20px; padding-right:20px; }
  .topbar { height:92px; margin-bottom:22px; } .quick-steps { grid-template-columns:1fr; }
  .quick-steps li { padding:8px 0 8px 12px; } .stats-grid { grid-template-columns:repeat(2,1fr); }
  .stat-card:nth-child(2) { border-right:0; } .stat-card:nth-child(-n+2) { border-bottom:1px solid var(--line); }
  .task-shortcuts { grid-template-columns:1fr; }
}
@media (max-width:500px) {
  .main-content { padding:0 14px 90px; } .welcome-copy h2 { font-size:28px; }
  .stats-grid { grid-template-columns:1fr; } .stat-card,.stat-card.primary { min-height:84px; border-right:0; border-bottom:1px solid var(--line); }
  .stat-card:last-child { border-bottom:0; } .main-task-card { padding:22px 18px 17px; }
  .main-task-card .panel-head { align-items:stretch; } .hero-action { width:100%; }
}
