/* CloudGate — vivid SaaS theme */
:root {
  --bg: oklch(0.985 0.008 280);
  --surface: #ffffff;
  --surface-2: oklch(0.975 0.012 280);
  --surface-hover: oklch(0.965 0.018 280);
  --border: oklch(0.9 0.012 280);
  --border-strong: oklch(0.82 0.018 280);
  --text: oklch(0.18 0.04 280);
  --text-muted: oklch(0.48 0.025 280);
  --text-faint: oklch(0.65 0.02 280);

  --brand: oklch(0.58 0.22 285);
  --brand-2: oklch(0.62 0.22 320);
  --brand-hover: oklch(0.52 0.23 285);
  --brand-soft: oklch(0.96 0.04 285);
  --brand-soft-text: oklch(0.42 0.22 285);
  --brand-grad: linear-gradient(135deg, oklch(0.58 0.22 285), oklch(0.62 0.22 320));

  --accent-cyan: oklch(0.72 0.16 200);
  --accent-amber: oklch(0.78 0.17 75);
  --accent-pink: oklch(0.7 0.22 0);

  --ok: oklch(0.6 0.18 155);
  --ok-soft: oklch(0.94 0.08 155);
  --warn: oklch(0.68 0.2 60);
  --warn-soft: oklch(0.95 0.1 75);
  --err: oklch(0.6 0.24 25);
  --err-soft: oklch(0.95 0.06 25);
  --info: oklch(0.62 0.18 230);
  --info-soft: oklch(0.95 0.06 230);

  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.04);
  --shadow-md: 0 1px 3px 0 rgb(15 23 42 / 0.06), 0 1px 2px -1px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.08), 0 4px 6px -4px rgb(15 23 42 / 0.05);

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;

  --sidebar-w: 240px;
  --sidebar-w-collapsed: 60px;
  --topbar-h: 52px;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Layout shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  height: 100vh;
  transition: grid-template-columns 0.18s ease;
}
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.sidebar {
  grid-area: sidebar;
  background:
    linear-gradient(180deg, oklch(0.22 0.06 280), oklch(0.18 0.05 290) 60%, oklch(0.16 0.07 300));
  border-right: 1px solid oklch(0.28 0.05 285);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: oklch(0.85 0.02 280);
  position: relative;
}
.sidebar::before {
  content:'';
  position:absolute; top:0; left:0; right:0; height:200px;
  background: radial-gradient(ellipse at top left, oklch(0.62 0.22 320 / 0.25), transparent 70%);
  pointer-events:none;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  height: var(--topbar-h);
  border-bottom: 1px solid oklch(0.28 0.05 285);
  flex-shrink: 0;
  position: relative;
}
.brand-tile {
  width: 30px; height: 30px;
  background: var(--brand-grad);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px oklch(0.58 0.22 285 / 0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text-1 { font-size: 14px; font-weight: 700; color: white; letter-spacing: -0.01em; }
.brand-text-2 { font-size: 11px; color: oklch(0.7 0.06 285); font-weight: 500; }
.collapsed .brand-text { display: none; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 6px; }
.nav-section-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em;
  color: oklch(0.6 0.06 285);
  padding: 14px 12px 6px;
}
.collapsed .nav-section-label { opacity: 0; height: 0; padding: 0; overflow: hidden; }
.collapsed .nav-section-label.first-section { padding-top: 8px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: var(--radius);
  color: oklch(0.78 0.03 285);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: oklch(0.3 0.05 285 / 0.5); color: white; }
.nav-item.active {
  background: var(--brand-grad);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px oklch(0.58 0.22 285 / 0.4);
}
.nav-item.active::before {
  content:''; position:absolute; left:-6px; top:6px; bottom:6px; width:3px; border-radius:2px; background: var(--accent-cyan);
}
.nav-item .icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item .label { overflow: hidden; text-overflow: ellipsis; }
.collapsed .nav-item .label { display: none; }
.collapsed .nav-item { justify-content: center; padding: 8px; }
.nav-item .badge {
  margin-left: auto;
  font-size: 10.5px; font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: oklch(0.3 0.05 285);
  color: oklch(0.85 0.04 285);
}
.nav-item.active .badge { background: rgba(255,255,255,0.25); color: white; }
.collapsed .nav-item .badge { display: none; }

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid oklch(0.28 0.05 285);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
  background: oklch(0.14 0.05 290);
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--brand));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px oklch(0.14 0.05 290), 0 0 0 3px oklch(0.5 0.18 220 / 0.5);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-meta .name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta .role { font-size: 11px; color: oklch(0.65 0.05 285); }
.collapsed .user-meta { display: none; }

