/* ── Admin Console: Ledger Design System ────────────────────────── */
:root,
html[data-theme="light"] {
  --paper: #FFFFFF;
  --canvas: #F6F6F7;
  --sunken: #EFEFF1;
  --ink: #0A0A0B;
  --ink-2: #3A3A3F;
  --ink-3: #6C6C74;
  --ink-4: #9A9AA2;
  --line: rgba(0, 0, 0, 0.10);
  --line-strong: rgba(0, 0, 0, 0.22);
  --signal: #D9383A;
  --signal-soft: rgba(217, 56, 58, 0.12);

  /* Semantic Aliases for existing components */
  --bg: var(--canvas);
  --bg-deep: var(--sunken);
  --bg-top: var(--paper);
  --muted: var(--ink-3);
  --card: var(--paper);
  --card-solid: var(--paper);
  --surface: var(--paper);
  --surface-soft: var(--sunken);
  --input-bg: var(--paper);
  --accent: var(--ink);
  --accent-soft: var(--sunken);
  --accent-ink: var(--ink);
  --warn: var(--ink-2);
  --warn-soft: var(--sunken);
  --danger: var(--signal);
  --danger-soft: var(--signal-soft);
  --ok: var(--ink);
  --ok-soft: var(--sunken);
  --dock: var(--paper);
  --topbar-fade: var(--paper);
  --btn-primary-bg: var(--ink);
  --btn-primary-fg: var(--paper);
  --seg-active-bg: var(--ink);
  --seg-active-fg: var(--paper);
  --modal-bg: var(--paper);

  /* Radius scale: 0 / 4 / 6 / 999 */
  --radius-xs: 0px;
  --radius-sm: 4px;
  --radius: 4px;
  --radius-lg: 6px;
  --radius-pill: 999px;

  /* Density Default (Comfortable: 42px) */
  --row-h: 42px;
  --cell-py: 9px;
  --cell-px: 12px;
  --font-table: 13px;

  /* Elevation: Flat surfaces, box-shadow reserved strictly for modals and mobile dock */
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.14);
  --glow-a: transparent;
  --glow-b: transparent;

  --safe-top: max(96px, env(safe-area-inset-top, 96px));
  --safe-bottom: max(28px, env(safe-area-inset-bottom, 28px));
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter Tight", "Inter", "Vazirmatn", sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter Tight", "Inter", "Vazirmatn", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #0B0B0C;
  --canvas: #080809;
  --sunken: #141416;
  --ink: #FAFAFA;
  --ink-2: #B6B6BD;
  --ink-3: #8A8A93;
  --ink-4: #5A5A61;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.22);
  --signal: #FF5252;
  --signal-soft: rgba(255, 82, 82, 0.14);

  --bg: var(--canvas);
  --bg-deep: var(--sunken);
  --bg-top: var(--paper);
  --muted: var(--ink-3);
  --card: var(--paper);
  --card-solid: var(--paper);
  --surface: var(--paper);
  --surface-soft: var(--sunken);
  --input-bg: var(--paper);
  --accent: var(--ink);
  --accent-soft: var(--sunken);
  --accent-ink: var(--ink);
  --warn: var(--ink-2);
  --warn-soft: var(--sunken);
  --danger: var(--signal);
  --danger-soft: var(--signal-soft);
  --ok: var(--ink);
  --ok-soft: var(--sunken);
  --dock: var(--paper);
  --topbar-fade: var(--paper);
  --btn-primary-bg: var(--ink);
  --btn-primary-fg: var(--paper);
  --seg-active-bg: var(--ink);
  --seg-active-fg: var(--paper);
  --modal-bg: var(--paper);

  --shadow-xs: none;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --glow-a: transparent;
  --glow-b: transparent;

  color-scheme: dark;
}

[data-density="compact"] {
  --row-h: 32px;
  --cell-py: 5px;
  --cell-px: 8px;
  --font-table: 12px;
}

[data-density="comfortable"] {
  --row-h: 42px;
  --cell-py: 9px;
  --cell-px: 12px;
  --font-table: 13px;
}

/* ── Tabular Figures (Numbers never move) ────────────────────────── */
body, table, td, th, .mono, .stat, .badge, .meta, .hero-traffic-val,
.telemetry-main-val, .num, .speed-val, .kpi-val, .kpi-strip-val,
input[type="number"], input[inputmode="numeric"] {
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
}

/* ── Motion & Reduced Motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Ledger Shell & Navigation ────────────────────────────────────── */
.app-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
  background: var(--canvas);
}

.desktop-rail {
  display: none;
}

.app-main {
  width: 100%;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  min-height: 100vh;
  padding: 0 14px calc(90px + var(--safe-bottom)) !important;
  box-sizing: border-box;
}

@media (min-width: 1024px) {
  :root, html[data-theme="dark"] {
    --safe-top: 0px;
    --safe-bottom: 0px;
  }
  .desktop-rail {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 232px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--paper);
    border-right: 1px solid var(--line);
    z-index: 50;
    padding: 16px 12px;
    box-sizing: border-box;
  }

  .app-main {
    margin-left: 232px;
    width: calc(100% - 232px);
    max-width: 1440px;
    margin-right: auto;
    padding: 16px 36px 48px !important;
  }

  .dock {
    display: none !important;
  }

  .topbar {
    position: static;
    margin: 0 0 24px 0 !important;
    padding: 12px 0 16px !important;
    border-bottom: 1px solid var(--line);
    overflow: visible !important;
  }
}

.rail-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: block;
  line-height: 1.2;
}
.brand-sub {
  font-size: 11px;
  color: var(--ink-3);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
}
.rail-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease-out, color 0.12s ease-out;
}
.rail-nav-item:hover {
  background: var(--sunken);
  color: var(--ink);
}
.rail-nav-item.active {
  background: var(--sunken);
  color: var(--ink);
  font-weight: 600;
  border-color: var(--line);
}
.rail-footer {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rail-command-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--canvas);
  color: var(--ink-3);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.12s ease-out, color 0.12s ease-out;
}
.rail-command-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.rail-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* Command Palette */
.palette-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 70px 16px 16px;
}
.palette-modal.hidden {
  display: none !important;
}
.palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.palette-box {
  position: relative;
  width: 100%;
  max-width: 540px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(85vh - 70px);
}
.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.palette-input-wrap input {
  flex: 1 1 auto;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  font-family: var(--font);
}
.palette-hint {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--sunken);
  color: var(--ink-3);
  border: 1px solid var(--line);
  font-family: var(--mono);
}
.palette-results {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13.5px;
}
.palette-item:hover, .palette-item.active {
  background: var(--sunken);
  color: var(--ink);
  border-color: var(--line);
}
.palette-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  padding: 8px 12px 4px;
  font-weight: 600;
}

/* Command trigger button in header */
.command-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-3);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.12s ease-out, color 0.12s ease-out;
}
.command-trigger-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.kbd-shortcut {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--sunken);
  color: var(--ink-3);
  border: 1px solid var(--line);
  font-family: var(--mono);
}

/* ── DataTable Primitive (Ledger) ────────────────────────────────── */
.datatable-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  margin: 12px 0 18px;
}
.datatable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.datatable-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.datatable-count {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--mono);
}
.datatable {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--font-table);
}
.datatable thead {
  background: var(--sunken);
  position: sticky;
  top: 0;
  z-index: 10;
}
.datatable th {
  padding: var(--cell-py) var(--cell-px);
  border-bottom: 1px solid var(--line-strong);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  user-select: none;
}
.datatable th.is-sortable {
  cursor: pointer;
}
.datatable th.is-sortable:hover {
  color: var(--ink);
}
.th-content {
  display: flex;
  align-items: center;
  gap: 6px;
}
.th-content.text-right {
  justify-content: flex-end;
}
.sort-glyph {
  font-size: 10px;
  color: var(--ink-4);
}
.datatable th.is-sorted-asc .sort-glyph,
.datatable th.is-sorted-desc .sort-glyph {
  color: var(--ink);
}
.datatable tbody tr {
  height: var(--row-h);
  border-bottom: 1px solid var(--line);
  transition: background 0.1s ease-out;
}
.datatable tbody tr:last-child {
  border-bottom: none;
}
.datatable tbody tr:hover {
  background: var(--sunken);
}
.datatable tbody tr:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}
.datatable td {
  padding: var(--cell-py) var(--cell-px);
  color: var(--ink);
}
.datatable td.text-right, .datatable th.text-right {
  text-align: right;
}
.datatable td.text-center, .datatable th.text-center {
  text-align: center;
}
.datatable-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--ink-3);
}

