/* =========================================================================
   RPM Monitoring Management — design system
   ========================================================================= */

:root {
  color-scheme: dark;

  /* ---- DARK (default) ---- */
  --bg-0: #06080d;
  --bg-1: #0a0e16;
  --bg-2: #0d121c;
  --bg-3: #131a27;
  --bg-hover: #161e2c;
  --bg-row-stripe: rgba(255, 255, 255, 0.012);

  --line-faint:   rgba(255, 255, 255, 0.045);
  --line-soft:    rgba(255, 255, 255, 0.08);
  --line-strong:  rgba(255, 255, 255, 0.14);

  --fg-0: #ecf0f8;
  --fg-1: #b9c2d2;
  --fg-2: #7d8699;
  --fg-3: #525b6f;
  --fg-mute: #3a4257;

  /* Brand: change --brand-base, everything else recomputes via color-mix.
     For a complete recolor, this is the only line you need to edit per theme. */
  --brand-base:   #a78bfa;
  --brand:        var(--brand-base);
  --brand-dim:    color-mix(in oklab, var(--brand-base) 62%, #000);
  --brand-soft:   color-mix(in oklab, var(--brand-base) 85%, transparent);
  --brand-glow:   color-mix(in srgb, var(--brand-base) 18%, transparent);
  --brand-ring:   color-mix(in srgb, var(--brand-base) 30%, transparent);
  --brand-on:     #150929;     /* legible text color when sitting on --brand */
  /* gradient stops used by the composed brand mark */
  --brand-mark-1: color-mix(in oklab, var(--brand-base) 60%, #fff);
  --brand-mark-2: var(--brand-base);
  --brand-mark-3: color-mix(in oklab, var(--brand-base) 55%, #000);

  --mint:         #6df5d0;
  --mint-dim:     #2dd4bf;

  --ok:           #4ade80;
  --ok-bg:        rgba(74, 222, 128, 0.08);
  --ok-line:      rgba(74, 222, 128, 0.22);
  --ok-glow:      0 0 6px var(--ok);

  --warn:         #fbbf24;
  --warn-bg:      rgba(251, 191, 36, 0.08);
  --warn-line:    rgba(251, 191, 36, 0.28);
  --warn-glow:    0 0 6px var(--warn);

  --crit:         #fb7185;
  --crit-bg:      rgba(251, 113, 133, 0.09);
  --crit-line:    rgba(251, 113, 133, 0.28);
  --crit-glow:    0 0 6px var(--crit);

  --info:         #7dd3fc;

  /* atmosphere — body::before */
  --atmos-glow-1: rgba(167, 139, 250, 0.08);
  --atmos-glow-2: rgba(109, 245, 208, 0.045);
  --atmos-base:   linear-gradient(180deg, #060810 0%, #06080d 60%, #050709 100%);

  /* grain — body::after */
  --grain-opacity: 0.5;
  --grain-blend:   overlay;
  --grain-image:   url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.045 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");

  /* shadows */
  --shadow-pop: 0 1px 0 rgba(255, 255, 255, 0.04) inset,
                0 12px 28px -10px rgba(0, 0, 0, 0.6);

  /* typography */
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-ui:      "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, "JetBrains Mono", "SFMono-Regular", monospace;

  /* sizing */
  --topbar-h: 80px;
  --subnav-h: 40px;
  --row-h: 36px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-pill: 999px;
}

/* ---- LIGHT ---- */
[data-theme="light"] {
  color-scheme: light;

  --bg-0: #f4f5fa;          /* page bg — cool paper */
  --bg-1: #ffffff;          /* topbar / cards */
  --bg-2: #fafbfd;          /* subtle elevation */
  --bg-3: #eef0f6;          /* control bg */
  --bg-hover: #e7eaf3;      /* row hover */
  --bg-row-stripe: rgba(15, 23, 42, 0.014);

  --line-faint:   rgba(15, 23, 42, 0.06);
  --line-soft:    rgba(15, 23, 42, 0.10);
  --line-strong:  rgba(15, 23, 42, 0.16);

  --fg-0: #0f1424;          /* primary — deep navy */
  --fg-1: #3d4558;
  --fg-2: #6c7488;
  --fg-3: #9aa1b2;
  --fg-mute: #c2c8d4;

  --brand-base:   #7c3aed;        /* deepened for contrast on white */
  --brand:        var(--brand-base);
  --brand-dim:    color-mix(in oklab, var(--brand-base) 70%, #000);
  --brand-soft:   color-mix(in oklab, var(--brand-base) 85%, transparent);
  --brand-glow:   color-mix(in srgb, var(--brand-base) 16%, transparent);
  --brand-ring:   color-mix(in srgb, var(--brand-base) 28%, transparent);
  --brand-on:     #ffffff;
  --brand-mark-1: color-mix(in oklab, var(--brand-base) 50%, #fff);
  --brand-mark-2: var(--brand-base);
  --brand-mark-3: color-mix(in oklab, var(--brand-base) 55%, #000);

  --mint:         #14b8a6;
  --mint-dim:     #0d9488;

  --ok:           #16a34a;
  --ok-bg:        rgba(22, 163, 74, 0.10);
  --ok-line:      rgba(22, 163, 74, 0.30);
  --ok-glow:      0 0 0 transparent;

  --warn:         #d97706;
  --warn-bg:      rgba(217, 119, 6, 0.10);
  --warn-line:    rgba(217, 119, 6, 0.32);
  --warn-glow:    0 0 0 transparent;

  --crit:         #dc2626;
  --crit-bg:      rgba(220, 38, 38, 0.09);
  --crit-line:    rgba(220, 38, 38, 0.30);
  --crit-glow:    0 0 0 transparent;

  --info:         #0284c7;

  --atmos-glow-1: rgba(124, 58, 237, 0.10);
  --atmos-glow-2: rgba(20, 184, 166, 0.07);
  --atmos-base:   linear-gradient(180deg, #fbfafd 0%, #f4f5fa 60%, #eef0f6 100%);

  --grain-opacity: 0.55;
  --grain-blend:   multiply;
  --grain-image:   url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");

  --shadow-pop: 0 1px 0 rgba(255, 255, 255, 0.7) inset,
                0 8px 22px -10px rgba(15, 23, 42, 0.12),
                0 1px 0 rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font-ui);
  font-size: 13px;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
  min-height: 100vh;
}

/* atmospheric gradient + grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 12% -20%, var(--atmos-glow-1), transparent 60%),
    radial-gradient(800px 600px at 105% 10%, var(--atmos-glow-2), transparent 65%),
    var(--atmos-base);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: var(--grain-image);
}
body > * { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* =========================================================================
   TOPBAR
   ========================================================================= */
.topbar {
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: minmax(220px, auto) 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-faint);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--brand-mark-1) 0%, var(--brand-mark-2) 45%, var(--brand-mark-3) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 8px 22px -8px color-mix(in srgb, var(--brand-base) 55%, transparent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.brand-mark-r {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.04em;
  color: #1a0e3a;
  line-height: 1;
}
.brand-mark-arc {
  position: absolute;
  right: -3px;
  top: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px var(--bg-0), 0 0 14px var(--mint-dim);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.65; transform: scale(0.85); }
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.03em;
  color: var(--fg-0);
}
.brand-tag {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 11px;
  color: var(--fg-2);
  margin-top: 3px;
  letter-spacing: 0;
}

.primary-nav {
  display: flex;
  gap: 2px;
  align-items: center;
}
.primary-nav-item {
  position: relative;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  padding: 8px 14px;
  border-radius: var(--r-md);
  transition: color 0.15s, background 0.15s;
}
.primary-nav-item:hover {
  color: var(--fg-0);
  background: var(--bg-2);
}
.primary-nav-item.is-active {
  color: var(--fg-0);
  background: linear-gradient(180deg, var(--brand-glow), transparent);
  box-shadow: 0 0 0 1px var(--brand-ring) inset;
}
.primary-nav-item.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -10px;
  height: 1px;
  background: var(--brand);
  box-shadow: 0 0 12px var(--brand);
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.iconbtn {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--fg-1);
  transition: color 0.15s, background 0.15s;
}
.iconbtn:hover { color: var(--fg-0); background: var(--bg-2); }
.iconbtn-theme .theme-icon-sun,
.iconbtn-theme .theme-icon-moon { transition: opacity 0.2s, transform 0.25s; }
.iconbtn-theme .theme-icon-moon { display: none; }
.iconbtn-theme .theme-icon-sun  { display: block; }
[data-theme="light"] .iconbtn-theme .theme-icon-sun  { display: none; }
[data-theme="light"] .iconbtn-theme .theme-icon-moon { display: block; }
.iconbtn-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 2px var(--bg-0);
}
.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  font-size: 11.5px;
  color: var(--fg-1);
  border: 1px solid var(--line-faint);
}
.topbar-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: var(--ok-glow);
  animation: pulse 2.4s ease-in-out infinite;
}

/* =========================================================================
   SUBNAV
   ========================================================================= */
.subnav {
  height: var(--subnav-h);
  border-bottom: 1px solid var(--line-faint);
  background: var(--bg-1);
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.subnav::-webkit-scrollbar { height: 0; }
.subnav-inner {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 14px;
  height: 100%;
  min-width: max-content;
}
.subnav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-2);
  white-space: nowrap;
  transition: color 0.12s;
}
.subnav-item:hover { color: var(--fg-0); }
.subnav-item.is-active {
  color: var(--fg-0);
  font-weight: 600;
}
.subnav-item.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  background: var(--brand);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 10px var(--brand-glow);
}