/* ---------- Topbar ---------- */
.topbar {
  grid-area: topbar;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 14px;
  position: relative;
}
.topbar::after {
  content:''; position:absolute; left:0; right:0; bottom:-1px; height:2px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 30%, var(--accent-cyan) 60%, var(--accent-amber) 100%);
  opacity: 0.7;
}
.topbar-toggle {
  width: 30px; height: 30px;
  border-radius: var(--radius);
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.topbar-toggle:hover { background: var(--surface-hover); color: var(--text); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.crumbs .sep { color: var(--text-faint); }
.crumbs .current { color: var(--text); font-weight: 600; }
.topbar-spacer { flex: 1; }

.scope-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.scope-pill .scope-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-amber), oklch(0.7 0.2 30));
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  box-shadow: 0 2px 6px oklch(0.7 0.2 50 / 0.4);
}
.scope-pill .scope-label { color: var(--text-muted); font-weight: 500; }
.scope-pill .scope-name { font-weight: 600; }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--err); border: 1.5px solid var(--surface);
}

/* ---------- Main ---------- */
.main {
  grid-area: main;
  overflow: auto;
  background: var(--bg);
}
.page { padding: 20px 24px 40px; max-width: 1480px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-title { font-size: 22px; font-weight: 600; color: var(--text); margin: 0; letter-spacing: -0.01em; }
.page-sub { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
  transition: all 0.12s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--brand); color: var(--brand); }
.btn.primary {
  background: var(--brand-grad);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px oklch(0.58 0.22 285 / 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn.primary:hover { color: white; box-shadow: 0 6px 16px oklch(0.58 0.22 285 / 0.5), inset 0 1px 0 rgba(255,255,255,0.2); transform: translateY(-1px); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-hover); }
.btn.danger { color: var(--err); border-color: oklch(0.85 0.05 25); }
.btn.danger:hover { background: var(--err-soft); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn .icon { width: 14px; height: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); margin: 0; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat::before {
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background: var(--brand-grad);
}
.stat:nth-child(2)::before { background: linear-gradient(90deg, var(--accent-cyan), oklch(0.65 0.18 180)); }
.stat:nth-child(3)::before { background: linear-gradient(90deg, var(--accent-amber), oklch(0.7 0.2 50)); }
.stat:nth-child(4)::before { background: linear-gradient(90deg, var(--ok), oklch(0.65 0.18 130)); }
.stat-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text); margin-top: 6px; letter-spacing: -0.02em; line-height: 1.1; }
.stat-meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-meta .up { color: var(--ok); font-weight: 700; padding: 1px 6px; background: var(--ok-soft); border-radius: 10px; }
.stat-meta .down { color: var(--err); font-weight: 700; padding: 1px 6px; background: var(--err-soft); border-radius: 10px; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  background: linear-gradient(180deg, oklch(0.97 0.02 285), oklch(0.94 0.03 285));
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: oklch(0.4 0.1 285);
  padding: 10px 12px;
  border-bottom: 2px solid oklch(0.85 0.06 285);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.tbl tbody tr:nth-child(even) td { background: oklch(0.985 0.012 285); }
.tbl tbody tr:hover td { background: oklch(0.96 0.05 285) !important; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl td .mono { font-family: var(--mono); font-size: 12.5px; color: oklch(0.35 0.12 285); font-weight: 500; white-space: nowrap; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .center { text-align: center; }

/* Feature table — bigger rows, brand bar on first cell, dimmer dividers */
.tbl.feature tbody td { padding: 12px 12px; }
.tbl.feature tbody tr td:first-child { position: relative; }
.tbl.feature tbody tr:hover td:first-child::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  background: var(--brand-grad); border-radius: 0 2px 2px 0;
}
.tbl.feature tbody tr.row-ok:hover td:first-child::before { background: linear-gradient(180deg, oklch(0.6 0.2 155), oklch(0.55 0.2 155)); }
.tbl.feature tbody tr.row-warn:hover td:first-child::before { background: linear-gradient(180deg, oklch(0.7 0.22 60), oklch(0.65 0.22 50)); }
.tbl.feature tbody tr.row-err:hover td:first-child::before { background: linear-gradient(180deg, oklch(0.65 0.22 25), oklch(0.6 0.22 20)); }
.tbl.feature tbody tr.row-idle td:first-child { opacity: 0.95; }

/* Cell widgets */
.cell-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 7px;
  font-size: 11px; font-weight: 700;
  color: white;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
}
.cell-avatar.dock { background: linear-gradient(135deg, oklch(0.62 0.18 260), oklch(0.5 0.2 270)); }
.cell-avatar.storage { background: linear-gradient(135deg, oklch(0.6 0.18 200), oklch(0.5 0.2 220)); }
.cell-avatar.process { background: linear-gradient(135deg, oklch(0.65 0.2 320), oklch(0.55 0.22 300)); }
.cell-avatar.reader { background: linear-gradient(135deg, oklch(0.55 0.18 285), oklch(0.45 0.2 270)); }

.cell-id { display: flex; align-items: center; gap: 10px; }
.cell-id .meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-id .name { font-weight: 600; font-size: 13px; line-height: 1.25; }
.cell-id .sub { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); line-height: 1.25; }