/* Thin KPI strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.kpi-strip-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  padding: 10px 12px;
}
.kpi-strip-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.kpi-strip-val {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
-webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  transition: background .25s ease, color .2s ease;
}

/* Unified LTR console layout */
#view-fleet,
#view-servers {
  direction: ltr;
  text-align: start;
  font-family: var(--font);
  line-height: 1.6;
}
#view-fleet [dir="ltr"],
#view-servers [dir="ltr"],
#view-fleet .mono,
#view-servers .mono,
#view-fleet code,
#view-servers code,
#view-fleet pre.detail,
#view-servers pre.detail,
#view-fleet input[dir="ltr"],
#view-servers input[dir="ltr"] {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}

.app {
  width: 100%;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  min-height: 100vh;
  padding: 12px 14px calc(88px + var(--safe-bottom));
  transition: max-width .25s ease;
  box-sizing: border-box;
}
.app.wide {
  max-width: min(960px, calc(100vw - 24px));
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 900px) {
  .app.wide .dock {
    width: min(640px, calc(100% - 20px));
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 45;
  margin: 0 -14px 14px -14px;
  padding: max(96px, var(--safe-top)) max(14px, var(--safe-right)) 10px max(14px, var(--safe-left));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
}
.topbar-brand-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 auto;
}
.brand-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  animation: pulse-glow 2.5s infinite;
  flex-shrink: 0;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 2px var(--ok-soft); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 35%, transparent); }
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.brand {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--ink);
  direction: ltr;
  unicode-bidi: isolate;
  line-height: 1.15;
  white-space: nowrap;
}
.subtitle {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  box-shadow: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  box-sizing: border-box;
}
.icon-btn:hover {
  background: var(--card-solid);
  border-color: var(--line-strong);
}
.icon-btn:active {
  transform: scale(0.92);
}
.icon-btn.spinning {
  animation: spin 0.75s linear infinite;
}

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  transform: none;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-radius: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 6px 2px max(28px, var(--safe-bottom)) !important;
  gap: 2px;
  z-index: 50;
  box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}
.dock button {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  border-radius: var(--radius-xs);
  padding: 5px 2px 4px;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  min-width: 0;
  width: 100%;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.dock button svg,
.dock button .dock-icon {
  width: 19px;
  height: 19px;
  stroke-width: 1.6;
  flex-shrink: 0;
  display: block;
}
.dock button span {
  font-size: 10px !important;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  opacity: 0.85;
  transform: none !important;
}
.dock button:hover {
  color: var(--ink);
}
.dock button.active {
  background: var(--sunken);
  color: var(--ink);
}
.dock button.active svg,
.dock button.active .dock-icon {
  stroke-width: 2.2;
}
.dock button.active span {
  opacity: 1;
  font-weight: 700;
  color: var(--ink);
}
.dock button:active {
  transform: scale(0.94);
}
.dock-badge {
  position: absolute;
  top: 2px;
  right: 6px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--signal);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--paper);
}

@media (max-width: 768px) {
  .topbar {
    padding-top: max(96px, var(--safe-top)) !important;
    padding-bottom: 8px;
  }
  .brand {
    font-size: 1.1rem;
  }
  .subtitle {
    display: none;
  }
  #btn-density {
    display: none !important;
  }
  #topbar-xz-btn span:first-child {
    display: none !important;
  }
  .command-trigger-btn {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    justify-content: center;
    border-radius: var(--radius-xs);
  }
  .command-trigger-btn .trigger-label,
  .command-trigger-btn .kbd-shortcut {
    display: none !important;
  }
  .icon-btn {
    width: 32px !important;
    height: 32px !important;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
  }
  .icon-btn svg {
    width: 15px;
    height: 15px;
  }
  #topbar-xz-btn {
    height: 32px;
    padding: 2px 7px !important;
    font-size: 11px !important;
    flex-shrink: 0;
  }
  .top-actions {
    gap: 4px;
    flex-shrink: 0;
  }
  input, select, textarea {
    font-size: 16px !important;
  }
  .datatable {
    min-width: 480px;
  }
  .filter-pills-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    max-width: 100%;
  }
  .filter-pills-bar::-webkit-scrollbar {
    display: none;
  }
  .filter-pills-bar button {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .topbar {
    gap: 4px;
  }
  .topbar-brand-wrap {
    gap: 5px;
  }
}

.panel, .card, .tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  }
.card, .tile {
  padding: 16px;
  margin-bottom: 12px;
  animation: rise .28s ease both;
}
.panel.state {
  text-align: center;
  padding: 48px 16px;
  margin-top: 24px;
}
.hidden { display: none !important; }
.view { animation: rise .25s ease; }

.spinner {
  width: 32px; height: 32px; margin: 0 auto 12px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.err-title { margin: 0 0 8px; font-family: var(--display); font-size: 1.25rem; }
.h-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.muted { color: var(--muted); font-weight: 600; }
.meta { color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tiny { font-size: 0.78rem; }

.seg {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.seg button.active {
  background: var(--seg-active-bg);
  color: var(--seg-active-fg);
  border-color: var(--seg-active-bg);
}

.hero {
  padding: 18px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--paper);
border: 1px solid var(--line);
  box-shadow: none;
}
.hero-val {
  margin: 4px 0;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.78rem;
  font-weight: 700;
}
.live-pill i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.18);
}

/* ── Telemetry & Live Rates ── */
.live-speed-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.speed-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: none;
}
.speed-icon {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  width: 24px;
  text-align: center;
  line-height: 1;
}
.speed-val {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.speed-lbl {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
@media (max-width: 480px) {
  .live-speed-bar {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .speed-item {
    padding: 8px 12px;
  }
}

.peak-breakdown-card {
  margin-top: 12px;
}
.peak-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 10px;
  background: var(--surface-soft);
  max-height: 380px;
}
.peak-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}
.peak-table th,
.peak-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.peak-table th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 2;
}
.peak-table tr:last-child td {
  border-bottom: 0;
}
.peak-table tr.is-peak-row {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.font-bold {
  font-weight: 700;
}
.grade-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.grade-peak { background: var(--accent); color: #fff; }
.grade-heavy { background: var(--warn-soft); color: var(--warn); }
.grade-elevated { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.grade-normal { color: var(--muted); }
.grade-off-peak { color: var(--muted); opacity: 0.65; }

.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.stat {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: start;
  box-shadow: none;
  font: inherit;
  color: inherit;
  cursor: default;
}
.stat.tap { cursor: pointer; }
.stat.tap:active { transform: scale(0.98); }
.stat b {
  display: block;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.stat.warn { background: var(--paper);
}
.stat.accent { background: var(--paper);
}
.stat.ok { background: var(--paper);
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(18, 21, 26, 0.08);
  overflow: hidden;
  margin: 10px 0;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--paper);
border-radius: inherit;
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 4px;
  max-height: 320px;
  overflow-y: auto;
}
.day-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.day-row-when {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text, inherit);
}
.day-row.is-today .day-row-when {
  color: var(--accent);
}
.day-row-vol {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.day-row-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.18);
  overflow: hidden;
}
.day-row-track > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--paper);
}
.day-sum {
  margin: 12px 0 0;
  font-size: 0.9rem;
}

.dom-table {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 8px 0 4px;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.dom-head,
.dom-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 5.2rem 4.5rem;
  gap: 6px 8px;
  align-items: center;
  padding: 10px 12px;
}
.dom-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.dom-row {
  position: relative;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.dom-row:last-child { border-bottom: 0; }
button.dom-row-btn {
  width: 100%;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button.dom-row-btn:last-child { border-bottom: 0; }
button.dom-row-btn:active,
button.dom-row-btn:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.dom-rank { color: var(--muted); font-weight: 700; }
.dom-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dom-hits { font-weight: 800; text-align: end; color: var(--accent); }
.dom-when {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: end;
  white-space: nowrap;
}
.dom-bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.16);
  overflow: hidden;
  margin-top: -2px;
}
.dom-bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--paper);
}
.dom-members {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  font-size: 0.8rem;
}
.dom-members summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  user-select: none;
}
.dom-member {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border-top: 1px dashed var(--line);
  color: var(--muted);
}
.dom-member .mono { color: var(--accent); font-weight: 700; }
@media (max-width: 420px) {
  .dom-head .dom-when,
  .dom-row .dom-when { display: none; }
  .dom-head,
  .dom-row {
    grid-template-columns: 2rem minmax(0, 1fr) 4.8rem;
  }
}