/* =========================================================================
   PAGE LAYOUT
   ========================================================================= */
.page {
  padding: 22px 22px 60px;
  max-width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.page-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--fg-0);
  line-height: 1.05;
}
.page-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--fg-2);
  font-size: 0.85em;
  margin-left: 8px;
}
.page-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--fg-2);
  font-feature-settings: "tnum";
}
.page-sub b { color: var(--fg-0); font-weight: 600; }

/* metric strip — small status chips at top */
.metric-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.metric {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line-faint);
  font-size: 11.5px;
  color: var(--fg-2);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 500;
}
.metric b {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 14px;
  color: var(--fg-0);
  letter-spacing: -0.01em;
  font-weight: 500;
}
.metric.is-ok   b { color: var(--ok); }
.metric.is-warn b { color: var(--warn); }
.metric.is-crit b { color: var(--crit); }
.metric.is-mute b { color: var(--fg-1); }

/* =========================================================================
   TOOLBAR
   ========================================================================= */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-faint);
  border-radius: var(--r-lg);
  flex-wrap: wrap;
}

.viewmodes {
  display: inline-flex;
  align-items: center;
  background: var(--bg-0);
  padding: 3px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-faint);
}
.viewmodes-label {
  font-size: 11px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 10px 0 8px;
  border-right: 1px solid var(--line-faint);
  align-self: stretch;
  display: flex;
  align-items: center;
  margin-right: 3px;
}
.viewmode {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  padding: 5px 11px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.viewmode:hover { color: var(--fg-0); }
.viewmode.is-active {
  background: var(--bg-3);
  color: var(--fg-0);
  box-shadow: 0 0 0 1px var(--line-soft) inset;
}

.toolbar-spacer { flex: 1; }

.pagesize {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--fg-2);
}
.pagesize select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-0);
  color: var(--fg-0);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 5px 26px 5px 9px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M1 3l4 4 4-4' stroke='%237d8699' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