/* Util bar — beefier */
.util-bar {
  display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end;
}
.util-bar .track {
  width: 64px; height: 8px;
  background: oklch(0.94 0.015 285);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid oklch(0.9 0.02 285);
  position: relative;
}
.util-bar .fill {
  height: 100%; border-radius: 999px;
  transition: width 0.3s;
  box-shadow: 0 0 6px currentColor;
}
.util-bar .fill.ok { background: linear-gradient(90deg, oklch(0.65 0.2 155), oklch(0.55 0.22 145)); color: oklch(0.55 0.22 145 / 0.5); }
.util-bar .fill.warn { background: linear-gradient(90deg, oklch(0.75 0.2 70), oklch(0.65 0.22 55)); color: oklch(0.65 0.22 55 / 0.5); }
.util-bar .fill.err { background: linear-gradient(90deg, oklch(0.7 0.22 25), oklch(0.6 0.24 18)); color: oklch(0.6 0.24 18 / 0.5); }
.util-bar .pct { font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 700; min-width: 36px; text-align: right; }
.util-bar .pct.ok { color: oklch(0.45 0.18 145); }
.util-bar .pct.warn { color: oklch(0.55 0.2 55); }
.util-bar .pct.err { color: oklch(0.55 0.22 22); }

/* Signal bars (for RSSI) */
.sig {
  display: inline-flex; align-items: flex-end; gap: 2px;
  height: 14px;
}
.sig span {
  width: 3px;
  background: oklch(0.88 0.02 285);
  border-radius: 1px;
}
.sig span.on { background: var(--brand); }
.sig span.on.ok { background: oklch(0.6 0.2 155); }
.sig span.on.warn { background: oklch(0.7 0.22 60); }
.sig span.on.err { background: oklch(0.6 0.22 25); }
.sig span:nth-child(1) { height: 4px; }
.sig span:nth-child(2) { height: 7px; }
.sig span:nth-child(3) { height: 10px; }
.sig span:nth-child(4) { height: 13px; }

/* Code chip — dressier than tag-chip */
.code-chip {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  background: linear-gradient(180deg, oklch(0.97 0.025 285), oklch(0.93 0.03 285));
  border: 1px solid oklch(0.86 0.04 285);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: oklch(0.35 0.14 285);
  box-shadow: inset 0 -1px 0 oklch(0.88 0.04 285);
}

/* Type pill (Dock / Storage / Process) */
.type-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.01em;
}
.type-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.type-pill.dock { background: oklch(0.94 0.06 260); color: oklch(0.4 0.18 265); }
.type-pill.storage { background: oklch(0.94 0.06 210); color: oklch(0.4 0.18 215); }
.type-pill.process { background: oklch(0.95 0.06 320); color: oklch(0.45 0.2 320); }

/* Live tag-stream row */
.tag-row-live td { background: linear-gradient(90deg, oklch(0.94 0.08 285) 0%, transparent 60%); }
.tag-row-live td:first-child { border-left: 3px solid var(--brand); padding-left: 9px; }

/* RSSI inline numeric */
.rssi-cell {
  display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end;
}
.rssi-cell .val { font-family: var(--mono); font-size: 12px; min-width: 34px; text-align: right; color: var(--text-muted); font-weight: 500; }