.ticket-thread {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  max-height: 50vh;
  overflow-y: auto;
}
.ticket-msg {
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(18, 21, 26, 0.05);
}
.ticket-msg.admin {
  background: var(--accent-soft, rgba(20, 184, 166, 0.12));
}
.ticket-msg p {
  margin: 4px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.hour-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 88px;
  margin-top: 10px;
}
.h-bar {
  flex: 1;
  display: block;
  border-radius: 4px 4px 2px 2px;
  background: rgba(15, 118, 110, 0.28);
  min-height: 6px;
}
.h-bar.is-peak { background: var(--accent); }
.hour-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Home Fleet Traffic Dynamics & Hourly Chart ──────────────── */
.home-chart-card {
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--card-solid);
  border-radius: var(--radius-sm);
}

.home-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.home-chart-ctrls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.home-chart-viewport {
  position: relative;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 16px 8px 8px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.home-chart-gridlines {
  position: absolute;
  top: 16px;
  left: 8px;
  right: 8px;
  bottom: 26px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.home-chart-gridline {
  border-bottom: 1px dashed var(--line);
  opacity: 0.45;
  width: 100%;
}

.home-chart-bars-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
  width: 100%;
  min-width: 480px;
  z-index: 1;
}

.h-col {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 0 1px;
  border-radius: 4px;
  transition: background 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.h-col:hover {
  background: rgba(255, 255, 255, 0.05);
}

.h-col.is-selected {
  background: var(--sunken);
}

.h-bar-track {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.h-bar-fill {
  width: 100%;
  max-width: 24px;
  border-radius: 4px 4px 1px 1px;
  background: var(--line-strong);
  min-height: 6px;
  transition: height 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.15s ease, box-shadow 0.15s ease;
}

.h-col:hover .h-bar-fill {
  background: var(--ink);
}

.h-col.is-peak .h-bar-fill {
  background: var(--signal);
}

.h-col.is-selected .h-bar-fill {
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--brand, #3b82f6);
}

.h-col.is-peak.is-selected .h-bar-fill {
  background: var(--signal);
  box-shadow: 0 0 0 2px var(--signal);
}

.h-col-label {
  font-size: 10.5px;
  font-family: var(--mono);
  color: var(--muted);
  line-height: 1;
  padding: 2px 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s ease;
}

.h-col:hover .h-col-label {
  color: var(--ink);
  font-weight: 700;
}

.h-col.is-selected .h-col-label {
  color: var(--brand, #3b82f6);
  font-weight: 800;
}

.h-col.is-peak .h-col-label {
  color: var(--signal);
  font-weight: 700;
}

.home-chart-details {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  animation: fadeIn 0.2s ease-in-out;
}

.home-chart-details-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}

.home-chart-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.home-chart-stat-tile {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
}

.home-chart-stat-k {
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 2px;
}

.home-chart-stat-v {
  font-size: 13.5px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--ink);
}

.home-chart-stat-sub {
  font-size: 10px;
  color: var(--ink-3);
  font-family: var(--mono);
  margin-top: 1px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: none;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  background: var(--card-solid);
  border-color: var(--line-strong);
}
.btn:active {
  transform: scale(0.97);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 1px var(--accent);
}
.btn.primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: var(--btn-primary-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.btn.primary:hover {
  opacity: 0.94;
}
.btn.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
}
.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn.ghost:hover {
  background: var(--surface);
  border-color: var(--line);
}
.btn.sm {
  padding: 6px 11px;
  font-size: 0.78rem;
  border-radius: var(--radius-xs);
}
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0 0 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 100px; resize: vertical; }
label {
  display: block;
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.search-row, .discount-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}
.search-row input, .discount-row input { margin: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.badge.off {
  background: var(--surface-soft);
  color: var(--muted);
  border-color: var(--line);
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 30%, transparent);
}
.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.person, .list-item, .server-row {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: start;
  font: inherit;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.person:hover, .list-item:hover, .server-row:hover {
  background: var(--card-solid);
  border-color: var(--line-strong);
}
.person:active, .list-item:active, .server-row:active { transform: scale(0.985); }
.person.static { cursor: default; }
.person.static > *:not(button) { pointer-events: none; }
.person.static button { pointer-events: auto; cursor: pointer; }
.person-ava {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 0.88rem;
  flex: 0 0 auto;
}
.person-ava.live {
  background: var(--ok-soft);
  color: var(--ok);
  box-shadow: 0 0 0 2px var(--ok-soft);
}
.person-body { flex: 1; min-width: 0; }
.person-body strong { display: block; font-size: 0.92rem; font-weight: 650; }
.person-body .meta { display: block; margin-top: 2px; }
.chev { color: var(--muted); font-size: 1.1rem; }

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.count {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.node-ok { border-inline-start: 3px solid var(--ok); }
.node-bad { border-inline-start: 3px solid var(--danger); }
.peer-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.peer-row:last-child { border-bottom: 0; }
.peer-row.ok strong { color: var(--ok); }
.peer-row.bad strong { color: var(--danger); }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.server-stats { margin-top: 10px; }

.config-card { position: relative; overflow: hidden; }
.config-card::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  background: var(--ok);
}
.config-card.is-off::before { background: var(--danger); opacity: 0.7; }
.config-card .uuid {
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.chip {
  display: block;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.9rem;
}
.chip.muted {
  background: rgba(18, 21, 26, 0.06);
  color: var(--muted);
}
.user-pick-list { max-height: 280px; overflow: auto; margin-top: 8px; }
.list-item.pick-user.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}
.grant-name-wrap { margin-top: 8px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-ico { font-size: 1.6rem; margin-bottom: 8px; }
.empty-mini { color: var(--muted); font-size: 0.88rem; padding: 8px 0; }
.uname .at { opacity: 0.55; }
pre.detail {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.75rem;
  color: var(--muted);
  max-height: 120px;
  overflow: auto;
  margin: 8px 0 0;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.quick {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: start;
  font: inherit;
  color: inherit;
  box-shadow: none;
  cursor: pointer;
}
.quick strong { display: block; font-size: 0.95rem; }
.quick span { display: block; margin-top: 4px; color: var(--muted); font-size: 0.78rem; }
.quick:active { transform: scale(0.98); }

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  align-items: end;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 21, 26, 0.45);
}
.modal-sheet {
  position: relative;
  margin: 0 auto;
  width: min(520px, 100%);
  background: var(--modal-bg);
  border-radius: 24px 24px 0 0;
  padding: 14px 16px calc(24px + var(--safe-bottom));
  box-shadow: 0 -20px 50px rgba(18, 21, 26, 0.2);
  max-height: 88vh;
  overflow: auto;
  color: var(--ink);
}
.modal-handle {
  width: 42px; height: 4px; border-radius: 999px;
  background: rgba(18, 21, 26, 0.15);
  margin: 0 auto 12px;
}
.modal-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  border: 0; background: rgba(18,21,26,0.06);
  width: 34px; height: 34px; border-radius: 10px;
  font: inherit; cursor: pointer;
}
.modal-qr {
  display: block;
  width: min(220px, 70vw);
  margin: 10px auto;
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  border: 1px solid var(--line);
}
.amount-sheet label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
}
.amount-sheet #amount-input {
  width: 100%;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.amount-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.amount-actions .btn { flex: 1; min-width: 120px; }