.search {
  position: relative;
  width: 280px;
}
.search input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  color: var(--fg-0);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 28px 7px 32px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--fg-3); }
.search input:focus {
  outline: none;
  border-color: var(--brand-ring);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-3);
  pointer-events: none;
}
.search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  background: var(--bg-2);
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid var(--line-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-3);
  border: 1px solid var(--line-soft);
  color: var(--fg-1);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--r-md);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--bg-hover); color: var(--fg-0); border-color: var(--line-strong); }
.btn-primary {
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--brand-base) 75%, #fff),
    color-mix(in oklab, var(--brand-base) 90%, #000));
  border-color: var(--brand-dim);
  color: var(--brand-on);
}
.btn-primary:hover {
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--brand-base) 65%, #fff),
    color-mix(in oklab, var(--brand-base) 80%, #000));
  color: var(--brand-on);
}

/* =========================================================================
   DATA TABLE
   ========================================================================= */
.tablewrap {
  border: 1px solid var(--line-faint);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  overflow: hidden;
  box-shadow: var(--shadow-pop);
}
.tableshell {
  overflow: auto;
  max-height: calc(100vh - var(--topbar-h) - var(--subnav-h) - 250px);
  min-height: 420px;
  scrollbar-color: var(--bg-3) transparent;
  scrollbar-width: thin;
}
.tableshell::-webkit-scrollbar { width: 10px; height: 10px; }
.tableshell::-webkit-scrollbar-track { background: transparent; }
.tableshell::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; border: 2px solid var(--bg-0); }
.tableshell::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