/* Sparkline-ish numeric trend pill */
.metric-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px; font-weight: 700;
}
.metric-pill.ok { background: var(--ok-soft); color: var(--ok); }
.metric-pill.idle { background: oklch(0.96 0.01 285); color: var(--text-faint); font-weight: 500; }
.metric-pill.hot { background: oklch(0.95 0.06 50); color: oklch(0.5 0.2 50); }

/* ---------- Badges ---------- */
.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11.5px; font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.badge-status .pip { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px currentColor; opacity: 0.95; }
.badge-status .pip { box-shadow: none; }
.badge-status.ok { background: var(--ok-soft); color: var(--ok); }
.badge-status.ok .pip { animation: pulseDot 1.6s ease-in-out infinite; }
.badge-status.warn { background: var(--warn-soft); color: oklch(0.5 0.18 60); }
.badge-status.err { background: var(--err-soft); color: var(--err); }
.badge-status.info { background: var(--info-soft); color: var(--info); }
.badge-status.idle { background: var(--surface-2); color: var(--text-muted); }
@keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; } 50% { box-shadow: 0 0 0 4px transparent; opacity: 0.7; } }

.tag-chip {
  display: inline-flex; align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
}

/* ---------- Inputs ---------- */
.input, .select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px oklch(0.55 0.18 265 / 0.15); }
.input.lg { height: 38px; padding: 0 12px; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text); }
.field .hint { font-size: 11.5px; color: var(--text-muted); }
.input-with-icon { position: relative; }
.input-with-icon .input { padding-left: 30px; }
.input-with-icon .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-faint); width: 14px; height: 14px; }

/* Generic icon sizing fallback */
svg.icon { width: 16px; height: 16px; flex-shrink: 0; }

.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }
.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.seg button {
  height: 30px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px; font-weight: 500;
  border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: none; }
.seg button:hover { background: var(--surface-hover); color: var(--text); }
.seg button.active { background: var(--brand-soft); color: var(--brand-soft-text); }

/* ---------- Login ---------- */
.login-wrap {
  height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--bg);
}
.login-art {
  background:
    radial-gradient(at 15% 20%, oklch(0.62 0.22 320 / 0.55), transparent 50%),
    radial-gradient(at 85% 75%, oklch(0.55 0.2 200 / 0.5), transparent 50%),
    radial-gradient(at 50% 50%, oklch(0.45 0.2 270 / 0.4), transparent 60%),
    linear-gradient(135deg, oklch(0.22 0.08 290), oklch(0.18 0.08 270));
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px;
  color: white;
}
.login-art-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, oklch(0.5 0.05 285 / 0.25) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(0.5 0.05 285 / 0.25) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
  opacity: 0.7;
}
.login-art .glow-orb {
  position:absolute; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, oklch(0.7 0.25 320 / 0.4), transparent 70%);
  filter: blur(40px);
  pointer-events: none;
}
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 24px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
.login-card .sub { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }

/* ---------- Cards ---------- */
.card { box-shadow: var(--shadow-md); border-color: oklch(0.88 0.02 285); }
.card-header { background: linear-gradient(180deg, oklch(0.985 0.015 285), oklch(0.96 0.025 285)); border-bottom-color: oklch(0.88 0.04 285); }
.card-title { font-weight: 700; letter-spacing: -0.005em; }