.acct-real-line {
  margin: 8px 0 4px;
  font-size: 1.02rem;
}
.acct-real {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.acct-user.has-missing {
  border-color: color-mix(in srgb, #c45c26 45%, var(--line));
}
.acct-missing-flag {
  margin: 6px 0 0;
  font-size: 0.82rem;
}
.acct-add-pay {
  margin: 8px 0 14px;
}
.acct-add-pay label.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-weight: 700;
  cursor: pointer;
}
.acct-add-pay label.check-row input {
  width: 18px;
  height: 18px;
}

.toast-host {
  position: fixed;
  inset-inline: 0;
  bottom: calc(88px + var(--safe-bottom));
  z-index: 80;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}
.toast-chip {
  max-width: min(420px, 100%);
  padding: 10px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  color: var(--bg);
  font-size: 0.88rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast-chip.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-links { display: grid; gap: 8px; margin: 12px 0; }
.modal-link-row {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.modal-link-row code {
  font-size: 0.72rem;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.form-error { color: var(--danger); min-height: 1.2em; font-weight: 700; }
.step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.step .dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 99px;
  background: var(--line);
  flex: none;
}
.step.run .dot { background: var(--warn); }
.step.ok .dot { background: var(--ok); }
.step.fail .dot { background: var(--danger); }
.step .meta { display: block; color: var(--muted); font-weight: 600; }

/* ── Topology graph ─────────────────────────────────────────────── */
.topo-card { overflow: hidden; }
.topo-wrap {
  margin: 8px -6px 4px;
  border-radius: 16px;
  background: var(--canvas);
border: 1px solid var(--line);
  overflow: auto;
}
.topo-svg {
  display: block;
  width: 100%;
  min-width: 520px;
  height: auto;
  min-height: 320px;
}
.topo-col {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topo-edge .topo-line {
  fill: none;
  stroke: url(#edgeGrad);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.85;
  pointer-events: none;
}
.topo-edge.soft .topo-line {
  stroke-dasharray: 7 6;
  opacity: 0.55;
}
.topo-edge .topo-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  cursor: pointer;
}
.topo-edge .topo-pulse {
  fill: var(--accent);
  opacity: 0.9;
  pointer-events: none;
  animation: topo-flow 2.4s ease-in-out infinite;
}
.topo-edge.soft .topo-pulse { fill: var(--muted); animation: none; opacity: 0.45; }
.topo-edge.selected .topo-line {
  stroke-width: 3.5;
  opacity: 1;
  filter: drop-shadow(0 0 6px var(--glow-a));
}
@keyframes topo-flow {
  0%, 100% { opacity: 0.35; r: 3; }
  50% { opacity: 1; r: 5; }
}
.topo-edge-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border-radius: 999px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  color: var(--muted);
  font: 700 11px/1 var(--font);
  box-shadow: none;
  pointer-events: none;
  white-space: nowrap;
}
.topo-edge-badge.live {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}
.topo-node { cursor: pointer; }
.topo-node .topo-ring {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
  opacity: 0.7;
}
.topo-node .topo-core {
  fill: var(--card-solid);
  stroke: var(--accent);
  stroke-width: 2.5;
  filter: drop-shadow(0 8px 16px rgba(18, 21, 26, 0.12));
  transition: transform .15s ease;
}
.topo-node.exit .topo-core { stroke: var(--warn); }
.topo-node.bad .topo-core { stroke: var(--danger); }
.topo-node.ok .topo-ring { stroke: var(--ok); opacity: 0.35; }
.topo-node.selected .topo-ring {
  stroke: var(--accent);
  stroke-width: 2;
  opacity: 1;
  animation: topo-ring 1.6s ease-out infinite;
}
.topo-node.selected .topo-core {
  transform: scale(1.06);
}
@keyframes topo-ring {
  0% { r: 40; opacity: 0.7; }
  100% { r: 52; opacity: 0; }
}
.topo-kind {
  fill: var(--accent-ink);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}
.topo-node.exit .topo-kind { fill: var(--warn); }
.topo-label {
  fill: var(--ink);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}
.topo-ip {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
}
.topo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.topo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.topo-legend .lg {
  width: 14px;
  height: 4px;
  border-radius: 99px;
  display: inline-block;
  background: var(--accent);
}
.topo-legend .lg.soft {
  background: var(--line);
}
.topo-legend .lg.live { background: var(--ok); }
.topo-legend .lg.ir { width: 10px; height: 10px; border-radius: 99px; background: var(--accent); }
.topo-legend .lg.eu { width: 10px; height: 10px; border-radius: 99px; background: var(--warn); }
.topo-panel {
  animation: rise .28s ease both;
}
.topo-panel .actions { flex-wrap: wrap; }

@media (max-width: 560px) {
  .topo-svg { min-width: 480px; }
}

/* ── Servers page (visual Iran → XZ) ─────────────────────────────── */
.srv-page {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.srv-head {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--paper);
border: 1px solid var(--line);
  box-shadow: none;
  min-width: 0;
}
.srv-head-text { min-width: 0; }
.srv-flow-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 640px) {
  .srv-flow-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.srv-flow-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  min-width: 0;
  overflow-wrap: anywhere;
  box-shadow: none;
}
.srv-flow-tab.active {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: transparent;
}
.srv-flow-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: none;
  min-width: 0;
}
.srv-flow-panel.hidden { display: none; }
.srv-wizard {
  display: grid;
  gap: 8px;
  margin-bottom: 4px;
}
@media (min-width: 640px) {
  .srv-wizard { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.srv-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
  min-width: 0;
}
.srv-step b {
  width: 22px;
  height: 22px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.75rem;
}
.srv-step span { overflow-wrap: anywhere; }
.srv-job-dock {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  box-shadow: none;
  min-width: 0;
}
.srv-dns-banner {
  margin: 8px 0 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line));
  color: var(--ink);
  overflow-wrap: anywhere;
}
.srv-dns-banner.hidden { display: none; }
.srv-dns-banner strong { display: block; margin-bottom: 4px; }
.srv-dns-banner p { margin: 0; font-size: 0.88rem; line-height: 1.4; }
.srv-dns-banner code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  direction: ltr;
  unicode-bidi: isolate;
}
.srv-kicker {
  margin: 0 0 2px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.srv-head h2 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: clamp(1.15rem, 4.5vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.srv-head .section-hint {
  margin: 0;
  font-size: 0.84rem;
}
.srv-key {
  margin: 8px 0 0;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}
.xz-acct {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-soft) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  display: grid;
  gap: 12px;
  min-width: 0;
}
.xz-acct-top {
  display: grid;
  gap: 10px;
}
@media (min-width: 560px) {
  .xz-acct-top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    align-items: end;
  }
}
.xz-acct-label {
  margin: 0 0 2px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.xz-acct-bal {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
}
.xz-acct-bal span {
  font-size: 0.72em;
  font-weight: 700;
  color: var(--muted);
  margin-inline-start: 4px;
}
.xz-acct-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.xz-acct-stats span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
}
.xz-spend-title {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
}
.xz-spend {
  min-width: 0;
}
.xz-spend-row + .xz-spend-row { margin-top: 8px; }
.xz-spend-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.xz-spend-host {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.xz-spend-amt {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.xz-spend-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.16);
  overflow: hidden;
}
.xz-spend-track > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--paper);
}
.xz-spend-empty,
.xz-acct-miss {
  margin: 8px 0 0;
  font-size: 0.8rem;
}

/* Collapsible sections */
.srv-fold {
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: none;
  overflow: hidden;
  min-width: 0;
}
.srv-fold-sum {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  min-width: 0;
}
.srv-fold-sum::-webkit-details-marker { display: none; }
.srv-fold-sum::marker { content: ""; }
.srv-fold-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
  flex: 1;
}
.srv-fold-title {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.srv-fold-sum .count {
  flex-shrink: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.srv-fold-chev {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  position: relative;
}
.srv-fold-chev::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 8px;
  border-inline-end: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg) translate(-1px, -2px);
  transition: transform 0.18s ease;
}
.srv-fold[open] .srv-fold-chev::before {
  transform: rotate(225deg) translate(-1px, -1px);
}
.srv-fold-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.srv-fold[open] .srv-fold-body { padding-top: 12px; }
.srv-fold[open] .srv-fold-sum {
  background: color-mix(in srgb, var(--accent-soft) 35%, transparent);
}
.srv-actions-top { margin: 0 0 10px; }