.dt {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.dt thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-1);
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
  padding: 11px 12px 9px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  user-select: none;
}
.dt thead th[data-sort] {
  cursor: pointer;
  transition: color 0.12s;
}
.dt thead th[data-sort]:hover { color: var(--fg-0); }
.dt thead th .sort-ind {
  display: inline-block;
  width: 8px;
  margin-left: 6px;
  color: var(--fg-3);
  font-family: var(--font-mono);
}
.dt thead th.is-sorted { color: var(--fg-0); }
.dt thead th.is-sorted .sort-ind { color: var(--brand); }

.dt tbody td {
  padding: 0 12px;
  height: var(--row-h);
  border-bottom: 1px solid var(--line-faint);
  vertical-align: middle;
  white-space: nowrap;
  color: var(--fg-1);
}
.dt tbody tr:nth-child(even) td { background: var(--bg-row-stripe); }
.dt tbody tr {
  transition: background 0.08s;
}
.dt tbody tr:hover td { background: var(--bg-hover); color: var(--fg-0); }
.dt tbody tr:hover td:first-child {
  box-shadow: inset 2px 0 0 var(--brand);
}
.dt tbody tr.is-crit td:first-child {
  box-shadow: inset 2px 0 0 var(--crit);
}
.dt tbody tr.is-warn td:first-child {
  box-shadow: inset 2px 0 0 var(--warn);
}
.dt tbody tr.is-crit:hover td:first-child {
  box-shadow: inset 2px 0 0 var(--crit), 0 0 0 transparent;
}

.col-cust   { font-weight: 500; color: var(--fg-0); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.row-link   { color: inherit; display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.row-link:hover { color: var(--brand); }
.col-addr   { color: var(--fg-1); max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.col-num    { font-family: var(--font-mono); font-feature-settings: "tnum"; color: var(--fg-1); text-align: right; }
.col-mac    { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-2); letter-spacing: 0.02em; }
.col-pkg    { color: var(--fg-2); font-size: 11.5px; }

.power      { font-family: var(--font-mono); font-feature-settings: "tnum"; text-align: right; font-weight: 500; }
.power.is-ok    { color: var(--ok); }
.power.is-warn  { color: var(--warn); }
.power.is-crit  { color: var(--crit); }
.power.is-zero  { color: var(--fg-mute); }

/* status pill */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  text-transform: capitalize;
  font-feature-settings: "tnum";
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status.is-online   { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-line); }
.status.is-online .status-dot   { background: var(--ok);   box-shadow: var(--ok-glow); animation: pulse 2.4s ease-in-out infinite; }
.status.is-warning  { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.status.is-warning .status-dot  { background: var(--warn); box-shadow: var(--warn-glow); }
.status.is-offline  { background: var(--crit-bg); color: var(--crit); border-color: var(--crit-line); }
.status.is-offline .status-dot  { background: var(--crit); box-shadow: var(--crit-glow); }
.status.is-unknown  { background: var(--bg-3);    color: var(--fg-2); border-color: var(--line-soft); }
.status.is-unknown .status-dot  { background: var(--fg-3); }

/* =========================================================================
   TABLE FOOTER / PAGINATION
   ========================================================================= */
.tablefoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--line-faint);
  background: var(--bg-1);
  font-size: 11.5px;
  color: var(--fg-2);
  gap: 12px;
}
.tablefoot-info b {
  color: var(--fg-0);
  font-family: var(--font-mono);
  font-weight: 500;
}
.pager {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-0);
  border: 1px solid var(--line-faint);
  border-radius: var(--r-md);
  padding: 2px;
}
.pager a, .pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-1);
}
.pager a:hover { background: var(--bg-3); color: var(--fg-0); }
.pager .is-active {
  background: var(--brand);
  color: var(--brand-on);
  font-weight: 600;
}
.pager .is-disabled { color: var(--fg-mute); pointer-events: none; }

/* =========================================================================
   STUB / PLACEHOLDER PAGE
   ========================================================================= */
.stub {
  border: 1px dashed var(--line-soft);
  border-radius: var(--r-lg);
  padding: 64px 28px;
  text-align: center;
  color: var(--fg-2);
  background: var(--bg-1);
}
.stub h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  font-size: 24px;
  color: var(--fg-0);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.stub p { margin: 0; font-size: 13px; max-width: 520px; margin: 0 auto; line-height: 1.6; }
