:root {
  --ink: #102029;
  --muted: #65747d;
  --line: #dfe5e5;
  --soft-line: #ecf0ef;
  --paper: #ffffff;
  --canvas: #f3f6f4;
  --nav: #0b1720;
  --nav-soft: #142832;
  --blue: #2f6fed;
  --blue-dark: #1f55c8;
  --mint: #33d0aa;
  --lime: #d8f25e;
  --amber: #f0ad3d;
  --red: #e15c5c;
  --green: #1eaa79;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow: 0 12px 40px rgba(21, 42, 50, .08);
  --font: "DM Sans", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: 11px; color: #fff; }
.brand > span:last-child { display: flex; align-items: baseline; gap: 4px; }
.brand b { font-size: 18px; letter-spacing: -.45px; }
.brand em { color: #8da0a9; font-size: 11px; font-style: normal; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.brand.dark { color: var(--ink); }
.brand.dark em { color: var(--muted); }
.brand-mark { position: relative; display: grid; width: 32px; height: 32px; grid-template-columns: 1fr 1fr; gap: 3px; padding: 7px; overflow: hidden; border-radius: 10px; background: var(--blue); transform: rotate(-4deg); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.brand-mark i { display: block; border-radius: 3px; background: white; opacity: .96; }
.brand-mark i:last-child { margin-top: 7px; background: var(--lime); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: 254px; flex-direction: column; padding: 28px 18px 16px; background: var(--nav); color: #d8e0e4; }
.sidebar > .brand { padding: 0 11px 24px; }
.workspace-switcher { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; margin: 4px 1px 25px; padding: 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: rgba(255,255,255,.045); }
.workspace-logo { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: #17302a; background: var(--lime); font-size: 12px; font-weight: 800; }
.workspace-switcher small, .workspace-switcher b { display: block; }
.workspace-switcher small { margin-bottom: 2px; color: #71858f; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.workspace-switcher b { overflow: hidden; color: white; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: #75909c; }
.main-nav { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow-y: auto; }
.nav-label { margin: 18px 12px 7px; color: #536a74; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.main-nav a { position: relative; display: flex; min-height: 44px; align-items: center; gap: 12px; margin: 2px 0; padding: 0 12px; border-radius: 11px; color: #9fb0b8; font-weight: 500; transition: .18s ease; }
.main-nav a:hover { color: white; background: rgba(255,255,255,.05); }
.main-nav a.active { color: white; background: var(--nav-soft); box-shadow: inset 3px 0 0 var(--lime); }
.main-nav a [data-icon] { display: grid; width: 19px; height: 19px; place-items: center; }
.main-nav svg, .button svg, .icon-button svg, .metric-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge { margin-left: auto; padding: 2px 7px; border-radius: 99px; color: #392422; background: #ffc4b6; font-size: 10px; font-style: normal; font-weight: 700; }
.live-pin { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(51,208,170,.12); }
.sidebar-footer { padding-top: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.system-health { display: flex; align-items: center; gap: 10px; padding: 8px 11px 14px; }
.system-health b, .system-health small { display: block; }
.system-health b { color: #dbe5e8; font-size: 11px; }
.system-health small { margin-top: 2px; color: #607781; font-size: 9px; }
.pulse { display: inline-block; width: 8px; height: 8px; border: 2px solid rgba(51,208,170,.3); border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(51,208,170,.11); }
.pulse.warn { border-color: rgba(240,173,61,.35); background: var(--amber); box-shadow: 0 0 0 4px rgba(240,173,61,.12); }
.pulse.off { border-color: rgba(225,92,92,.3); background: var(--red); box-shadow: 0 0 0 4px rgba(225,92,92,.1); }
.user-card { display: grid; width: 100%; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; padding: 9px; border: 0; border-radius: 11px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.user-card:hover { background: rgba(255,255,255,.045); }
.user-card b, .user-card small { display: block; }
.user-card b { color: white; font-size: 11px; }
.user-card small { margin-top: 1px; color: #617782; font-size: 9px; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: #183036; background: #a6dddc; font-size: 10px; font-weight: 800; }

.workspace { min-height: 100vh; margin-left: 254px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: 72px; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(14px); }
.breadcrumb { display: flex; align-items: center; gap: 10px; }
.breadcrumb span { color: #94a0a5; font-size: 12px; }
.breadcrumb span::after { content: "/"; margin-left: 10px; color: #c3ccce; }
.breadcrumb b { font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.connection-pill { display: flex; align-items: center; gap: 9px; margin-right: 4px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: #fff; font-size: 11px; }
.icon-button { position: relative; display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.icon-button:hover { border-color: #c6d1d2; background: #f8faf9; }
.icon-button i { position: absolute; top: 8px; right: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--red); }
.button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 700; cursor: pointer; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 5px 16px rgba(47,111,237,.18); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { border-color: var(--line); background: #fff; }
.button.secondary:hover { border-color: #c7d1d2; }
.button.dark { color: white; background: var(--ink); }
.button.danger { color: #b84444; border-color: #f0cdcd; background: #fff7f7; }
.button.small { min-height: 31px; padding: 0 10px; border-radius: 8px; font-size: 10px; }
.button.large { width: 100%; min-height: 49px; justify-content: space-between; padding: 0 18px; font-size: 13px; }

.view-root { padding: 30px 32px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-head h1 { margin: 0 0 7px; font-size: 27px; line-height: 1.1; letter-spacing: -.8px; }
.page-head p { max-width: 680px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.page-actions { display: flex; align-items: center; gap: 9px; }
.eyebrow { display: block; margin-bottom: 9px; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow.light { color: var(--lime); }
.grid { display: grid; gap: 18px; }
.grid.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1.45fr) minmax(290px, .75fr); }
.grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: 0 2px 12px rgba(21,42,50,.025); }
.card.padded { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-head h2 { margin: 0; font-size: 15px; letter-spacing: -.2px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.card-head .link-button { margin-left: auto; }
.link-button { padding: 0; border: 0; color: var(--blue); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.metric-card { position: relative; min-height: 139px; padding: 20px; overflow: hidden; }
.metric-card::after { position: absolute; right: -24px; bottom: -37px; width: 96px; height: 96px; border-radius: 50%; background: var(--metric-wash, #eef4ff); content: ""; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.metric-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--metric-color, var(--blue)); background: var(--metric-wash, #eef4ff); }
.metric-number { display: flex; align-items: baseline; gap: 9px; margin-top: 14px; }
.metric-number strong { font-size: 28px; line-height: 1; letter-spacing: -1px; }
.metric-number small { color: var(--muted); font-size: 10px; }
.trend { display: inline-flex; align-items: center; margin-top: 9px; color: var(--green); font-size: 10px; font-weight: 700; }
.trend.warn { color: var(--amber); }
.trend.neutral { color: var(--muted); }

.preview-frame { position: relative; aspect-ratio: 16 / 8.5; overflow: hidden; border-radius: 15px; color: #f9f5ec; background: #13272a; box-shadow: inset 0 0 0 1px rgba(255,255,255,.09); }
.preview-frame::before { position: absolute; inset: 0; background: radial-gradient(circle at 93% 0, rgba(216,242,94,.15), transparent 32%), linear-gradient(120deg, rgba(255,255,255,.03), transparent 40%); content: ""; }
.preview-menu { position: relative; z-index: 1; display: grid; height: 100%; grid-template-columns: .85fr 1fr 1fr; gap: 2px; padding: 18px; }
.preview-feature { display: flex; flex-direction: column; justify-content: space-between; padding: 14px; border-radius: 12px; color: #1c2929; background: var(--lime); }
.preview-feature small { font-size: 6px; font-weight: 800; letter-spacing: .12em; }
.preview-feature strong { max-width: 80%; font-size: clamp(12px, 1.3vw, 22px); line-height: 1.05; letter-spacing: -.6px; }
.preview-feature span { font-size: 7px; }
.preview-column { padding: 5px 12px; border-left: 1px solid rgba(255,255,255,.1); }
.preview-column h4 { margin: 2px 0 10px; color: var(--lime); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.mini-product { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; padding: 5px 0; border-bottom: 1px dashed rgba(255,255,255,.12); font-size: 7px; }
.mini-product b { font-size: 7px; font-weight: 600; }
.mini-product small { grid-column: 1 / 2; overflow: hidden; color: #8ba0a1; font-size: 5px; text-overflow: ellipsis; white-space: nowrap; }
.mini-product.sold b { color: #728485; text-decoration: line-through; }
.mini-product.sold em { color: #ff9d90; font-size: 5px; font-style: normal; font-weight: 700; }
.preview-status { position: absolute; right: 12px; bottom: 10px; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 99px; color: #cfe0df; background: rgba(3,11,12,.72); font-size: 6px; }
.preview-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--mint); }

.fleet-list, .activity-list, .quick-list { display: flex; flex-direction: column; }
.fleet-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--soft-line); }
.fleet-row:last-child { border: 0; padding-bottom: 0; }
.device-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: var(--blue); background: #edf3ff; }
.device-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.fleet-row b, .fleet-row small { display: block; }
.fleet-row b { font-size: 11px; }
.fleet-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 99px; font-size: 9px; font-weight: 700; }
.status-chip::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status-chip.online, .status-chip.available, .status-chip.delivered { color: #13795c; background: #e4f7ef; }
.status-chip.offline, .status-chip.unavailable, .status-chip.failed { color: #bd4d4d; background: #fff0ee; }
.status-chip.pending { color: #9b6b13; background: #fff7df; }
.status-chip.draft { color: #5c6e78; background: #eef2f3; }
.activity-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--soft-line); }
.activity-row:last-child { border: 0; }
.activity-dot { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: var(--blue); background: #edf3ff; font-size: 10px; font-weight: 800; }
.activity-row p { margin: 0; font-size: 10px; line-height: 1.45; }
.activity-row p b { font-weight: 700; }
.activity-row small { color: var(--muted); font-size: 8px; white-space: nowrap; }
.quick-list { gap: 8px; }
.quick-action { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--soft-line); border-radius: 11px; background: #fbfcfc; cursor: pointer; }
.quick-action:hover { border-color: #cdd7d8; background: #fff; }
.quick-action span:first-child { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: var(--blue); background: #eef3ff; }
.quick-action b, .quick-action small { display: block; }
.quick-action b { font-size: 10px; }
.quick-action small { margin-top: 2px; color: var(--muted); font-size: 8px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.search-box { position: relative; display: flex; min-width: 240px; flex: 1; align-items: center; }
.search-box svg { position: absolute; left: 12px; width: 16px; height: 16px; fill: none; stroke: #849198; stroke-width: 1.8; }
.search-box input, .control { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #fff; color: var(--ink); }
.search-box input { padding: 0 14px 0 38px; }
.search-box input:focus, .control:focus, .field-label input:focus, .field-label select:focus, .field-label textarea:focus { border-color: #86aaf2; box-shadow: 0 0 0 3px rgba(47,111,237,.08); }
.select-wrap { position: relative; min-width: 155px; }
.select-wrap select { min-height: 40px; padding: 0 35px 0 12px; appearance: none; }
.select-wrap::after { position: absolute; top: 12px; right: 12px; color: var(--muted); content: "⌄"; pointer-events: none; }
.table-card { overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { height: 44px; padding: 0 15px; border-bottom: 1px solid var(--line); color: #849098; background: #f8faf9; font-size: 9px; font-weight: 700; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.data-table td { height: 62px; padding: 9px 15px; border-bottom: 1px solid var(--soft-line); font-size: 11px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfc; }
.product-cell { display: flex; align-items: center; gap: 11px; }
.product-thumb { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #244149; background: linear-gradient(145deg, #d7f3e9, #b7ddd8); font-size: 16px; }
.product-cell b, .product-cell small { display: block; }
.product-cell b { font-size: 11px; }
.product-cell small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.category-pill { display: inline-flex; padding: 5px 8px; border-radius: 7px; color: #51656d; background: #eef2f2; font-size: 9px; font-weight: 700; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.toggle { position: relative; width: 39px; height: 22px; border: 0; border-radius: 99px; background: #cbd4d5; cursor: pointer; transition: .18s; }
.toggle::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); content: ""; transition: .18s; }
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(17px); }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.mini-icon-button { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; }
.mini-icon-button:hover { border-color: #bfcacc; }
.mini-icon-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.pagination { display: flex; gap: 4px; }
.pagination button { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 7px; background: white; font-size: 9px; }
.pagination button.active { color: white; border-color: var(--blue); background: var(--blue); }
.empty-state { display: grid; min-height: 260px; place-items: center; padding: 30px; text-align: center; }
.empty-state-icon { display: grid; width: 62px; height: 62px; margin: auto; place-items: center; border-radius: 18px; color: var(--blue); background: #edf3ff; }
.empty-state h3 { margin: 14px 0 5px; font-size: 15px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); font-size: 10px; }

.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.board-card { padding: 12px; cursor: pointer; transition: .18s ease; }
.board-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.board-thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: #13272a; }
.board-thumb .preview-menu { padding: 9px; }
.board-thumb .preview-feature { padding: 7px; border-radius: 7px; }
.board-thumb .preview-column { padding: 2px 6px; }
.board-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 13px 3px 3px; }
.board-meta b, .board-meta small { display: block; }
.board-meta b { font-size: 12px; }
.board-meta small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.board-editor { display: grid; grid-template-columns: minmax(0, 1.45fr) 330px; gap: 18px; }
.editor-canvas { padding: 16px; }
.editor-canvas .preview-frame { aspect-ratio: 16 / 9; }
.inspector { padding: 20px; }
.inspector-section { padding: 15px 0; border-bottom: 1px solid var(--soft-line); }
.inspector-section:first-child { padding-top: 0; }
.inspector-section:last-child { border: 0; }
.inspector-section h3 { margin: 0 0 11px; font-size: 11px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 32px; height: 32px; border: 3px solid #fff; border-radius: 9px; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 2px var(--blue); }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input { flex: 1; }

/* Menu design studio */
.modal.studio-modal { width: min(1480px, calc(100vw - 34px)); height: min(900px, calc(100vh - 34px)); max-height: none; display: flex; overflow: hidden; flex-direction: column; }
.studio-modal .modal-head { flex: 0 0 auto; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.studio-modal .modal-body { min-height: 0; flex: 1; overflow: auto; padding: 0; background: #f4f6f5; }
.studio-modal .modal-actions { position: relative; z-index: 2; flex: 0 0 auto; background: #fff; box-shadow: 0 -8px 22px rgba(16,32,41,.04); }
.studio-shell { display: grid; min-height: 100%; grid-template-columns: minmax(620px, 1.35fr) minmax(390px, .75fr); }
.studio-main { min-width: 0; padding: 22px; border-right: 1px solid var(--line); }
.studio-side { min-width: 0; padding: 22px; }
.studio-board-fields { display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(100px, .55fr)); gap: 10px; margin-bottom: 16px; }
.studio-board-fields input, .studio-board-fields select { min-height: 38px; }
.studio-preview-wrap { padding: 12px; border: 1px solid #d5dddd; border-radius: 16px; color: var(--muted); background: #fff; font-size: 9px; }
.studio-preview-wrap > span { display: block; padding: 9px 3px 0; }
.studio-canvas { display: grid; aspect-ratio: 16 / 8.5; grid-template-columns: repeat(var(--grid-columns, 48), 1fr); grid-template-rows: repeat(var(--grid-rows, 27), 1fr); gap: 2px; padding: 10px; overflow: hidden; border-radius: 11px; background: #13272a; }
.studio-canvas-block { position: relative; display: flex; min-width: 0; min-height: 0; grid-column: calc(var(--bx) + 1) / span var(--bw); grid-row: calc(var(--by) + 1) / span var(--bh); flex-direction: column; justify-content: flex-end; padding: 7px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--block-color) 75%, white); border-radius: 8px; color: white; background: rgba(255,255,255,.07); }
.studio-canvas-block::after { position: absolute; inset: auto 0 0; height: 60%; background: linear-gradient(transparent, rgba(0,0,0,.65)); content: ""; }
.studio-canvas-block img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.studio-canvas-block small, .studio-canvas-block b { position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-canvas-block small { color: var(--block-color); font-size: 6px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.studio-canvas-block b { font-size: clamp(7px, .9vw, 13px); }
.studio-empty-preview { display: grid; grid-column: 1 / -1; grid-row: 1 / -1; place-items: center; color: #8ca0a2; font-size: 11px; }
.studio-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.studio-section-head h3, .studio-panel h3 { margin: 0; font-size: 13px; }
.studio-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.studio-block-list { display: flex; flex-direction: column; gap: 10px; }
.studio-block { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.studio-block > header { display: flex; min-height: 42px; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--soft-line); background: #f9fbfa; }
.studio-block > header b { font-size: 10px; }
.block-grip { color: #a5b0b2; letter-spacing: -2px; }
.block-actions { display: flex; gap: 4px; margin-left: auto; }
.block-actions button, .catalog-row-actions > button:not(.toggle) { min-width: 27px; min-height: 27px; padding: 0 7px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 9px; cursor: pointer; }
.block-actions button:disabled, .catalog-row-actions button:disabled { opacity: .35; cursor: default; }
.block-form { display: grid; grid-template-columns: repeat(6, minmax(58px, 1fr)); gap: 9px; padding: 11px; }
.block-form .span-2 { grid-column: span 2; }
.block-form .span-4 { grid-column: span 4; }
.block-form .span-6 { grid-column: 1 / -1; }
.block-form .field-label:first-child { grid-column: span 2; }
.block-form input, .block-form select, .block-form textarea { min-height: 34px; margin-top: 4px; padding: 0 8px; border-radius: 8px; font-size: 10px; }
.block-form textarea { padding: 8px; line-height: 1.45; }
.block-json { margin-top: 2px; border-top: 1px solid var(--soft-line); }
.block-json summary { padding: 9px 2px 0; color: var(--muted); font-size: 9px; font-weight: 800; cursor: pointer; }
.block-json > div { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding-top: 8px; }
.block-json textarea { min-height: 92px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; }
.field-label.compact, .check-field.compact { font-size: 8px; }
.check-field { display: flex; min-height: 42px; align-items: center; gap: 8px; padding-top: 17px; color: #506068; font-size: 10px; font-weight: 700; }
.check-field input { width: 15px; height: 15px; margin: 0; }
.upload-button { display: flex; min-height: 34px; align-self: end; align-items: center; justify-content: center; border: 1px dashed #b9c7c8; border-radius: 8px; color: var(--blue); background: #f6f9ff; font-size: 9px; font-weight: 700; cursor: pointer; }
.upload-button input { display: none; }
.studio-empty { padding: 30px; border: 1px dashed #cbd5d5; border-radius: 13px; color: var(--muted); text-align: center; background: rgba(255,255,255,.5); }
.studio-empty b, .studio-empty span { display: block; }
.studio-empty b { margin-bottom: 5px; color: var(--ink); font-size: 12px; }
.studio-empty span { font-size: 9px; }
.studio-panel { margin-bottom: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.studio-panel > h3 { margin-bottom: 13px; }
.studio-panel > h3.subhead { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--soft-line); }
.compact-grid { gap: 10px; }
.compact-grid input, .compact-grid select { min-height: 36px; }
.theme-fields { display: flex; gap: 8px; margin-top: 12px; }
.theme-fields label { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 9px; border: 1px solid var(--soft-line); border-radius: 8px; color: var(--muted); font-size: 8px; }
.theme-fields input { width: 26px; height: 24px; padding: 0; border: 0; background: transparent; }
.catalog-panel .studio-section-head { margin-top: 0; }
.catalog-toolbar { display: flex; gap: 6px; margin-bottom: 10px; }
.catalog-panel details, .modal-body > details { border-top: 1px solid var(--soft-line); }
.catalog-panel summary, .modal-body > details summary { padding: 11px 0; font-size: 9px; font-weight: 800; cursor: pointer; }
.catalog-list { display: flex; max-height: 210px; overflow: auto; flex-direction: column; gap: 5px; padding-bottom: 8px; }
.catalog-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border: 1px solid var(--soft-line); border-radius: 9px; background: #fbfcfc; }
.catalog-row > span:first-child { min-width: 0; }
.catalog-row b, .catalog-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-row b { font-size: 9px; }
.catalog-row small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.catalog-row-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; }
.mini-toggle { width: 31px; height: 18px; }
.mini-toggle::after { top: 3px; left: 3px; width: 12px; height: 12px; }
.mini-toggle.on::after { transform: translateX(13px); }
.soldout-button { min-height: 27px; padding: 0 9px; border: 1px solid #bfe3d5; border-radius: 7px; color: #13795c; background: #eefaf5; font-size: 9px; font-weight: 700; cursor: pointer; }
.soldout-button.sold { color: #b84444; border-color: #f0cdcd !important; background: #fff3f3 !important; }
.danger-icon { color: #b84444 !important; }
.muted-copy { margin: 8px; color: var(--muted); font-size: 9px; }
.contract-note { margin: 0; padding: 4px 4px 20px; color: #74858b; font-size: 8px; line-height: 1.55; }
.contract-note code { color: #4d6370; }
.studio-validation-errors { margin: 0 0 14px; padding: 12px 15px; border: 1px solid #edbdbd; border-radius: 11px; color: #8e2e2e; background: #fff3f3; font-size: 9px; line-height: 1.5; }
.studio-validation-errors b { display: block; margin-bottom: 5px; }
.studio-validation-errors ol { margin: 0; padding-left: 18px; }

.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.device-card { padding: 18px; }
.device-card-head { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; }
.device-card-head .device-icon { width: 42px; height: 42px; }
.device-card h3 { margin: 0; font-size: 12px; }
.device-card h3 + small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.device-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.device-stat { padding: 10px; border-radius: 9px; background: #f5f8f7; }
.device-stat small, .device-stat b { display: block; }
.device-stat small { color: var(--muted); font-size: 8px; }
.device-stat b { margin-top: 4px; font-size: 10px; }
.device-actions { display: flex; gap: 6px; }
.device-actions .button { flex: 1; }

.integration-card { padding: 20px; }
.integration-head { display: flex; align-items: center; gap: 12px; }
.integration-logo { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: white; background: var(--ink); font-weight: 800; }
.integration-logo.toast { color: #e93c2f; background: #fff0ee; }
.integration-logo.api { color: var(--blue); background: #edf3ff; }
.integration-logo.webhook { color: #148567; background: #e8f7f2; }
.integration-head h3 { margin: 0; font-size: 13px; }
.integration-head p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.integration-status { margin-left: auto; }
.code-box { margin-top: 15px; padding: 13px; overflow-x: auto; border: 1px solid #d9e1e1; border-radius: 10px; color: #3d5965; background: #f5f8f7; font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.stat-band { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.stat-band > div { padding: 18px 20px; border-right: 1px solid var(--line); }
.stat-band > div:last-child { border: 0; }
.stat-band small, .stat-band b { display: block; }
.stat-band small { color: var(--muted); font-size: 9px; }
.stat-band b { margin-top: 6px; font-size: 17px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(7,20,27,.55); backdrop-filter: blur(3px); }
.modal { width: min(520px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 20px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.24); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 24px 0; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.modal-close { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; }
.modal-body { padding: 22px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field-label { display: block; color: #506068; font-size: 10px; font-weight: 700; }
.field-label input, .field-label select, .field-label textarea { display: block; width: 100%; min-height: 42px; margin-top: 7px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: white; color: var(--ink); font-size: 12px; }
.field-label textarea { min-height: 84px; padding-top: 10px; resize: vertical; }
.form-error { min-height: 18px; color: var(--red); font-size: 10px; }
.pairing-claim-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding: 10px; border: 1px solid #dce6f8; border-radius: 12px; background: #f5f8ff; }
.pairing-claim-guide span { display: flex; min-width: 0; align-items: center; gap: 7px; color: #4c5e6d; font-size: 9px; line-height: 1.35; }
.pairing-claim-guide i { display: grid; width: 21px; height: 21px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-size: 8px; font-style: normal; font-weight: 800; }
.field-label .pairing-code-input { min-height: 64px; padding-right: 18px; padding-left: 18px; border-color: #b7caee; background: #f9fbff; font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: .34em; text-align: center; text-indent: .34em; }
.field-label .pairing-code-input::placeholder { color: #bec9d7; font-weight: 600; }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; font-weight: 500; line-height: 1.5; }
.field-hint.full { margin-top: -8px; }
.field-hint.warning { color: #946411; }
.field-hint.error { color: var(--red); }
.pairing-claim-form[aria-busy="true"] { opacity: .72; }
.pairing-result { text-align: center; }
.pairing-result-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 11px; place-items: center; border-radius: 50%; color: #fff; background: var(--green); box-shadow: 0 8px 22px rgba(30,170,121,.2); font-size: 24px; font-weight: 800; }
.pairing-result h3 { margin: 0; font-size: 18px; }
.pairing-result > p { margin: 6px auto 16px; max-width: 390px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.pairing-result dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; text-align: left; }
.pairing-result dl > div { min-width: 0; padding: 11px 13px; border-right: 1px solid var(--soft-line); border-bottom: 1px solid var(--soft-line); }
.pairing-result dl > div:nth-child(2n) { border-right: 0; }
.pairing-result dl > div:nth-last-child(-n+2) { border-bottom: 0; }
.pairing-result dt { margin-bottom: 4px; color: var(--muted); font-size: 8px; }
.pairing-result dd { margin: 0; overflow-wrap: anywhere; font-size: 10px; font-weight: 700; }
.pairing-assignment { display: grid; gap: 4px; margin-top: 13px; padding: 12px 14px; border: 1px solid; border-radius: 12px; text-align: left; }
.pairing-assignment.ready { border-color: #bae7d5; color: #176e55; background: #effaf6; }
.pairing-assignment.warning { border-color: #f0d9a8; color: #815b13; background: #fff9e9; }
.pairing-assignment b { font-size: 10px; }
.pairing-assignment span { font-size: 10px; font-weight: 700; }
.pairing-assignment small { opacity: .82; font-size: 9px; line-height: 1.5; }
.toast-root { position: fixed; right: 24px; bottom: 24px; z-index: 150; display: flex; width: 330px; flex-direction: column; gap: 9px; pointer-events: none; }
.toast { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 10px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); animation: toast-in .24s ease-out; }
.toast i { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: #11795c; background: #e6f7ef; font-style: normal; font-weight: 800; }
.toast b, .toast small { display: block; }
.toast b { font-size: 11px; }
.toast small { margin-top: 2px; color: var(--muted); font-size: 9px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.skeleton { position: relative; overflow: hidden; border-radius: 8px; background: #e9eeed; }
.skeleton::after { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); content: ""; transform: translateX(-100%); animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.login-screen { display: grid; min-height: 100vh; grid-template-columns: 1.25fr .75fr; background: #fff; }
.login-visual { position: relative; min-height: 620px; overflow: hidden; background: var(--nav); }
.login-grid { position: absolute; inset: 0; opacity: .13; background-image: linear-gradient(rgba(255,255,255,.2) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.2) 1px, transparent 1px); background-size: 62px 62px; mask-image: linear-gradient(to right, black, transparent 94%); }
.display-mockup { position: absolute; top: 13%; left: 9%; width: 78%; aspect-ratio: 16/8.2; padding: 18px; border: 2px solid rgba(255,255,255,.14); border-radius: 22px; background: #183137; box-shadow: 0 50px 90px rgba(0,0,0,.34); transform: perspective(900px) rotateY(7deg) rotateX(2deg); }
.display-mockup::after { position: absolute; top: 100%; left: 48%; width: 4%; height: 70px; background: linear-gradient(#52646a, #22343a); content: ""; }
.mockup-top { display: flex; justify-content: space-between; padding: 10px 7px 19px; }
.mockup-top span { width: 18%; height: 6px; border-radius: 8px; background: rgba(255,255,255,.14); }
.mockup-top span:last-child { width: 7%; background: var(--lime); }
.mockup-columns { display: grid; height: calc(100% - 36px); grid-template-columns: .75fr 1fr 1fr; gap: 9px; }
.mockup-columns i { display: block; border-radius: 12px; background: repeating-linear-gradient(to bottom, rgba(255,255,255,.12) 0 7px, transparent 7px 23px); }
.mockup-columns i:first-child { background: radial-gradient(circle at 50% 30%, #f8ffb7, transparent 18%), var(--lime); }
.login-copy { position: absolute; right: 10%; bottom: 8%; left: 10%; color: white; }
.login-copy h2 { margin: 0 0 15px; font-size: clamp(30px, 3.1vw, 54px); line-height: 1.06; letter-spacing: -2px; }
.login-copy p { max-width: 530px; margin: 0; color: #92a7ad; font-size: 13px; line-height: 1.7; }
.login-panel { display: grid; place-items: center; padding: 50px; }
.login-form { width: min(360px, 100%); }
.login-heading { margin: 64px 0 30px; }
.login-heading h1 { margin: 0; font-size: 30px; letter-spacing: -1px; }
.login-heading p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.login-form .field-label { margin-bottom: 15px; }
.login-form .field-label input { min-height: 47px; }
.login-hint { margin: 17px 0 0; color: #87959b; font-size: 9px; line-height: 1.55; text-align: center; }
.mobile-only { display: none; }

@media (max-width: 1100px) {
  .grid.metrics { grid-template-columns: repeat(2, 1fr); }
  .grid.two, .board-editor { grid-template-columns: 1fr; }
  .board-grid, .device-grid { grid-template-columns: repeat(2, 1fr); }
  .login-screen { grid-template-columns: 1fr 440px; }
  .studio-shell { grid-template-columns: 1fr; }
  .studio-main { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .topbar { padding: 0 18px; }
  .view-root { padding: 24px 18px 50px; }
  .mobile-only { display: grid; }
  .breadcrumb, .connection-pill, .topbar-actions .button.secondary { display: none; }
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 32px; }
}
@media (max-width: 620px) {
  .grid.metrics, .grid.equal, .board-grid, .device-grid, .form-grid { grid-template-columns: 1fr; }
  .grid.metrics { gap: 11px; }
  .metric-card { min-height: 124px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions, .toolbar { width: 100%; flex-wrap: wrap; }
  .search-box { min-width: 100%; }
  .select-wrap { flex: 1; }
  .table-card { overflow-x: auto; }
  .data-table { min-width: 760px; }
  .stat-band { grid-template-columns: 1fr 1fr; }
  .stat-band > div:nth-child(2) { border-right: 0; }
  .stat-band > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .form-grid .full { grid-column: auto; }
  .modal.studio-modal { width: 100vw; height: 100vh; max-height: none; border-radius: 0; }
  .studio-board-fields { grid-template-columns: 1fr 1fr; }
  .studio-board-fields .field-label:first-child { grid-column: 1 / -1; }
  .block-form { grid-template-columns: repeat(2, 1fr); }
  .block-form .span-2, .block-form .field-label:first-child { grid-column: 1 / -1; }
  .catalog-row { align-items: flex-start; flex-direction: column; }
  .catalog-row-actions { width: 100%; flex-wrap: wrap; }
}

/* Reference-parity application frame ------------------------------------- */
:root {
  --topbar-h: 52px;
  --sidebar-w: 184px;
  --reference-nav: #17202c;
  --reference-nav-soft: #263648;
  --reference-top: #101821;
  --reference-blue: #2f78d5;
}

:focus-visible { outline: 3px solid rgba(47,120,213,.34); outline-offset: 2px; }
.app-shell { min-height: 100vh; background: #f1f3f6; }
.global-topbar {
  position: fixed; inset: 0 0 auto; z-index: 80; display: flex; height: var(--topbar-h);
  align-items: center; justify-content: space-between; padding: 0 14px 0 10px;
  color: #d9e2eb; background: var(--reference-top); box-shadow: 0 1px 8px rgba(5,12,19,.28);
}
.global-brand-wrap, .global-actions { display: flex; min-width: 0; align-items: center; gap: 13px; }
.brand.compact { gap: 8px; }
.brand.compact .brand-mark { width: 27px; height: 27px; padding: 6px; border-radius: 7px; }
.brand.compact b { font-size: 15px; }
.brand.compact em { color: #7f91a1; font-size: 8px; }
.topbar-divider { width: 1px; height: 22px; background: rgba(255,255,255,.12); }
.enterprise-name { max-width: 250px; overflow: hidden; color: #aebdca; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.current-date { color: #9cadba; font-size: 11px; white-space: nowrap; }
.global-topbar .connection-pill { margin: 0; padding: 5px 9px; border-color: rgba(255,255,255,.12); color: #9fb0bd; background: rgba(255,255,255,.035); font-size: 9px; }
.topbar-icon, .topbar-text-button, .account-button {
  border: 0; color: inherit; background: transparent; cursor: pointer;
}
.topbar-icon { position: relative; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 5px; }
.topbar-icon:hover, .topbar-text-button:hover, .account-button:hover { color: #fff; background: rgba(255,255,255,.07); }
.topbar-text-button { display: flex; min-height: 32px; align-items: center; gap: 6px; padding: 0 9px; border-radius: 5px; font-size: 10px; }
.topbar-text-button svg, .topbar-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.notification-button i { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border: 1px solid var(--reference-top); border-radius: 50%; background: #ef5c62; }
.account-button { display: grid; min-width: 156px; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 3px 7px; border-radius: 6px; text-align: left; }
.account-button .avatar { width: 27px; height: 27px; border-radius: 6px; font-size: 8px; }
.account-button b, .account-button small { display: block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-button b { color: #eef4f8; font-size: 10px; }
.account-button small { margin-top: 1px; color: #718493; font-size: 8px; text-transform: capitalize; }
.account-popover { position: fixed; top: 47px; right: 12px; z-index: 120; width: 196px; padding: 6px; border: 1px solid #dce2e7; border-radius: 7px; background: #fff; box-shadow: 0 16px 45px rgba(10,25,38,.2); }
.account-popover button { display: flex; width: 100%; min-height: 36px; align-items: center; justify-content: space-between; padding: 0 11px; border: 0; border-radius: 5px; color: #40505d; background: transparent; font-size: 11px; text-align: left; cursor: pointer; }
.account-popover button:hover { color: var(--reference-blue); background: #eff5fc; }
.account-popover em { min-width: 19px; padding: 2px 5px; border-radius: 9px; color: white; background: #e65a62; font-size: 8px; font-style: normal; text-align: center; }

.app-frame { min-height: 100vh; padding-top: var(--topbar-h); }
.sidebar {
  inset: var(--topbar-h) auto 0 0; z-index: 50; width: var(--sidebar-w); padding: 9px 0 12px;
  color: #aab9c6; background: var(--reference-nav); transition: width .2s ease, transform .2s ease;
}
.main-nav { padding-top: 2px; }
.main-nav a { min-height: 50px; gap: 11px; margin: 0; padding: 0 18px; border-radius: 0; color: #a9b5c1; font-size: 11px; }
.main-nav a b { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.main-nav a:hover { background: rgba(255,255,255,.045); }
.main-nav a.active { color: #fff; background: var(--reference-blue); box-shadow: none; }
.main-nav a [data-icon] { flex: 0 0 18px; }
.sidebar-footer { margin-top: auto; padding: 11px 14px 0; border-color: rgba(255,255,255,.08); }
.sidebar-footer .system-health { padding: 0 0 10px; }
.sidebar-footer > small { display: block; margin-top: 3px; color: #546777; font-size: 7px; line-height: 1.4; }
.workspace { min-height: calc(100vh - var(--topbar-h)); margin-left: var(--sidebar-w); transition: margin-left .2s ease; }
.secondary-nav { position: sticky; top: var(--topbar-h); z-index: 32; display: flex; min-height: 47px; align-items: stretch; gap: 2px; padding: 0 20px; overflow-x: auto; border-bottom: 1px solid #d9dee3; background: #fff; }
.secondary-nav a { position: relative; display: flex; flex: 0 0 auto; align-items: center; padding: 0 14px; color: #64727d; font-size: 11px; white-space: nowrap; }
.secondary-nav a:hover { color: var(--reference-blue); }
.secondary-nav a.active { color: var(--reference-blue); font-weight: 700; }
.secondary-nav a.active::after { position: absolute; right: 13px; bottom: 0; left: 13px; height: 2px; background: var(--reference-blue); content: ""; }
.workspace > .breadcrumb { min-height: 39px; padding: 0 24px; border-bottom: 1px solid #e1e5e8; color: #87939c; background: #fafbfc; }
.workspace > .breadcrumb span { font-size: 9px; }
.workspace > .breadcrumb b { color: #495964; font-size: 10px; }
.view-root { min-height: calc(100vh - 138px); padding: 20px 24px 50px; }
body.sidebar-collapsed .sidebar { width: 58px; }
body.sidebar-collapsed .workspace { margin-left: 58px; }
body.sidebar-collapsed .main-nav a { justify-content: center; padding: 0; }
body.sidebar-collapsed .main-nav a b, body.sidebar-collapsed .main-nav .nav-badge, body.sidebar-collapsed .main-nav .live-pin, body.sidebar-collapsed .sidebar-footer { display: none; }

/* Reference-parity content components ------------------------------------ */
.page-head.reference-head { align-items: center; margin-bottom: 16px; }
.page-head.reference-head h1 { margin-bottom: 4px; font-size: 21px; letter-spacing: -.45px; }
.page-head.reference-head p { font-size: 10px; line-height: 1.45; }
.page-head.reference-head .eyebrow { margin-bottom: 5px; font-size: 8px; }
.reference-shell { min-width: 0; }
.reference-layout { display: grid; min-height: 570px; grid-template-columns: 202px minmax(0, 1fr); gap: 14px; }
.reference-layout.no-tree { grid-template-columns: 1fr; }
.scope-tree { min-width: 0; padding: 13px; border: 1px solid #dfe4e8; border-radius: 5px; background: #fff; }
.scope-tree-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding-bottom: 9px; border-bottom: 1px solid #edf0f2; }
.scope-tree-head b { font-size: 11px; }
.tree-search { width: 100%; min-height: 31px; margin-bottom: 8px; padding: 0 9px; border: 1px solid #dfe4e7; border-radius: 4px; font-size: 10px; }
.tree-list, .tree-list ul { margin: 0; padding: 0; list-style: none; }
.tree-list ul { padding-left: 17px; }
.tree-node { display: flex; min-height: 31px; align-items: center; gap: 7px; padding: 0 7px; border-radius: 4px; color: #52616c; font-size: 10px; cursor: pointer; }
.tree-node:hover, .tree-node.active { color: var(--reference-blue); background: #eef5fc; }
.tree-node::before { color: #8da0ad; content: "▾"; font-size: 8px; }
.tree-node.leaf::before { content: "•"; }
.reference-main-panel { min-width: 0; }
.reference-toolbar { display: flex; min-height: 52px; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid #dfe4e8; border-radius: 5px 5px 0 0; background: #fff; }
.reference-toolbar.wrap { flex-wrap: wrap; }
.reference-toolbar .toolbar-spacer { flex: 1; }
.reference-toolbar input, .reference-toolbar select, .inline-filter input, .inline-filter select {
  min-height: 31px; padding: 0 9px; border: 1px solid #d9e0e5; border-radius: 4px; color: #45545f; background: #fff; font-size: 10px;
}
.reference-toolbar input[type="search"] { min-width: 190px; }
.reference-toolbar label, .inline-filter label { display: inline-flex; align-items: center; gap: 6px; color: #6c7983; font-size: 9px; }
.button.reference { min-height: 31px; padding: 0 11px; border-radius: 4px; font-size: 10px; box-shadow: none; }
.button.reference:hover { transform: none; }
.button.reference.primary { background: var(--reference-blue); }
.button.reference.ghost { border-color: #d9e0e5; color: #53636e; background: #fff; }
.button.reference.danger { border-color: #efcfd1; color: #bf4349; background: #fff7f7; }
.segmented { display: inline-flex; overflow: hidden; border: 1px solid #d9e0e5; border-radius: 4px; }
.segmented button { min-height: 29px; padding: 0 9px; border: 0; border-right: 1px solid #e4e8eb; color: #77858e; background: white; font-size: 9px; cursor: pointer; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { color: var(--reference-blue); background: #edf5ff; }
.reference-table-card { min-width: 0; overflow: hidden; border: 1px solid #dfe4e8; border-top: 0; border-radius: 0 0 5px 5px; background: #fff; }
.reference-table-wrap { max-width: 100%; overflow: auto; }
.reference-table { width: 100%; min-width: 860px; border-collapse: collapse; }
.reference-table th { height: 39px; padding: 0 11px; border-bottom: 1px solid #e1e6e9; color: #677783; background: #f6f8fa; font-size: 9px; font-weight: 600; text-align: left; white-space: nowrap; }
.reference-table td { height: 52px; padding: 8px 11px; border-bottom: 1px solid #edf0f2; color: #42515c; font-size: 9px; vertical-align: middle; }
.reference-table tr:last-child td { border-bottom: 0; }
.reference-table tbody tr:hover { background: #fafcff; }
.reference-table .row-title { display: block; max-width: 220px; overflow: hidden; color: #263640; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.reference-table .row-subtitle { display: block; margin-top: 3px; color: #87949d; font-size: 8px; }
.table-actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.table-actions button { padding: 0; border: 0; color: var(--reference-blue); background: transparent; font-size: 9px; cursor: pointer; }
.table-actions button.danger-link { color: #d44f55; }
.pagination.reference-pagination { display: flex; min-height: 48px; align-items: center; justify-content: flex-end; gap: 7px; padding: 8px 12px; border-top: 1px solid #edf0f2; color: #7a8790; font-size: 9px; }
.pagination.reference-pagination button { min-width: 28px; height: 28px; border: 1px solid #dce2e6; border-radius: 4px; background: #fff; cursor: pointer; }
.pagination.reference-pagination button.active { border-color: var(--reference-blue); color: #fff; background: var(--reference-blue); }
.pagination.reference-pagination button:disabled { opacity: .4; cursor: not-allowed; }
.page-error, .page-empty, .page-loading, .permission-state { display: grid; min-height: 350px; place-items: center; padding: 35px; border: 1px solid #dfe4e8; border-radius: 5px; color: #78858e; background: #fff; text-align: center; }
.page-error > div, .page-empty > div, .page-loading > div, .permission-state > div { max-width: 470px; }
.page-error h3, .page-empty h3, .permission-state h3 { margin: 9px 0 5px; color: #34444f; font-size: 15px; }
.page-error p, .page-empty p, .permission-state p { margin: 0 0 14px; font-size: 10px; line-height: 1.6; }
.page-error .state-icon, .page-empty .state-icon, .permission-state .state-icon { display: grid; width: 48px; height: 48px; margin: auto; place-items: center; border-radius: 50%; color: #7b8b95; background: #eef2f4; font-size: 21px; }
.page-error .state-icon { color: #c84c52; background: #fff0f1; }
.page-loading .skeleton-lines { width: min(430px, 72vw); }
.page-loading .skeleton { margin: 8px 0; }

.material-grid, .scene-grid, .template-grid, .screen-wall-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px; border: 1px solid #dfe4e8; border-top: 0; background: #fff; }
.material-card, .scene-card, .template-card, .wall-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid #e0e5e8; border-radius: 5px; background: #fff; }
.asset-thumb { position: relative; display: grid; aspect-ratio: 16 / 9; place-items: center; overflow: hidden; color: #82919c; background: linear-gradient(145deg,#eef2f5,#f8fafb); }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset-thumb .asset-type { font-size: 23px; }
.asset-select { position: absolute; top: 7px; left: 7px; z-index: 2; }
.asset-card-copy { padding: 9px; }
.asset-card-copy b, .asset-card-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card-copy b { color: #33434e; font-size: 10px; }
.asset-card-copy small { margin-top: 4px; color: #88959e; font-size: 8px; }
.asset-card-actions { display: flex; justify-content: space-between; gap: 5px; padding: 7px 9px; border-top: 1px solid #edf0f2; }
.asset-card-actions button { padding: 0; border: 0; color: var(--reference-blue); background: transparent; font-size: 8px; cursor: pointer; }
.scene-card .asset-thumb, .template-card .asset-thumb { aspect-ratio: 16 / 10; background: linear-gradient(135deg,#213646,#347b9c); }
.scene-card .asset-thumb::after, .template-card .asset-thumb::after { width: 48%; height: 42%; border: 2px solid rgba(255,255,255,.68); border-radius: 5px; box-shadow: 23px 14px 0 -8px rgba(216,242,94,.9); content: ""; }
.library-categories { display: flex; gap: 6px; margin-bottom: 11px; padding: 9px; overflow-x: auto; border: 1px solid #dfe4e8; border-radius: 5px; background: #fff; }
.library-categories button { flex: 0 0 auto; min-height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: 4px; color: #65747f; background: transparent; font-size: 9px; cursor: pointer; }
.library-categories button.active { border-color: #cfe1f6; color: var(--reference-blue); background: #eef6ff; }

.status-pill { display: inline-flex; min-height: 20px; align-items: center; padding: 0 7px; border-radius: 9px; color: #5f6f79; background: #edf1f3; font-size: 8px; font-weight: 650; white-space: nowrap; }
.status-pill.online, .status-pill.active, .status-pill.published, .status-pill.delivered, .status-pill.ready { color: #147856; background: #e7f6ef; }
.status-pill.offline, .status-pill.failed, .status-pill.stopped, .status-pill.expired { color: #b34449; background: #fdecee; }
.status-pill.pending, .status-pill.scheduled, .status-pill.paused { color: #9a6818; background: #fff4da; }
.status-pill.draft { color: #596d9f; background: #edf1ff; }
.wall-card { padding: 8px; }
.wall-shot { position: relative; display: grid; aspect-ratio: 16 / 9; place-items: center; overflow: hidden; border-radius: 3px; color: #92a0a8; background: #1b2832; font-size: 9px; }
.wall-shot img { width: 100%; height: 100%; object-fit: cover; }
.wall-meta { display: flex; align-items: center; justify-content: space-between; padding: 8px 1px 1px; }
.wall-meta b { font-size: 9px; }
.wall-meta small { color: #84919a; font-size: 8px; }
.timeline { position: relative; height: 48px; min-width: 720px; border: 1px solid #e1e6e9; border-radius: 4px; background: repeating-linear-gradient(90deg,#fafbfc 0,#fafbfc calc(4.166% - 1px),#e5e9ec calc(4.166% - 1px),#e5e9ec 4.166%); }
.timeline-bar { position: absolute; top: 12px; height: 22px; padding: 4px 8px; overflow: hidden; border-radius: 3px; color: #fff; background: var(--reference-blue); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }

.stats-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; }
.stats-card { min-height: 112px; padding: 15px; border: 1px solid #dfe4e8; border-radius: 5px; background: #fff; }
.stats-card span, .stats-card small { display: block; color: #7b8993; font-size: 9px; }
.stats-card strong { display: block; margin: 13px 0 8px; color: #263742; font-size: 25px; letter-spacing: -.8px; }
.chart-card { min-height: 270px; margin-top: 12px; padding: 16px; border: 1px solid #dfe4e8; border-radius: 5px; background: #fff; }
.chart-card h3 { margin: 0 0 15px; font-size: 12px; }
.bar-chart { display: flex; height: 190px; align-items: end; gap: 10px; padding: 17px 8px 0; border-bottom: 1px solid #dfe4e8; }
.bar-chart span { position: relative; min-width: 23px; flex: 1; height: var(--bar-height,20%); max-width: 64px; border-radius: 4px 4px 0 0; background: linear-gradient(#5b9ce6,#2f78d5); }
.bar-chart span small { position: absolute; right: -8px; bottom: -22px; left: -8px; color: #84919a; font-size: 7px; text-align: center; }

.wizard-steps { display: grid; grid-template-columns: repeat(3,1fr); margin-bottom: 15px; border: 1px solid #dfe4e8; border-radius: 5px; background: #fff; }
.wizard-step { display: flex; min-height: 49px; align-items: center; gap: 9px; padding: 0 15px; border-right: 1px solid #e5e9ec; color: #77858f; font-size: 10px; }
.wizard-step:last-child { border-right: 0; }
.wizard-step i { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #71818d; background: #edf1f3; font-size: 9px; font-style: normal; }
.wizard-step.active { color: var(--reference-blue); font-weight: 700; }
.wizard-step.active i { color: #fff; background: var(--reference-blue); }
.wizard-panel { min-height: 360px; padding: 18px; border: 1px solid #dfe4e8; border-radius: 5px; background: #fff; }
.wizard-panel h3 { margin: 0 0 14px; font-size: 13px; }
.wizard-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.form-error.inline { margin: 7px 0; padding: 8px 10px; border-radius: 4px; color: #a33b41; background: #fff0f1; font-size: 9px; }
.notice-preview { position: relative; min-height: 150px; overflow: hidden; border-radius: 5px; color: white; background: #1b2731; }
.notice-preview span { position: absolute; right: 0; bottom: 24px; left: 0; padding: 10px; color: var(--notice-color,#fff); background: var(--notice-bg,rgba(210,36,45,.85)); font-size: var(--notice-size,20px); text-align: center; }
.color-swatch { display: inline-block; width: 18px; height: 18px; border: 1px solid rgba(0,0,0,.12); border-radius: 3px; vertical-align: middle; }
.account-profile { display: grid; grid-template-columns: 260px minmax(0,1fr); gap: 14px; }
.profile-card { padding: 20px; border: 1px solid #dfe4e8; border-radius: 5px; background: #fff; }
.profile-avatar { display: grid; width: 68px; height: 68px; margin-bottom: 14px; place-items: center; border-radius: 50%; color: white; background: linear-gradient(135deg,#2f78d5,#34b89d); font-size: 20px; font-weight: 800; }
.profile-list { margin: 0; }
.profile-list div { display: grid; grid-template-columns: 125px 1fr; padding: 11px 0; border-bottom: 1px solid #edf0f2; }
.profile-list dt { color: #87949d; font-size: 9px; }
.profile-list dd { margin: 0; color: #3b4b56; font-size: 10px; }

@media (max-width: 1180px) {
  .material-grid, .scene-grid, .template-grid, .screen-wall-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .reference-layout { grid-template-columns: 180px minmax(0,1fr); }
  .global-topbar .connection-pill, .current-date { display: none; }
}
@media (max-width: 820px) {
  .global-topbar { padding-right: 7px; }
  .enterprise-name, .topbar-divider, .topbar-text-button { display: none; }
  .account-button { min-width: 0; grid-template-columns: 28px auto; }
  .account-button > span:nth-child(2) { display: none; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .workspace, body.sidebar-collapsed .workspace { margin-left: 0; }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
  .secondary-nav { padding: 0 8px; }
  .workspace > .breadcrumb { padding: 0 14px; }
  .view-root { padding: 16px 14px 40px; }
  .reference-layout { grid-template-columns: 1fr; }
  .scope-tree { display: none; }
  .material-grid, .scene-grid, .template-grid, .screen-wall-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .account-profile { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .brand.compact em, .enterprise-name { display: none; }
  .material-grid, .scene-grid, .template-grid, .screen-wall-grid, .stats-grid { grid-template-columns: 1fr; }
  .reference-toolbar { align-items: stretch; flex-direction: column; }
  .reference-toolbar .toolbar-spacer { display: none; }
  .reference-toolbar input, .reference-toolbar select { width: 100%; }
  .wizard-steps { grid-template-columns: 1fr; }
  .wizard-step { border-right: 0; border-bottom: 1px solid #e5e9ec; }
  .wizard-step:last-child { border-bottom: 0; }
  .pairing-claim-guide { grid-template-columns: 1fr; }
  .field-label .pairing-code-input { font-size: 24px; letter-spacing: .25em; text-indent: .25em; }
  .pairing-result dl { grid-template-columns: 1fr; }
  .pairing-result dl > div { border-right: 0; }
  .pairing-result dl > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--soft-line); }
  .pairing-result dl > div:last-child { border-bottom: 0; }
}