.srv-paths {
  display: grid;
  gap: 10px;
}
.srv-path {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
}
.srv-path-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.srv-path .node {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.srv-path .node.end { text-align: end; justify-items: end; }
.srv-path .node .role {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.srv-path .node strong {
  font-size: 0.92rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.srv-path .node span {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: inherit;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.srv-path .arrow {
  display: grid;
  justify-items: center;
  gap: 2px;
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 0.68rem;
  flex-shrink: 0;
}
.srv-path .arrow b {
  font-size: 1.15rem;
  line-height: 1;
  color: var(--accent);
}
.srv-path-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}
.srv-path-metrics .mini {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 2px;
}
.srv-path-metrics .grade-pill {
  grid-column: 1 / -1;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}
.srv-path-metrics .mini span {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.srv-path-metrics .mini b {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.srv-path-metrics .mini b i {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--muted);
  margin-inline-start: 2px;
}
.srv-path-metrics .mini.ok b { color: var(--ok); }
.srv-path-metrics .mini.warn b { color: var(--warn); }
.srv-path-metrics .mini.bad b { color: var(--danger); }
.srv-path-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.srv-path.tone-ok {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
  box-shadow: inset 3px 0 0 var(--ok);
}
.srv-path.tone-warn {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
  box-shadow: inset 3px 0 0 var(--warn);
}
.srv-path.tone-bad {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  box-shadow: inset 3px 0 0 var(--danger);
}
.srv-form-grid {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.srv-form-grid > div { min-width: 0; }
.srv-form-grid select,
.srv-fold-body input,
.srv-fold-body select {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}
@media (min-width: 640px) {
  .srv-form-grid { grid-template-columns: 1fr 1fr; }
  .srv-path-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    align-items: center;
  }
  .srv-path-metrics .grade-pill {
    grid-column: auto;
    width: auto;
  }
}
.probe-reasons {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.probe-busy {
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
#srv-probe-out .row {
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
#srv-probe-out .meta {
  overflow-wrap: anywhere;
  max-width: 100%;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
@media (min-width: 640px) {
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.metric-tile {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  gap: 2px;
  min-width: 0;
}
.metric-tile .k {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
}
.metric-tile .v {
  font-family: var(--display);
  font-size: clamp(1.1rem, 4vw, 1.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric-tile .u {
  font-size: 0.72rem;
  color: var(--muted);
}
.metric-tile.ok .v { color: var(--ok); }
.metric-tile.warn .v { color: var(--warn); }
.metric-tile.bad .v { color: var(--danger); }

.grade-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  text-align: center;
}
.grade-pill.ok { background: var(--ok-soft); color: var(--ok); }
.grade-pill.warn { background: var(--warn-soft); color: var(--warn); }
.grade-pill.bad { background: var(--danger-soft); color: var(--danger); }

.srv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.srv-actions .btn {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}
.srv-card-grid {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.srv-svc {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  align-items: start;
  min-width: 0;
  overflow: hidden;
}
.srv-svc .ava {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent-ink);
  flex-shrink: 0;
}
.srv-svc .body { min-width: 0; display: grid; gap: 4px; }
.srv-svc .body strong {
  font-size: 0.92rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.srv-svc .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip.chip-locs {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.chip-locs-full {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.loc-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
}
.chip-sale,
.chip-sale-badge {
  color: var(--ok, #0a7a3e);
  font-weight: 700;
}
.chip.chip-sale-badge {
  background: var(--ok-soft, #e8f7ee);
  border-color: transparent;
}
.check-row {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 8px 0 12px;
  font-size: 0.92rem;
  width: 100%;
}
.check-row input {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
}

/* Ops panel (More → Ops): clear RTL settings */
.ops-card .ops-lead {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--muted);
  font-weight: 600;
}
.ops-list {
  margin: 0 0 12px;
  padding: 0 1.1rem 0 0;
  list-style: disc;
  font-size: 0.88rem;
  line-height: 1.7;
  font-weight: 650;
  color: var(--text);
}
.ops-status {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2, color-mix(in srgb, var(--text) 6%, transparent));
  line-height: 1.55;
}
.ops-status strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
}
.ops-status p {
  margin: 4px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
}
.ops-status p.tiny,
.ops-card .tiny {
  font-size: 0.78rem;
  font-weight: 600;
}
.ops-status.on {
  background: color-mix(in srgb, var(--ok, #0a7a3e) 14%, transparent);
}
.ops-status.warn {
  background: color-mix(in srgb, #c47a00 16%, transparent);
}
.ops-status.off {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.ops-toggle {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line, color-mix(in srgb, var(--text) 12%, transparent));
  background: var(--card, transparent);
  cursor: pointer;
  box-sizing: border-box;
}
.ops-toggle-text {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
}
.ops-toggle-text strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
  line-height: 1.4;
}
.ops-toggle-text em {
  display: block;
  font-style: normal;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
  font-weight: 600;
}
.ops-toggle input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  margin: 2px 0 0;
  accent-color: var(--accent, #0d9488);
}
.ops-field-label {
  display: block;
  margin: 8px 0 6px;
  font-size: 0.88rem;
  font-weight: 700;
}
.ops-hours {
  width: 100%;
  max-width: 8rem;
  margin-bottom: 4px;
}
.ops-svc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, color-mix(in srgb, var(--text) 10%, transparent));
}
.ops-svc-row:last-of-type {
  border-bottom: none;
}
.ops-svc-row strong {
  font-size: 0.95rem;
}
.ops-danger-zone {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line, color-mix(in srgb, var(--text) 14%, transparent));
  display: grid;
  gap: 8px;
}
.ops-hr {
  margin: 16px 0;
  border: none;
  border-top: 1px solid var(--line, color-mix(in srgb, var(--text) 12%, transparent));
}
.ops-card .h-sub {
  margin: 0 0 8px;
  font-size: 1rem;
}
.ops-card select.ops-hours {
  width: 100%;
  max-width: 14rem;
  margin-bottom: 8px;
}
.chip.live { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.dead { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.srv-svc .btns {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.srv-svc .btns .btn {
  flex: 1 1 auto;
  min-width: min(100%, 7.5rem);
  white-space: normal;
  line-height: 1.25;
  text-align: center;
}
.probe-result-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  min-width: 0;
}
.probe-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  min-width: 0;
  overflow: hidden;
}
.probe-row .top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.probe-row .top strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}
.section-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
#srv-out {
  min-height: 2.5em;
  margin-top: 10px;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 560px) {
  .srv-path-main {
    grid-template-columns: 1fr;
    gap: 6px;
    text-align: start;
  }
  .srv-path .node.end {
    text-align: start;
    justify-items: start;
  }
  .srv-path .arrow {
    justify-items: start;
    grid-auto-flow: column;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
  }
  .srv-path .arrow b {
    transform: rotate(90deg);
  }
  .srv-fold-sum { padding: 12px 14px; }
  .srv-fold-body { padding: 0 14px 14px; }
  .srv-svc {
    grid-template-columns: 1fr;
  }
  .srv-svc .ava { display: none; }
}
.flow-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.flow-steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface-soft);
  font-size: 0.86rem;
}
.flow-steps .dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 99px;
  background: var(--muted);
}
.flow-steps li.run .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.flow-steps li.ok .dot { background: var(--ok); }
.flow-steps li.fail .dot { background: var(--danger); }

/* ── Ops redesign: guide / wizard / busy / log ─────────────────────── */
.guide-steps {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.guide-steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.guide-num {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-size: 0.85rem;
}
.field-tip {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-soft, rgba(127,127,127,.1));
  color: var(--muted, #7a8699);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
}
.field-tip.warn {
  background: color-mix(in srgb, #f0b429 16%, transparent);
  color: #9a6b00;
}
[data-theme="dark"] .field-tip.warn { color: #f0c14a; }

.wiz { padding: 16px 16px 18px; }
.wiz-head { margin-bottom: 12px; }
.wiz-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
.wiz-head h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
}
.wiz-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.5;
}
.wiz-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
}
.wiz-progress {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
}
.wiz-progress > i {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text) 12%, transparent);
}
.wiz-progress > i.on { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.wiz-progress > i.now { background: var(--accent); }
.wiz-pane { margin-bottom: 8px; }
.wiz-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.wiz-nav .btn { flex: 1 1 auto; min-width: 96px; }
.wiz-ok {
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--ok, #22c55e) 16%, transparent);
  margin-bottom: 10px;
}
.wiz-ok strong { display: block; margin-bottom: 4px; }
.wiz-ok p { margin: 0; font-size: 0.88rem; font-weight: 600; }
.wiz-result { margin-top: 12px; }

.choice-row {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}
@media (min-width: 520px) {
  .choice-row { grid-template-columns: 1fr 1fr; }
}
.choice {
  text-align: start;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  background: var(--surface-soft, transparent);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.choice strong { display: block; font-size: 0.95rem; margin-bottom: 4px; }
.choice span { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.choice.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.check-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
  font-size: 0.9rem;
  font-weight: 650;
}
.check-line input { margin-top: 3px; }
.check-line em { font-style: normal; color: var(--muted); font-weight: 600; }

.flow-explain {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.45;
}
.flow-explain:empty { display: none; }

/* Inline (non-blocking) busy chip next to the action */
.inline-busy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}
.inline-busy.page-busy {
  margin: 0 0 12px;
  width: fit-content;
}
.warn-text {
  color: #c45c26;
  font-size: 0.88rem;
  font-weight: 700;
  margin: 8px 0 0;
}
.h-sub {
  margin: 16px 0 8px;
  font-size: 0.95rem;
  font-weight: 800;
}
.acct-summary .stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.acct-kpi {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 8px !important;
  margin-top: 10px;
}
@media (min-width: 768px) {
  .acct-kpi {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
  }
}
.acct-kpi .stat {
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--paper);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 70px;
  box-sizing: border-box;
}
.acct-kpi .stat b {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.acct-kpi .stat span.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  line-height: 1.3;
}
.acct-kpi .stat span.stat-meta {
  font-size: 10.5px;
  color: var(--ink-4);
  margin-top: 2px;
  display: block;
  line-height: 1.25;
}
.acct-kpi .stat.accent {
  border-left: 3px solid var(--ink);
}
.acct-kpi .stat.warn {
  border-left: 3px solid var(--signal);
}
.acct-charts { margin-top: 10px; }
.acct-chart-grid {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}
.acct-chart-block {
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-xs);
  background: var(--paper);
  border: 1px solid var(--line);
  margin-top: 10px;
}
.acct-chart-block .h-sub { margin-top: 0; }
.acct-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 130px;
  margin-top: 10px;
  padding: 8px 6px 4px;
  background: var(--canvas);
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  box-sizing: border-box;
  overflow-x: auto;
  scrollbar-width: thin;
}
.acct-bar {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  min-width: 5px;
  max-width: 28px;
}
.acct-bar > i {
  display: block;
  width: 100%;
  border-radius: 2px 2px 0 0;
  background: var(--ink);
  min-height: 2px;
  transition: opacity 0.15s ease;
}
.acct-bar:hover > i {
  opacity: 0.75;
}
.acct-bar > span {
  font-size: 9px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  writing-mode: horizontal-tb;
  transform: none;
  height: 14px;
  width: 100%;
  text-align: center;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}