.stub-hint {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
}

/* =========================================================================
   BRAND LOGO (image variant)
   ========================================================================= */
.brand-logo {
  height: 54px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.login-brand-logo {
  height: 56px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
}

@media (max-width: 480px) {
  .brand-logo { max-width: 130px; height: 30px; }
}

/* =========================================================================
   USER CHIP + DROPDOWN
   ========================================================================= */
.user-chip {
  position: relative;
}
.user-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  border: 1px solid var(--line-faint);
  color: var(--fg-1);
  font: inherit;
  font-size: 12px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.user-chip-btn:hover { background: var(--bg-3); border-color: var(--line-soft); color: var(--fg-0); }
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brand-mark-1), var(--brand-mark-2), var(--brand-mark-3));
  color: var(--brand-on);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  gap: 1px;
  text-align: left;
}
.user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-0);
}
.user-role {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.user-role-admin { color: var(--brand); }
.user-chip-caret { color: var(--fg-2); transition: transform 0.15s; }
.user-chip[data-open="true"] .user-chip-caret { transform: rotate(180deg); }

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 6px;
  box-shadow: var(--shadow-pop);
  z-index: 60;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.user-chip[data-open="true"] .user-menu {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.user-menu-head {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line-faint);
  margin-bottom: 4px;
}
.user-menu-name { font-size: 13px; font-weight: 600; color: var(--fg-0); }
.user-menu-email { font-size: 11px; color: var(--fg-2); font-family: var(--font-mono); margin-top: 2px; }
.user-menu-item {
  display: block;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--fg-1);
  border-radius: var(--r-md);
  transition: background 0.1s, color 0.1s;
}
.user-menu-item:hover { background: var(--bg-3); color: var(--fg-0); }
.user-menu-item.is-danger { color: var(--crit); }
.user-menu-item.is-danger:hover { background: var(--crit-bg); color: var(--crit); }
.user-menu-sep { height: 1px; background: var(--line-faint); margin: 4px 0; }

/* =========================================================================
   MOBILE NAV — hamburger + sheet drawer
   ========================================================================= */
.nav-toggle { display: none; }

.nav-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
[data-theme="light"] .nav-sheet-backdrop { background: rgba(15, 23, 42, 0.35); }
.nav-sheet-backdrop[hidden] { display: block; } /* override the [hidden] default — managed by opacity */
body[data-nav-open="true"] .nav-sheet-backdrop { opacity: 1; pointer-events: auto; }

.nav-sheet {
  position: fixed;
  top: 0;
  left: 0;
  height: 100dvh;
  width: min(86vw, 320px);
  background: var(--bg-1);
  border-right: 1px solid var(--line-soft);
  z-index: 80;
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
  box-shadow: 24px 0 48px -28px rgba(0, 0, 0, 0.6);
}
body[data-nav-open="true"] .nav-sheet { transform: none; }
.nav-sheet[aria-hidden="true"] { /* keep it discoverable to AT until opened */ }

.nav-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-faint);
}
.nav-sheet-head .brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--fg-0);
}
.nav-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 16px;
}
.nav-sheet-group { padding: 10px 4px 4px; }
.nav-sheet-group-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-2);
  padding: 0 8px 6px;
  font-weight: 600;
}
.nav-sheet-item {
  display: block;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  border-radius: var(--r-md);
}
.nav-sheet-item:hover { background: var(--bg-2); color: var(--fg-0); }
.nav-sheet-item.is-active {
  background: var(--brand-glow);
  color: var(--fg-0);
  box-shadow: inset 2px 0 0 var(--brand);
}
.nav-sheet-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-faint);
  background: var(--bg-2);
}
.nav-sheet-foot-name {
  display: flex;
  flex-direction: column;
  flex: 1;
  line-height: 1.1;
  gap: 2px;
}
.nav-sheet-signout {
  font-size: 11px;
  padding: 5px 10px;
}

/* =========================================================================
   FOOTER
   ========================================================================= */