/* ---------- Inventory grid ---------- */
.inv-matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.inv-matrix thead th {
  background: linear-gradient(180deg, oklch(0.22 0.08 290), oklch(0.18 0.08 280));
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: oklch(0.85 0.08 285);
  padding: 10px 10px;
  border-bottom: 2px solid oklch(0.6 0.18 285);
  border-right: 1px solid oklch(0.3 0.06 285);
  text-align: center;
  position: sticky; top: 0;
}
.inv-matrix thead th:first-child { text-align: left; }
.inv-matrix thead th:last-child { border-right: none; }
.inv-matrix thead th div { color: white !important; }
.inv-matrix thead th div + div { color: oklch(0.75 0.1 285) !important; }
.inv-matrix tbody td {
  padding: 0;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  height: 40px;
  position: relative;
  transition: background 0.1s;
}
.inv-matrix tbody td:last-child { border-right: none; }
.inv-matrix tbody td:first-child {
  text-align: left;
  padding: 0 14px;
  font-weight: 600;
  background: linear-gradient(90deg, oklch(0.96 0.04 285), oklch(0.98 0.02 285));
  border-left: 3px solid var(--brand);
}
.inv-matrix tbody tr:hover td { background: oklch(0.97 0.05 285); }
.inv-matrix tbody tr:hover td:first-child { background: linear-gradient(90deg, oklch(0.93 0.06 285), oklch(0.96 0.04 285)); }
.cell-fill {
  display: flex; align-items: center; justify-content: center;
  height: 100%; width: 100%;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13.5px;
}
.cell-fill.zero { color: oklch(0.78 0.02 285); font-weight: 400; }
.cell-fill.has { color: var(--text); background: linear-gradient(135deg, oklch(0.97 0.04 285), oklch(0.99 0.02 285)); }
.cell-fill.full { color: white; font-weight: 700; background: linear-gradient(135deg, oklch(0.55 0.2 155), oklch(0.6 0.2 145)); text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.cell-fill.low { color: white; font-weight: 700; background: linear-gradient(135deg, oklch(0.65 0.22 40), oklch(0.7 0.22 50)); text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.cell-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--brand-grad); opacity: 0.85; box-shadow: 0 0 8px oklch(0.58 0.22 285 / 0.5); }

/* ---------- Floor plan ---------- */
.floor-wrap {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}
.floor-canvas {
  position: relative;
  background:
    repeating-linear-gradient(0deg, transparent 0 39px, oklch(0.94 0.005 250) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, oklch(0.94 0.005 250) 39px 40px),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  aspect-ratio: 16/10;
  overflow: hidden;
}
.zone {
  position: absolute;
  border: 1.5px dashed oklch(0.65 0.1 285);
  background: linear-gradient(135deg, oklch(0.58 0.22 285 / 0.06), oklch(0.62 0.22 320 / 0.06));
  border-radius: 6px;
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 6px 8px;
  font-size: 11.5px; font-weight: 700;
  color: oklch(0.4 0.12 285);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.reader-pin {
  position: absolute;
  width: 26px; height: 26px;
  background: var(--brand-grad);
  border: 2.5px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--brand), 0 6px 18px oklch(0.58 0.22 285 / 0.5);
  transform: translate(-50%, -50%);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 10px; font-weight: 700;
  z-index: 2;
}
.reader-pin.warn { background: linear-gradient(135deg, var(--accent-amber), oklch(0.6 0.22 40)); box-shadow: 0 0 0 1px var(--warn), 0 6px 18px oklch(0.7 0.18 60 / 0.5); }
.reader-pin.err  { background: linear-gradient(135deg, var(--err), oklch(0.5 0.24 10)); box-shadow: 0 0 0 1px var(--err), 0 6px 18px oklch(0.6 0.24 25 / 0.5); }
.reader-pin.idle { background: oklch(0.7 0.02 280); box-shadow: 0 0 0 1px oklch(0.6 0.02 280); }
.reader-pulse {
  position: absolute;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, oklch(0.58 0.22 285 / 0.3), transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}
.floor-legend { font-size: 12px; color: var(--text-muted); }
.floor-legend .row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.floor-legend .pip { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- Drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgb(15 23 42 / 0.3);
  z-index: 50;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 460px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 51;
  display: flex; flex-direction: column;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer-body { padding: 18px; overflow-y: auto; flex: 1; }

/* ---------- Live tag stream ---------- */
.tag-row-anim {
  animation: rowIn 0.6s ease;
}
@keyframes rowIn {
  0% { background: oklch(0.92 0.18 145); }
  100% { background: transparent; }
}

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; color: var(--text); font-weight: 500; }
.kv dd.mono { font-family: var(--mono); font-size: 12.5px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .ic { font-size: 36px; margin-bottom: 8px; opacity: 0.5; }

/* ---------- Toast / banner ---------- */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--info-soft), oklch(0.95 0.06 200));
  color: var(--info);
  font-size: 12.5px;
  border: 1px solid oklch(0.85 0.08 220);
  font-weight: 500;
}

/* ---------- Page title bling ---------- */
.page-title { background: linear-gradient(135deg, var(--text), oklch(0.35 0.15 285)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ---------- Active nav scrolls visibly ---------- */
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover td { background: oklch(0.97 0.04 285); }

/* tweak panel adjustments */
.tweaks-panel { font-family: var(--font); }