.acct-bar.dual { justify-content: flex-end; }
.acct-bar-stack {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  border-radius: 2px 2px 0 0;
  overflow: hidden;
  min-height: 4px;
  align-self: stretch;
}
.acct-bar-stack > i { display: block; width: 100%; min-height: 0; flex: 0 0 auto; }
.acct-bar-stack > i.is-first { background: var(--ink); }
.acct-bar-stack > i.is-renewal { background: var(--ink-3); }
.acct-legend {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.acct-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-inline-end: 4px;
  vertical-align: middle;
}
.acct-legend .dot.first { background: var(--ink); }
.acct-legend .dot.renew { background: var(--ink-3); }
.acct-legend .dot.first { background: #0f766e; }
.acct-legend .dot.renew { background: #c2410c; }
.acct-dt-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.acct-dt-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}
.jdt {
  position: relative;
  min-width: 0;
}
.jdt-trigger {
  appearance: none;
  width: 100%;
  text-align: start;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.jdt-trigger::after {
  content: "▾";
  float: inline-end;
  color: var(--muted);
  font-size: 0.8rem;
}
/* Full-screen modal — escapes card backdrop-filter stacking contexts */
.jdt-modal {
  z-index: 100;
}
.jdt-modal .jdt-sheet {
  max-height: min(78vh, 560px);
  padding-bottom: calc(18px + var(--safe-bottom));
}
.jdt-sheet-body {
  display: grid;
  gap: 4px;
}
.jdt-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.jdt-nav strong {
  font-size: 0.92rem;
  font-weight: 800;
}
.jdt-nav-btn {
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  cursor: pointer;
}
.jdt-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}
.jdt-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.jdt-day {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
  height: 36px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.jdt-day.empty { cursor: default; visibility: hidden; }
.jdt-day.is-selected {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
}
.jdt-day:not(.empty):not(.is-selected):active {
  background: var(--surface-soft);
}
.jdt-time {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}
.jdt-time label {
  display: grid;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  flex: 1;
}
.jdt-time select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  font: inherit;
  font-weight: 700;
  background: var(--surface);
  color: var(--ink);
}
.jdt-time > span {
  font-weight: 800;
  padding-bottom: 10px;
}
.jdt-actions {
  display: flex;
  gap: 8px;
  justify-content: stretch;
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 10px;
  padding-bottom: 8px;
  background: var(--card);
}
.jdt-actions .btn { flex: 1; }
.acct-add-pay .jdt { margin-bottom: 4px; }
.acct-user {
  width: 100%;
  text-align: start;
  cursor: pointer;
}
.row.compact {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.row.compact:last-child { border-bottom: none; }
.inline-busy .spinner {
  width: 16px;
  height: 16px;
  margin: 0;
  border-width: 2px;
}
.inline-busy .t {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--accent);
  font-weight: 800;
}
.btn.is-busy,
.choice.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

.ops-log-dock {
  margin-top: 16px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  background: var(--card, var(--secondary, #151d27));
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}
.ops-log-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.ops-log-kicker {
  margin: 0 0 2px;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
.ops-log-head h3 { margin: 0; font-size: 1.05rem; }
.ops-log-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.ops-log-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-soft, rgba(127,127,127,.08));
  border-inline-start: 3px solid var(--muted);
}
.ops-log-item.ok { border-inline-start-color: var(--ok, #22c55e); }
.ops-log-item.fail { border-inline-start-color: var(--danger, #ef4444); }
.ops-log-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.ops-log-top strong { font-size: 0.9rem; }
.ops-log-top time { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ops-log-item p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  word-break: break-word;
}
.ops-log-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── User Detail Table & Copy Chips ── */
.user-hero-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.user-ava-large {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.copy-pill-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  margin-inline-start: 8px;
  vertical-align: middle;
}
.copy-pill-btn:active {
  transform: scale(0.95);
  background: var(--accent-soft);
}
.btn-copy-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  margin-inline-start: 6px;
  transition: all .15s ease;
}
.btn-copy-chip:hover {
  color: var(--ink);
  background: var(--surface);
}
.btn-copy-chip:active {
  transform: scale(0.95);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.icon-copy-inline {
  appearance: none;
  background: transparent;
  border: 0;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 4px;
  vertical-align: middle;
  opacity: 0.7;
}
.icon-copy-inline:active {
  transform: scale(1.2);
  opacity: 1;
}
.person-copy-btn {
  font-size: 0.82rem;
  opacity: 0.6;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 6px;
}
.person-copy-btn:hover {
  opacity: 1;
  background: var(--surface);
}
.user-info-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  margin: 8px 0 12px;
}
.user-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}
.user-info-table tr {
  border-bottom: 1px solid var(--line);
}
.user-info-table tr:last-child {
  border-bottom: 0;
}
.user-info-table td {
  padding: 9px 12px;
  vertical-align: middle;
}
.user-info-table td.info-k {
  width: 32%;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--surface);
  white-space: nowrap;
}
.user-info-table td.info-v {
  width: 68%;
  color: var(--ink);
  font-weight: 600;
  word-break: break-word;
}
.empty-state-mini {
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  margin: 6px 0 12px;
}
.h-sub {
  margin: 14px 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Modern Table-based Dashboard & Cohort Monitoring ───────────── */
.home-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 10px 0 8px;
  background: var(--surface-soft);
  box-sizing: border-box;
}

.home-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
  text-align: left;
}

.home-table th,
.home-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.home-table th {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.home-table tr:last-child td {
  border-bottom: none;
}

.home-table tr:hover td {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.ops-summary-card {
  margin-top: 10px;
}

.ops-matrix-tbl th {
  font-size: 0.7rem;
}

.ops-matrix-tbl td {
  font-size: 0.79rem;
}

.ops-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ops-pill-btn {
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.76rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ops-pill-btn:hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: var(--accent);
}

.ops-pill-btn.warn {
  border-color: color-mix(in srgb, var(--warn) 60%, var(--line));
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
}

.ops-pill-btn.warn:hover {
  background: color-mix(in srgb, var(--warn) 18%, var(--surface));
}

/* ── Cohort Monitoring Tabs & Cards ─────────────────────────────── */
.cohort-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.cohort-tabs::-webkit-scrollbar {
  display: none;
}

.cohort-tab-btn {
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.2, 0, 0, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  flex-shrink: 0;
}

.cohort-tab-btn:hover {
  color: var(--text);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.cohort-tab-btn.active {
  background: var(--accent);
  color: #0b0f19;
  border-color: var(--accent);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent);
  transform: translateY(-1px);
}

[data-theme="light"] .cohort-tab-btn.active {
  color: #ffffff;
}

.cohort-tab-count {
  padding: 1px 7px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: inherit;
}

.cohort-tab-btn.active .cohort-tab-count {
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
}

[data-theme="light"] .cohort-tab-btn.active .cohort-tab-count {
  background: rgba(255, 255, 255, 0.28);
}

/* ── Interactive User Table Cells ───────────────────────────────── */
.table-user-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
}

.table-user-cell:hover .user-name {
  color: var(--accent);
}

.user-cell-ava {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.74rem;
  flex-shrink: 0;
}

.user-cell-ava.live {
  box-shadow: 0 0 0 2px var(--ok);
}

.user-cell-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.user-cell-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.79rem;
}

.table-copy-btn {
  background: transparent;
  border: none;
  padding: 0 3px;
  font-size: 0.72rem;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s, transform 0.15s;
}

.table-copy-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.tbl-usage-bar {
  width: 54px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  margin-top: 3px;
}

.tbl-usage-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
}

.bar-ok { background: #10b981; }
.bar-warn { background: #f59e0b; }
.bar-danger { background: #ef4444; }

.text-accent { color: var(--accent) !important; }
.text-ok { color: var(--ok) !important; }
.text-warn { color: var(--warn) !important; }
.text-danger { color: #ef4444 !important; }

/* ── Search Input Wrappers with Clear (✕) ───────────────────────── */
.search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-input-wrap input {
  width: 100%;
  padding-right: 32px !important;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  line-height: 1;
}

.search-clear-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 35%, transparent);
  margin-right: 3px;
  vertical-align: middle;
}

/* ── Copy Micro-Interactions & Inline Visual Confirmation ───────── */
.person-copy-btn,
.table-copy-btn,
.copy-pill-btn,
.btn-copy-chip,
.icon-copy-inline {
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.copy-pill-btn.copied,
.btn-copy-chip.copied,
.table-copy-btn.copied,
.person-copy-btn.copied,
.icon-copy-inline.copied {
  background: var(--ok-soft) !important;
  color: var(--ok) !important;
  border-color: color-mix(in srgb, var(--ok) 40%, transparent) !important;
  transform: scale(1.05);
}

/* ── Scrollbars & Focus Indicators ──────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--line-strong);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Polish Bento & Stat Card Accents ───────────────────────────── */
.stat.tap:hover {
  border-color: var(--line-strong);
  background: var(--card-solid);
}

/* ── AGY Channel AI Automation ───────────────────────────────────── */
.agy-hero-card {
  background: var(--paper);
border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.agy-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.agy-badge-pending {
  background: color-mix(in srgb, #f59e0b 15%, transparent);
  color: #d97706;
  border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
}
.agy-badge-published {
  background: color-mix(in srgb, #10b981 15%, transparent);
  color: #059669;
  border: 1px solid color-mix(in srgb, #10b981 35%, transparent);
}
.agy-badge-rejected {
  background: color-mix(in srgb, #6b7280 15%, transparent);
  color: #4b5563;
  border: 1px solid color-mix(in srgb, #6b7280 30%, transparent);
}
.agy-post-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  direction: rtl !important;
  text-align: right !important;
  border-right: 4px solid var(--accent);
  border-left: none !important;
}
.agy-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  direction: rtl !important;
}
.agy-post-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
  direction: rtl !important;
  text-align: right !important;
  font-family: system-ui, -apple-system, "Vazirmatn", "IRANSans", "Segoe UI", Tahoma, sans-serif !important;
  line-height: 1.55;
}
.agy-post-text {
  white-space: pre-wrap;
  font-family: system-ui, -apple-system, "Vazirmatn", "IRANSans", "Segoe UI", Tahoma, sans-serif !important;
  line-height: 1.85;
  font-size: 0.98rem;
  color: var(--fg);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  direction: rtl !important;
  text-align: right !important;
  word-break: break-word;
}
.agy-post-text b,
.agy-post-text strong {
  color: var(--accent);
  font-weight: 700;
}
.agy-post-text a {
  color: var(--btn);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.agy-post-box {
  background: color-mix(in srgb, var(--card, #1e293b) 80%, var(--bg, #0f172a));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agy-post-box.channel-box {
  border-right: 4px solid #3b82f6;
}
.agy-post-box.bot-box {
  border-right: 4px solid #10b981;
}
.agy-post-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.agy-post-box-title {
  font-weight: 700;
  font-size: 0.92rem;
  margin: 0;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 6px;
}
.agy-post-box-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.agy-edit-textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Vazirmatn", "IRANSans", "Segoe UI", Tahoma, sans-serif !important;
  font-size: 0.98rem;
  line-height: 1.8;
  direction: rtl !important;
  text-align: right !important;
  resize: vertical;
}
.agy-post-img-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}
.agy-post-img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
}
.agy-post-img-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  right: auto;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
}
.agy-post-sources {
  font-size: 0.82rem;
  color: var(--muted);
  direction: rtl !important;
  text-align: right !important;
}
.agy-post-sources code {
  direction: ltr;
  display: inline-block;
}
.agy-post-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  direction: rtl !important;
}
.agy-channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  gap: 10px;
}
.agy-channel-name {
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.95rem;
}
.agy-progress-box {
  padding: 16px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  display: flex;
  align-items: center;
  gap: 12px;
}
.agy-pulse-ring {
  width: 20px;
  height: 20px;
  border: 3px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.agy-preview-post-card {
  padding: 14px;
  border-radius: 8px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  direction: rtl !important;
  text-align: right !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agy-preview-post-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  direction: rtl !important;
}
.agy-preview-post-text {
  font-size: 0.95rem;
  line-height: 1.8;
  white-space: pre-wrap;
  font-family: system-ui, -apple-system, "Vazirmatn", "IRANSans", "Segoe UI", Tahoma, sans-serif !important;
  direction: rtl !important;
  text-align: right !important;
}

/* ── AGY Modern Dual-Tab Navigation & Chat Refinement ─────────────── */
.agy-master-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
  direction: rtl;
}
@media (max-width: 580px) {
  .agy-master-nav {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
.agy-master-tab {
  background: var(--card-solid);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: right;
  color: var(--fg);
}
.agy-master-tab:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.agy-master-tab.active {
  background: color-mix(in srgb, var(--accent) 12%, var(--card-solid));
  border-color: var(--accent);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 20%, transparent);
}
.agy-master-tab.tab-channel.active {
  background: color-mix(in srgb, #3b82f6 14%, var(--card-solid));
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.22);
}
.agy-master-tab.tab-bot.active {
  background: color-mix(in srgb, #10b981 14%, var(--card-solid));
  border-color: #10b981;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.22);
}
.agy-tab-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.agy-tab-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.agy-tab-meta strong {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--fg);
}
.agy-tab-meta small {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.agy-tab-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  color: var(--fg);
  white-space: nowrap;
}
.agy-master-tab.active .agy-tab-pill {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.agy-master-tab.tab-channel.active .agy-tab-pill {
  background: #3b82f6;
}
.agy-master-tab.tab-bot.active .agy-tab-pill {
  background: #10b981;
}

/* Post Cards */
.agy-card-channel {
  border-right: 5px solid #3b82f6 !important;
}
.agy-card-bot {
  border-right: 5px solid #10b981 !important;
}

/* Telegram Preview Bubble */
.agy-bubble {
  background: color-mix(in srgb, var(--card, #1e293b) 92%, #000);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  direction: rtl;
  text-align: right;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.agy-bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.agy-bubble-tag {
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.agy-bubble-body {
  white-space: pre-wrap;
  line-height: 1.85;
  font-size: 0.96rem;
  font-family: system-ui, -apple-system, "Vazirmatn", "IRANSans", "Segoe UI", sans-serif;
  color: var(--fg);
  word-break: break-word;
}
.agy-bubble-body b, .agy-bubble-body strong {
  color: #38bdf8;
  font-weight: 700;
}
.agy-bubble-body a {
  color: #3b82f6;
  text-decoration: underline;
}

/* Rejection and Learning Banners */
.agy-rejection-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  direction: rtl;
}
.agy-refinement-badge {
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #c084fc;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
  direction: rtl;
}

/* Quick prompt chips */
.agy-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  direction: rtl;
}
.agy-chip {
  background: var(--card-solid);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.agy-chip:hover {
  background: var(--line);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.agy-chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Modern AI Refine Drawer / Modal */
.agy-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.agy-dialog {
  background: var(--paper, #1e293b);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
  direction: rtl;
  text-align: right;
  animation: agyModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes agyModalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.agy-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.agy-dialog-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─────────────────────────────────────────────────────────────
   Home Redesign & Operations Telemetry Enhancements
   ───────────────────────────────────────────────────────────── */
.fleet-hero-card {
  padding: 16px;
}
.hero-traffic-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 12px 0 8px;
}
.hero-traffic-item {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hero-traffic-item.highlight {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.hero-traffic-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}
.hero-traffic-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.hero-traffic-item.highlight .hero-traffic-val {
  color: var(--accent);
}

/* Telemetry Grid (No horizontal scroll!) */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.telemetry-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.telemetry-card:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  transform: translateY(-1px);
}
.telemetry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.telemetry-icon {
  font-size: 1.1rem;
}
.telemetry-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.telemetry-main-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.telemetry-sub-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.telemetry-pill {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--line) 40%, transparent);
  color: var(--muted);
  font-family: var(--font-mono, monospace);
  font-weight: 600;
}
.telemetry-pill.ok {
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  color: var(--ok);
}
.telemetry-pill.warn {
  background: color-mix(in srgb, var(--warn) 15%, transparent);
  color: var(--warn);
}

/* Active Cohort List & Cards */
.cohort-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  transition: opacity 0.18s ease;
}

.cohort-item-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  user-select: none;
}

.cohort-item-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  box-shadow: 0 4px 14px color-mix(in srgb, #000 15%, transparent);
}

.cohort-item-card:active {
  transform: scale(0.995);
}

.cohort-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cohort-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.user-ava-small {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.cohort-names {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cohort-uname {
  font-size: 0.88rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cohort-meta-line {
  font-size: 0.73rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cohort-meta-line code {
  font-family: var(--font-mono, monospace);
  font-size: 0.73rem;
}

.cohort-status-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  text-align: right;
}

.cohort-status-time {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.cohort-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-soft);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
}

.cohort-usage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cohort-usage-numbers {
  font-size: 0.78rem;
}

.cohort-pct {
  font-size: 0.82rem;
}

.cohort-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.74rem;
}

.cohort-foot-meta {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.73rem;
}

.cohort-inspect-action {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.cohort-item-card:hover .cohort-inspect-action .arrow {
  transform: translateX(3px);
}

/* User Details: Payments History */
.user-payments-history-card {
  margin-top: 14px;
}
.user-pay-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.user-pay-item {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.user-pay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.user-pay-amounts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
}
.user-pay-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
  padding-top: 6px;
  margin-top: 2px;
}

/* Accounting Screen Enhancements */
.acct-executive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
@media (min-width: 768px) {
  .acct-executive-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}
.acct-executive-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.acct-executive-card.primary {
  border-color: var(--line-strong);
  background: var(--sunken);
}
.acct-executive-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.acct-executive-val {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.acct-executive-card.primary .acct-executive-val {
  color: var(--ink);
}
.acct-executive-sub {
  font-size: 11px;
  color: var(--ink-3);
}
.acct-search-box {
  margin: 12px 0 10px;
  position: relative;
}
.acct-search-box input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.82rem;
  box-sizing: border-box;
}
.acct-search-box input:focus {
  border-color: var(--accent);
  outline: none;
}

/* Payments Ledger & Filters */
.pay-filter-card {
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pay-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pay-search-wrap input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.82rem;
  box-sizing: border-box;
}
.pay-search-wrap input:focus {
  border-color: var(--accent);
  outline: none;
}
.pay-search-wrap button {
  position: absolute;
  right: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
}
.pay-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .pay-filter-row {
    grid-template-columns: 1fr;
  }
}
.pay-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pay-filter-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}
.pay-filter-group select {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.8rem;
}
.pay-stats-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
  font-size: 0.76rem;
  color: var(--muted);
}
.pay-ledger-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pay-ledger-item {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pay-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.pay-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.pay-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.pay-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pay-item-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--surface-soft);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.pay-amount-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.pay-amount-label {
  font-size: 0.74rem;
  color: var(--muted);
}
.pay-amount-val {
  font-size: 1.1rem;
  font-weight: 700;
}
.pay-meta-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pay-note-line {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}
.pay-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── X-Zone Badges in Shell Chrome ─────────────────────────────── */
.rail-xz-card {
  transition: background 120ms ease, border-color 120ms ease;
}
.rail-xz-card:hover {
  background: var(--paper) !important;
  border-color: var(--line-strong) !important;
}
#topbar-xz-btn {
  transition: background 120ms ease, border-color 120ms ease;
}
#topbar-xz-btn:hover {
  background: var(--sunken) !important;
  border-color: var(--line-strong) !important;
}

/* ── Live Telemetry & Polling Indicators ────────────────────────── */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: live-pulse 2s infinite cubic-bezier(0.66, 0, 0, 1);
  vertical-align: middle;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ── Unified Fleet & Quick Provisioning ────────────────────────── */
.fleet-node-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.fleet-node-card:hover {
  border-color: var(--line-strong);
}
.fleet-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.fleet-node-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}
.fleet-node-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted);
}
.fleet-node-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.quick-loc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.quick-loc-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--paper);
  cursor: pointer;
  text-align: center;
  transition: all 120ms ease;
}
.quick-loc-item:hover {
  border-color: var(--ink);
  background: var(--sunken);
}
.quick-loc-item.selected {
  border-color: var(--ink);
  background: var(--sunken);
  box-shadow: 0 0 0 1.5px var(--ink);
}
.quick-purpose-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.quick-purpose-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--paper);
  cursor: pointer;
  transition: all 120ms ease;
}
.quick-purpose-card:hover {
  border-color: var(--ink);
}
.quick-purpose-card.selected {
  border-color: var(--ink);
  background: var(--sunken);
  box-shadow: 0 0 0 1.5px var(--ink);
}