.site-foot {
  border-top: 1px solid var(--line-faint);
  padding: 14px 22px 18px;
  margin-top: 40px;
  font-size: 11px;
  color: var(--fg-2);
  background: linear-gradient(180deg, transparent, var(--bg-1));
}
.site-foot-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 100%;
}
.site-foot-brand { letter-spacing: 0.01em; }
.site-foot-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.site-foot-meta a { color: var(--fg-2); }
.site-foot-meta a:hover { color: var(--fg-0); }
.site-foot-sep { color: var(--fg-mute); }

/* =========================================================================
   PILL — generic small label (status pills already defined above, this is
   for non-status uses like role badges, etc.)
   ========================================================================= */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  text-transform: capitalize;
  font-feature-settings: "tnum";
}
.pill-brand { background: var(--brand-glow); color: var(--brand); border-color: var(--brand-ring); }
.pill-mute  { background: var(--bg-3);       color: var(--fg-2); border-color: var(--line-soft); }
.pill-info  { background: rgba(125, 211, 252, 0.10); color: var(--info); border-color: rgba(125, 211, 252, 0.30); }

/* =========================================================================
   PAGE HEAD ACTIONS — title + right-aligned action cluster
   ========================================================================= */
.page-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-search { width: 240px; }

/* =========================================================================
   FLASH MESSAGES
   ========================================================================= */
.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
  animation: rise 0.4s ease-out both;
}
.flash-success { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-line); }
.flash-error   { background: var(--crit-bg); color: var(--crit); border-color: var(--crit-line); }
.flash-info    { background: var(--bg-2);    color: var(--fg-1); }
.flash-msg  { flex: 1; }
.flash-x {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  opacity: 0.6;
  padding: 0 4px;
  cursor: pointer;
}
.flash-x:hover { opacity: 1; }

/* =========================================================================
   USER MANAGEMENT — table & action buttons
   ========================================================================= */
.users-table .col-actions { width: 1%; white-space: nowrap; }

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.user-cell-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.user-cell-name {
  font-weight: 500;
  color: var(--fg-0);
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-cell-handle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  margin-top: 2px;
}
.self-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
  background: var(--brand-glow);
  padding: 1px 6px;
  border-radius: var(--r-pill);
  margin-left: 6px;
  vertical-align: 1px;
}
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.action-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.action-btn:hover { background: var(--bg-3); color: var(--fg-0); border-color: var(--line-soft); }
.action-btn-danger:hover { color: var(--crit); border-color: var(--crit-line); background: var(--crit-bg); }
.action-btn form { display: inline-flex; }

/* =========================================================================
   DRAWER (right-side panel)
   ========================================================================= */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
[data-theme="light"] .drawer-backdrop { background: rgba(15, 23, 42, 0.35); }
.drawer-backdrop[data-open="true"] { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(94vw, 440px);
  background: var(--bg-1);
  border-left: 1px solid var(--line-soft);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
  box-shadow: -24px 0 48px -28px rgba(0, 0, 0, 0.6);
}
.drawer-wide { width: min(94vw, 680px); }
.drawer[data-mode="create"],
.drawer[data-mode="edit"] { transform: none; }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-faint);
}
.drawer-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--fg-0);
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}
.drawer-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-faint);
  background: var(--bg-2);
}

/* =========================================================================
   FORM — used inside drawers and elsewhere
   ========================================================================= */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
}
.form-row-2     { grid-template-columns: 1fr 1fr; }
.form-row-3     { grid-template-columns: 1fr 1fr 1fr; }
.form-row-csz   { grid-template-columns: 2fr 1fr 1fr; } /* city, state, zip */
.form-field-span-2 { grid-column: span 2; }
.form-field textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-ui);
}
.form-hint-error {
  color: var(--crit);
  font-weight: 500;
}
.form-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line-faint);
}

/* When .form is used as a full-page card (create flow), give it more room */
.card.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.form-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.form-label em {
  font-style: normal;
  color: var(--brand);
  margin-left: 2px;
}
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="search"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
  background: var(--bg-0);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  color: var(--fg-0);
  font: inherit;
  font-size: 13px;
  padding: 9px 11px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M1 3l4 4 4-4' stroke='%237d8699' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--brand-ring);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-field input:invalid:not(:placeholder-shown),
.form-field input.is-invalid {
  border-color: var(--crit-line);
  box-shadow: 0 0 0 3px var(--crit-bg);
}
.form-hint {
  font-size: 11px;
  color: var(--fg-3);
  line-height: 1.4;
}

/* Toggle switch (CSS-only) */
.form-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-1);
  cursor: pointer;
  user-select: none;
  padding-bottom: 4px;
}
.form-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.form-toggle-track {
  position: relative;
  width: 34px;
  height: 20px;
  background: var(--bg-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  transition: background 0.15s, border-color 0.15s;
}
.form-toggle-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  background: var(--fg-2);
  border-radius: 50%;
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.15s;
}
.form-toggle input:checked + .form-toggle-track {
  background: var(--brand-glow);
  border-color: var(--brand-ring);
}
.form-toggle input:checked + .form-toggle-track .form-toggle-knob {
  background: var(--brand);
  transform: translateX(14px);
}
.form-toggle input:focus-visible + .form-toggle-track {
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-toggle-text { color: var(--fg-1); }

@media (max-width: 720px) {
  .drawer { width: 100vw; max-width: 100%; border-left: 0; }
  .col-email, .users-table th[data-col="email"] { display: none; }
  .col-last, .users-table th[data-col="last"]   { display: none; }
  .page-head-actions { width: 100%; }
  .inline-search { flex: 1; min-width: 0; width: auto; }
}

/* =========================================================================
   LOGIN PAGE
   ========================================================================= */
.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-shell { width: 100%; max-width: 380px; }
.login-card {
  background: var(--bg-1);
  border: 1px solid var(--line-faint);
  border-radius: 16px;
  padding: 28px 26px 22px;
  box-shadow: var(--shadow-pop);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.login-brand-mark { width: 36px; height: 36px; }
.login-brand-mark .brand-mark-r { font-size: 19px; }
.login-brand-logo { height: 36px; width: auto; max-width: 200px; }
.login-brand-text { display: flex; flex-direction: column; line-height: 1; }
.login-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.025em;
  color: var(--fg-0);
}
.login-brand-tag {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 11px;
  color: var(--fg-2);
  margin-top: 4px;
}
.login-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
  color: var(--fg-0);
  line-height: 1.05;
}
.login-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--fg-2);
  font-size: 0.65em;
  margin-left: 8px;
}
.login-error {
  background: var(--crit-bg);
  border: 1px solid var(--crit-line);
  color: var(--crit);
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 12px;
  margin-bottom: 14px;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-field span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.login-field input {
  background: var(--bg-0);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  color: var(--fg-0);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-field input:focus {
  outline: none;
  border-color: var(--brand-ring);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.login-submit {
  margin-top: 6px;
  padding: 10px 12px;
  font-size: 13px;
  justify-content: center;
}
.login-foot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line-faint);
  font-size: 11px;
  color: var(--fg-3);
  text-align: center;
}

/* =========================================================================
   SEARCH PAGE — multi-field grid
   ========================================================================= */
.search-form {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-faint);
  border-radius: var(--r-lg);
  padding: 18px;
}
.search-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.search-field-wide { grid-column: span 2; }
.search-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-faint);
}

/* =========================================================================
   LIST PAGE EXTRAS
   ========================================================================= */
.row-meta { color: var(--fg-3); font-weight: 400; margin-left: 6px; }
.page-sub-mono {
  font-family: var(--font-mono);
  color: var(--fg-1);
}

/* =========================================================================
   ACCOUNT DETAIL — card grid layout
   ========================================================================= */
.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-template-areas:
    "account  packages"
    "account  email"
    "account  .";
  gap: 16px;
  margin-bottom: 18px;
}
.card-account  { grid-area: account; }
.card-packages { grid-area: packages; }
.card-email    { grid-area: email; }
.card-history  { margin-top: 0; }

.card {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--line-faint);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-pop);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--fg-0);
}
.card-sub {
  font-size: 11.5px;
  color: var(--fg-2);
}
.card-sub b { color: var(--fg-0); font-family: var(--font-mono); font-weight: 500; }
.card-rule {
  border: 0;
  border-top: 1px solid var(--line-faint);
  margin: 14px 0;
}
.card-empty {
  padding: 18px 0;
  text-align: center;
  color: var(--fg-3);
  font-size: 12.5px;
  font-style: italic;
}

/* Key/Value list */
.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 12.5px;
}
.kv dt {
  color: var(--fg-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding-top: 2px;
}
.kv dd { margin: 0; color: var(--fg-0); }
.kv-mono { font-family: var(--font-mono); }

/* Address block */
.address-block {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--fg-1);
}
.address-name {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-0);
  letter-spacing: -0.005em;
}
.address-company { color: var(--fg-2); }