/* ── Ultra-Simple 2-Server Fleet Controller ── */
.srv-simple-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}
.srv-simple-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.srv-simple-card.highlight {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, var(--paper) 0%, var(--sunken) 100%);
}
.srv-simple-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.srv-simple-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.srv-simple-title .flag-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.srv-simple-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.srv-simple-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.route-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.srv-banner-notice {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── AI CRM & Retention Engine Styles ── */
.ai-crm-card {
  border-color: color-mix(in srgb, #8b5cf6 30%, var(--line));
  background: radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.06), transparent 50%), var(--card-solid);
}
.ai-crm-thread-card {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-crm-thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}
.ai-crm-thread-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ai-crm-diagnosis {
  font-size: 0.84rem;
  background: rgba(139, 92, 246, 0.08);
  border-right: 3px solid #8b5cf6;
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--fg);
  line-height: 1.5;
}
.ai-crm-discount-pill {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  font-weight: 700;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.ai-crm-chat-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.ai-crm-bubble {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 0.88rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.ai-crm-bubble.assistant {
  align-self: flex-start;
  background: color-mix(in srgb, #8b5cf6 12%, var(--card-solid));
  border: 1px solid color-mix(in srgb, #8b5cf6 30%, transparent);
  border-bottom-right-radius: 2px;
}
.ai-crm-bubble.user {
  align-self: flex-end;
  background: color-mix(in srgb, #10b981 14%, var(--card-solid));
  border: 1px solid color-mix(in srgb, #10b981 35%, transparent);
  border-bottom-left-radius: 2px;
}
.ai-crm-bubble-author {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.76rem;
  font-weight: 600;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 3px;
}
.ai-crm-bubble.assistant .ai-crm-bubble-author {
  color: #a78bfa;
}
.ai-crm-bubble.user .ai-crm-bubble-author {
  color: #34d399;
}
.ai-crm-bubble-text {
  word-break: break-word;
  white-space: pre-wrap;
}
.ai-crm-compose-box {
  background: var(--sunken);
  border: 1px solid color-mix(in srgb, #8b5cf6 35%, var(--line));
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-crm-candidate-item {
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.ai-crm-candidate-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}