.phone-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
}
.phone {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--brand);
  width: fit-content;
}
.phone:hover { text-decoration: underline; }
.phone-sec { color: var(--fg-2); }

/* Notes */
.notes-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-2);
  font-weight: 600;
  margin-bottom: 6px;
}
.notes-body {
  background: var(--bg-2);
  border: 1px solid var(--line-faint);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-1);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 240px;
  overflow-y: auto;
  line-height: 1.5;
}

/* Packages list */
.package-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.package-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line-faint);
  border-radius: var(--r-md);
  transition: border-color 0.12s, background 0.12s;
}
.package-item:hover { border-color: var(--line-soft); background: var(--bg-3); }
.package-main { flex: 1; min-width: 0; }
.package-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-0);
}
.package-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--fg-2);
  font-family: var(--font-mono);
}
.package-mac    { color: var(--brand); }
.package-mac:hover { text-decoration: underline; }
.package-ip     { color: var(--fg-1); }
.package-serial { color: var(--fg-3); }

/* Email */
.email-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brand);
}
.email-link:hover { text-decoration: underline; }

/* History */
.history-table tbody td { font-size: 12px; }
.history-table .col-num { font-size: 11.5px; }
.tableshell-inset {
  max-height: 460px;
  border-radius: var(--r-md);
}

/* Small button + danger ghost */
.btn-sm { padding: 4px 10px; font-size: 11.5px; }
.btn-danger-ghost {
  background: transparent;
  color: var(--crit);
  border-color: var(--crit-line);
}
.btn-danger-ghost:hover {
  background: var(--crit-bg);
  color: var(--crit);
  border-color: var(--crit);
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1100px) {
  .topbar { gap: 16px; padding: 0 14px; }
  .topbar-status-text { display: none; }
  .topbar-status { padding: 6px; }
  .brand-tag { display: none; }
  .user-meta { display: none; }
  .user-chip-caret { display: none; }
  .user-chip-btn { padding: 3px; }
}
@media (max-width: 860px) {
  .primary-nav { display: none; }
  .nav-toggle { display: grid; place-items: center; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .topbar-status { display: none; }
}
@media (max-width: 960px) {
  .search-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-field-wide { grid-column: span 2; }
  .account-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "account"
      "packages"
      "email";
  }
}
@media (max-width: 720px) {
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .search { width: 100%; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page { padding: 14px; }
  .search-grid { grid-template-columns: 1fr; }
  .search-field-wide { grid-column: auto; }
  .kv { grid-template-columns: 90px 1fr; }
  .brand-name { font-size: 14px; }
  .brand { gap: 8px; }
  .col-mac, .col-pkg, .dt thead th[data-col="mac"], .dt thead th[data-col="pkg"],
  .dt tbody td.col-mac, .dt tbody td.col-pkg { display: none; }
  .site-foot { padding: 14px 14px 18px; }
}
@media (max-width: 480px) {
  .brand-text { display: none; }
  .topbar { padding: 0 10px; gap: 8px; }
}

/* =========================================================================
   ANIMATIONS — staged page reveal
   ========================================================================= */
@media (prefers-reduced-motion: no-preference) {
  .page-head, .toolbar, .tablewrap {
    animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .toolbar  { animation-delay: 0.08s; }
  .tablewrap { animation-delay: 0.16s; }
  .dt tbody tr {
    animation: rowin 0.4s ease-out both;
  }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes rowin {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* selection */
::selection { background: var(--brand-glow); color: var(--fg-0); }

/* hide rows by view-mode */
[data-viewmode="simple"]   .col-mac,
[data-viewmode="simple"]   .col-pkg,
[data-viewmode="simple"]   th[data-col="mac"],
[data-viewmode="simple"]   th[data-col="pkg"] { display: none; }

[data-viewmode="classic"]  .col-cmts,
[data-viewmode="classic"]  .col-node,
[data-viewmode="classic"]  th[data-col="cmts"],
[data-viewmode="classic"]  th[data-col="node"] { display: none; }

[data-viewmode="model"]    .col-cust,
[data-viewmode="model"]    .col-addr,
[data-viewmode="model"]    th[data-col="cust"],
[data-viewmode="model"]    th[data-col="addr"] { display: none; }
