/* ==========================================================================
   Growable Communications — Central Super Admin
   Shared design system. One file, imported by every page.
   ========================================================================== */

:root {
  /* Surface */
  --bg: #0F1417;
  --panel: #161C20;
  --panel-2: #1C2327;
  --panel-raised: #212A2F;
  --border: #262F34;
  --border-soft: #1D262B;

  /* Text */
  --text: #E8EBED;
  --text-dim: #9AA5AB;
  --text-faint: #62707730;
  --text-mute: #5C6A70;

  /* Signal colors — status only, never decorative */
  --ok: #3DD68C;
  --ok-dim: #3DD68C1A;
  --warn: #F2B84B;
  --warn-dim: #F2B84B1A;
  --crit: #E5484D;
  --crit-dim: #E5484D1A;
  --info: #4B9CF2;
  --info-dim: #4B9CF21A;

  /* Accent — used sparingly for active/interactive states */
  --accent: #4B9CF2;
  --accent-dim: #4B9CF21A;

  /* Type */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Scale */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;

  --sidebar-w: 236px;
  --topbar-h: 56px;
  --statusbar-h: 40px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

/* Focus visibility — never remove */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   App shell
   ========================================================================== */

html, body { height: 100%; overflow: hidden; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--statusbar-h) var(--topbar-h) 1fr;
  grid-template-areas:
    "status status"
    "side   top"
    "side   main";
  height: 100vh;
  overflow: hidden;
}

/* ---- Status strip (signature element) ---- */
.status-strip {
  grid-area: status;
  background: #0A0D0F;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  overflow-x: auto;
  white-space: nowrap;
  z-index: 20;
}

.status-strip .item { display: flex; align-items: center; gap: 6px; }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px transparent;
}
.dot.ok   { background: var(--ok);   box-shadow: 0 0 0 3px var(--ok-dim); animation: pulse 2s ease-in-out infinite; }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-dim); animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

.status-strip .label { color: var(--text-mute); }
.status-strip .val { color: var(--text); }
.status-strip .sep { color: var(--border); }
.status-strip .live-tag {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  color: var(--ok); font-size: 10.5px; letter-spacing: .06em;
  flex-shrink: 0;
}
.status-strip .live-tag .dot { animation: pulse 1.6s ease-in-out infinite; }

/* ---- Sidebar ---- */
.sidebar {
  grid-area: side;
  background: var(--panel);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 6px 0 12px;
  overflow-y: auto;
  height: 100%;
}

.brand {
  display: flex; align-items: center;
  padding: 10px 16px 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}
.brand img.logo {
  width: 100%;
  height: auto;
  max-height: 34px;
  object-fit: contain;
  object-position: left center;
  display: block;
  mix-blend-mode: screen;
}

.nav-group { padding: 14px 12px 4px; }
.nav-group .heading {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-mute); padding: 0 8px 8px; font-weight: 600;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px; font-weight: 500;
  margin-bottom: 1px;
  transition: background .12s, color .12s;
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.nav-item:hover { background: var(--panel-raised); color: var(--text); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.nav-item.active svg { opacity: 1; }
.nav-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-mute);
  background: var(--panel-raised);
  padding: 1px 6px;
  border-radius: 20px;
}
.nav-item.active .count { color: var(--accent); }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px 4px;
  border-top: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px;
  transition: opacity .12s;
}
.sidebar-footer:hover { opacity: 0.85; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--panel-raised);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  font-family: var(--font-mono);
}
.sidebar-footer .who { display: flex; flex-direction: column; }
.sidebar-footer .who .n { font-size: 12.5px; font-weight: 500; }
.sidebar-footer .who .r { font-size: 10.5px; color: var(--text-mute); }

/* ---- Topbar ---- */
.topbar {
  grid-area: top;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  z-index: 15;
}
.topbar .crumb { font-size: 13px; color: var(--text-dim); }
.topbar .crumb strong { color: var(--text); font-weight: 600; }
.topbar .actions { display: flex; align-items: center; gap: 10px; }

.env-switch {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

/* ---- Notification bell ---- */
.notif-btn {
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.notif-btn:hover { background: var(--panel-raised); color: var(--text); }
.notif-btn svg { width: 16px; height: 16px; }
.notif-btn .badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 20px;
  background: var(--crit);
  color: #fff;
  font-size: 9.5px; font-weight: 700;
  font-family: var(--font-mono);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}

/* ---- Topbar profile chip ---- */
.topbar-profile {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  transition: background .12s;
}
.topbar-profile:hover { background: var(--panel-raised); }
.topbar-profile .avatar { width: 26px; height: 26px; font-size: 10px; }
.topbar-profile .tp-name { font-size: 12px; color: var(--text); font-weight: 500; }
.topbar-profile svg { width: 13px; height: 13px; color: var(--text-mute); }

.btn {
  font-size: 12.5px; font-weight: 500;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-raised); border-color: #33403a; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0A0D0F; font-weight: 600; }
.btn.primary:hover { background: #64ADF5; }

/* ---- Main content ---- */
.main {
  grid-area: main;
  padding: 24px;
  overflow-y: auto;
  height: 100%;
}

.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.page-head p { font-size: 12.5px; color: var(--text-mute); margin-top: 3px; }

/* ==========================================================================
   Components
   ========================================================================== */

/* ---- Metric cards ---- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.metric-card .m-label {
  font-size: 11px; color: var(--text-mute);
  letter-spacing: .03em;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.metric-card .m-value {
  font-family: var(--font-mono);
  font-size: 24px; font-weight: 600;
  letter-spacing: -0.01em;
}
.metric-card .m-value .unit { font-size: 13px; color: var(--text-mute); font-weight: 500; margin-left: 3px; }
.metric-card .m-delta {
  font-size: 11px; margin-top: 6px;
  font-family: var(--font-mono);
  display: flex; align-items: center; gap: 4px;
}
.m-delta.up { color: var(--ok); }
.m-delta.down { color: var(--crit); }
.m-delta.flat { color: var(--text-mute); }

/* ---- Panels ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.panel-head h2 { font-size: 13.5px; font-weight: 600; }
.panel-head .hint { font-size: 11.5px; color: var(--text-mute); }
.panel-body { padding: 4px 0; }
.panel-body.pad { padding: 16px 18px; }

.two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

/* ---- Tables ---- */
.data-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 600;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  white-space: nowrap;
}
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: var(--panel-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.data-table td input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- Status pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  font-family: var(--font-mono);
  letter-spacing: .01em;
}
.pill.ok   { background: var(--ok-dim);   color: var(--ok); }
.pill.warn { background: var(--warn-dim); color: var(--warn); }
.pill.crit { background: var(--crit-dim); color: var(--crit); }
.pill.info { background: var(--info-dim); color: var(--info); }
.pill.mute { background: var(--panel-raised); color: var(--text-mute); }
.pill .dot { width: 5px; height: 5px; box-shadow: none; }

/* ---- Bars (utilization) ---- */
.bar-track {
  height: 5px; border-radius: 4px;
  background: var(--panel-raised);
  overflow: hidden;
  width: 100%;
}
.bar-fill { height: 100%; border-radius: 4px; }
.bar-fill.ok { background: var(--ok); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.crit { background: var(--crit); }

/* ---- Toolbar with inline filters ---- */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.search-box {
  flex: 1; max-width: 280px;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-mute);
}
.search-box svg { width: 14px; height: 14px; flex-shrink: 0; }
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 12.5px; width: 100%;
  font-family: var(--font-ui);
}
.search-box input::placeholder { color: var(--text-mute); }

.filter-chip {
  font-size: 11.5px; color: var(--text-dim);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 6px;
}

/* ---- Empty state ---- */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-mute);
}
.empty-state .icon {
  width: 36px; height: 36px; margin: 0 auto 12px;
  opacity: .5;
}
.empty-state .t { font-size: 13.5px; color: var(--text-dim); font-weight: 500; margin-bottom: 4px; }
.empty-state .d { font-size: 12px; }

/* ---- Forms ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 18px;
}
.form-grid.single { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: span 2; }
.field label {
  font-size: 12px; font-weight: 600; color: var(--text-dim);
}
.field .req { color: var(--crit); margin-left: 2px; }
.field .hint-text { font-size: 11px; color: var(--text-mute); }
.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field input[type="password"],
.field select,
.field textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color .12s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-mute); }
.field textarea { resize: vertical; min-height: 76px; font-family: var(--font-ui); }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239AA5AB' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.field .mono-input { font-family: var(--font-mono); }
.mono-input { font-family: var(--font-mono); }

.radio-row, .check-row { display: flex; gap: 18px; }
.radio-opt, .check-opt {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-dim);
}
.radio-opt input, .check-opt input { accent-color: var(--accent); width: 14px; height: 14px; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0;
}
.toggle-row .t-label { font-size: 12.5px; color: var(--text); }
.toggle-row .t-sub { font-size: 11px; color: var(--text-mute); margin-top: 1px; }
.switch {
  position: relative; width: 36px; height: 20px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.switch.on { background: var(--accent-dim); border-color: var(--accent); }
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-mute);
  transition: transform .15s, background .15s;
}
.switch.on::after { transform: translateX(16px); background: var(--accent); }

.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  background: var(--panel-2);
}

.section-label {
  grid-column: 1 / -1;
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-mute); font-weight: 700;
  padding-top: 6px; padding-bottom: 2px;
  border-top: 1px solid var(--border-soft);
  margin-top: 6px;
}
.form-grid > .section-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }

/* ---- Breadcrumb link back ---- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-mute);
  margin-bottom: 10px;
}
.back-link:hover { color: var(--text-dim); }
.back-link svg { width: 13px; height: 13px; }

/* ---- Detail header ---- */
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px;
}
.detail-head .title-row { display: flex; align-items: center; gap: 10px; }
.detail-head h1 { font-size: 19px; font-weight: 650; }
.detail-head .sub { font-size: 12.5px; color: var(--text-mute); margin-top: 4px; }
.detail-head .actions { display: flex; gap: 8px; }

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 18px;
}
.tab {
  font-size: 12.5px; font-weight: 500; color: var(--text-mute);
  padding: 9px 4px; margin-right: 20px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: color .12s;
}
.tab:hover { color: var(--text-dim); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { animation: fadein .12s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---- Key-value grid (detail views) ---- */
.kv-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  padding: 18px;
}
.kv-item .k { font-size: 11px; color: var(--text-mute); margin-bottom: 3px; }
.kv-item .v { font-size: 13px; color: var(--text); }
.kv-item .v.mono { font-family: var(--font-mono); }

/* ---- Timeline / activity ---- */
.timeline { padding: 4px 18px 18px; }
.tl-item {
  display: flex; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.tl-item:last-child { border-bottom: none; }
.tl-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  margin-top: 5px; flex-shrink: 0;
}
.tl-body .tl-text { font-size: 12.5px; color: var(--text); }
.tl-body .tl-time { font-size: 11px; color: var(--text-mute); font-family: var(--font-mono); margin-top: 2px; }

/* ---- Chart container ---- */
.chart-box { padding: 16px 18px; position: relative; height: 280px; }
.chart-box canvas { max-height: 260px; width: 100% !important; height: 100% !important; }
.chart-legend { display: flex; gap: 16px; padding: 0 18px 14px; flex-wrap: wrap; }
.chart-legend .li { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-dim); }
.chart-legend .sw { width: 9px; height: 9px; border-radius: 2px; }

/* ---- Message thread (support ticket) ---- */
.thread { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; max-width: 78%; }
.msg.out { margin-left: auto; flex-direction: row-reverse; }
.msg .bubble {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 10px 13px;
  font-size: 12.5px;
}
.msg.out .bubble { background: var(--accent-dim); border-color: transparent; }
.msg .meta { font-size: 10.5px; color: var(--text-mute); margin-top: 4px; font-family: var(--font-mono); }
.reply-box {
  border-top: 1px solid var(--border-soft);
  padding: 14px 18px;
  display: flex; gap: 10px; align-items: flex-end;
}
.reply-box textarea { flex: 1; }

/* ---- Pagination ---- */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
  gap: 10px;
}
.pagination .p-info { font-size: 11.5px; color: var(--text-mute); font-family: var(--font-mono); }
.pagination .p-controls { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.pagination .p-btn {
  min-width: 26px; height: 26px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font-mono);
  border: 1px solid transparent;
  cursor: pointer;
}
.pagination .p-btn:hover { background: var(--panel-2); color: var(--text); }
.pagination .p-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); font-weight: 600; cursor: default; }
.pagination .p-btn.disabled { color: var(--text-mute); opacity: .4; pointer-events: none; }
.pagination .p-btn svg { width: 14px; height: 14px; }
.pagination .p-ellipsis { color: var(--text-mute); font-size: 12px; padding: 0 4px; }

/* ---- Row action icons ---- */
.row-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border-soft);
  transition: background .12s, color .12s, border-color .12s;
  cursor: pointer;
}
.icon-btn svg {
  width: 15px; height: 15px;
  stroke: currentColor;
  fill: none;
  pointer-events: none;
}
.icon-btn:hover { background: var(--panel-raised); color: var(--text); border-color: var(--border); }
.icon-btn.danger { color: var(--text-mute); }
.icon-btn.danger:hover { background: var(--crit-dim); color: var(--crit); border-color: var(--crit); }
.data-table td.actions-cell { white-space: nowrap; width: 1%; }

/* ---- Filter bar (page-level filters, not just table toolbar) ---- */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.fb-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--panel-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239AA5AB' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 28px 7px 11px;
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.fb-select:hover { background-color: var(--panel-raised); border-color: #33403a; }
.fb-select:focus { outline: none; border-color: var(--accent); }
.fb-select option { background: var(--panel); color: var(--text); }

/* ---- Customer type badge ---- */
.pill.type-org { background: var(--info-dim); color: var(--info); }
.pill.type-ind { background: rgba(107,94,242,0.14); color: #8B7FF5; }

/* ---- Document card (KYC) ---- */
.doc-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.doc-card .doc-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.doc-card .doc-icon svg { width: 16px; height: 16px; color: var(--accent); }
.doc-card .doc-info { flex: 1; }
.doc-card .doc-name { font-size: 12.5px; color: var(--text); }
.doc-card .doc-meta { font-size: 11px; color: var(--text-mute); font-family: var(--font-mono); margin-top: 2px; }

/* ---- Avatar chip (users list) ---- */
.avatar-sm {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel-raised);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.user-cell { display: flex; align-items: center; gap: 8px; }

/* ---- Recording player ---- */
.player {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
}
.player .play-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer; border: none;
  transition: background .12s;
}
.player .play-btn:hover { background: #64ADF5; }
.player .play-btn svg { width: 15px; height: 15px; }
.player .info { flex: 1; }
.player .name { font-size: 12.5px; color: var(--text); }
.player .meta { font-size: 11px; color: var(--text-mute); font-family: var(--font-mono); margin-top: 2px; }
.player .progress-track {
  flex: 1; height: 4px; border-radius: 4px; background: var(--panel-raised);
  margin-top: 8px; overflow: hidden; cursor: pointer;
}
.player .progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width .1s linear; }
.player .time { font-size: 10.5px; color: var(--text-mute); font-family: var(--font-mono); margin-top: 4px; display: flex; justify-content: space-between; }

/* ---- Analytics link card (page-level "view full analytics") ---- */
.analytics-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  font-size: 12px; color: var(--text-dim);
  margin-top: 10px;
}
.analytics-link a { color: var(--accent); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.analytics-link a svg { width: 13px; height: 13px; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5,7,8,0.7);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modalIn .15s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 { font-size: 14.5px; font-weight: 650; }
.modal-close {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-mute);
  cursor: pointer;
}
.modal-close:hover { background: var(--panel-2); color: var(--text); }
.modal-close svg { width: 15px; height: 15px; }
.modal-body { padding: 18px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  background: var(--panel-2);
}

/* ---- Toast notifications ---- */
.toast-stack {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
  max-width: 340px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  animation: toastIn .18s ease;
  font-size: 12.5px;
}
.toast.leaving { animation: toastOut .15s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
.toast .t-icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.toast.success .t-icon { color: var(--ok); }
.toast.error .t-icon { color: var(--crit); }
.toast.info .t-icon { color: var(--info); }
.toast .t-text { color: var(--text); flex: 1; }
.toast .t-close { color: var(--text-mute); cursor: pointer; flex-shrink: 0; }
.toast .t-close:hover { color: var(--text); }

/* ---- Global search (topbar) ---- */
.global-search {
  position: relative;
  flex: 1; max-width: 420px;
  margin: 0 16px;
}
.global-search-input {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-mute);
  cursor: text;
}
.global-search-input input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 12.5px; width: 100%;
  font-family: var(--font-ui);
}
.global-search-input input::placeholder { color: var(--text-mute); }
.global-search-input svg { width: 14px; height: 14px; flex-shrink: 0; }
.global-search-input .kbd {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; color: var(--text-mute);
  flex-shrink: 0;
}
.global-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  max-height: 360px; overflow-y: auto;
  display: none;
  z-index: 50;
}
.global-search-results.open { display: block; }
.gs-group { padding: 8px 0; }
.gs-group:not(:last-child) { border-bottom: 1px solid var(--border-soft); }
.gs-group-label {
  font-size: 10px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-mute); font-weight: 600;
  padding: 4px 14px 6px;
}
.gs-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12.5px; color: var(--text-dim);
}
.gs-item:hover { background: var(--panel-2); color: var(--text); }
.gs-item svg { width: 14px; height: 14px; color: var(--text-mute); flex-shrink: 0; }
.gs-empty { padding: 20px 14px; text-align: center; font-size: 12px; color: var(--text-mute); }

/* ---- Bulk action bar ---- */
.bulk-bar {
  display: none;
  align-items: center; gap: 12px;
  padding: 10px 18px;
  background: var(--accent-dim);
  border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
}
.bulk-bar.open { display: flex; }
.bulk-bar .b-count { color: var(--accent); font-weight: 600; font-family: var(--font-mono); }
.bulk-bar .b-actions { display: flex; gap: 8px; margin-left: auto; }
.bulk-bar .b-clear { color: var(--text-mute); cursor: pointer; }
.bulk-bar .b-clear:hover { color: var(--text); }
.row-check { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.data-table th.check-col, .data-table td.check-col { width: 1%; padding-right: 4px; }

/* ---- Empty state (no results) ---- */
.table-empty {
  padding: 40px 20px;
  text-align: center;
}
.table-empty svg { width: 32px; height: 32px; color: var(--text-mute); margin: 0 auto 10px; }
.table-empty .te-title { font-size: 13px; color: var(--text-dim); font-weight: 500; margin-bottom: 3px; }
.table-empty .te-sub { font-size: 11.5px; color: var(--text-mute); }

/* ---- Login page (standalone, no app-shell) ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}
.auth-visual {
  flex: 1.1;
  position: relative;
  background: radial-gradient(circle at 20% 20%, rgba(75,156,242,0.18), transparent 55%),
              radial-gradient(circle at 80% 75%, rgba(107,94,242,0.16), transparent 50%),
              var(--panel);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px;
  overflow: hidden;
}
.auth-visual .av-top img { height: 30px; }
.auth-visual .av-mid {
  max-width: 420px;
}
.auth-visual .av-mid h2 {
  font-size: 26px; font-weight: 650; letter-spacing: -0.01em;
  line-height: 1.3; margin-bottom: 14px;
}
.auth-visual .av-mid p { font-size: 13.5px; color: var(--text-dim); line-height: 1.6; }
.auth-visual .av-stats {
  display: flex; gap: 28px;
  margin-top: 28px;
}
.auth-visual .av-stat .n { font-family: var(--font-mono); font-size: 20px; font-weight: 700; color: var(--text); }
.auth-visual .av-stat .l { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.auth-visual .av-bottom { font-size: 11px; color: var(--text-mute); font-family: var(--font-mono); }

.auth-form-side {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.auth-box { width: 100%; max-width: 360px; }
.auth-box .ab-logo { height: 28px; margin-bottom: 32px; }
.auth-box h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 6px; }
.auth-box .ab-sub { font-size: 13px; color: var(--text-mute); margin-bottom: 28px; }

.auth-field { margin-bottom: 16px; }
.auth-field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 6px;
}
.auth-field input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color .12s;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-field input::placeholder { color: var(--text-mute); }
.auth-field .af-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.auth-field .af-row a { font-size: 11.5px; color: var(--accent); }

.auth-otp-row { display: flex; gap: 8px; }
.auth-otp-row input {
  width: 44px; text-align: center;
  font-family: var(--font-mono); font-size: 17px; font-weight: 600;
  padding: 10px 0;
}

.auth-submit {
  width: 100%;
  padding: 11px;
  margin-top: 6px;
  font-size: 13.5px;
}

.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0;
  color: var(--text-mute); font-size: 11px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-soft);
}

.auth-alt-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: background .12s;
}
.auth-alt-btn:hover { background: var(--panel-raised); }

.auth-footer-note {
  margin-top: 24px;
  font-size: 11.5px; color: var(--text-mute);
  text-align: center;
}
.auth-footer-note a { color: var(--accent); }

.auth-error {
  display: none;
  align-items: center; gap: 8px;
  background: var(--crit-dim);
  border: 1px solid rgba(229,72,77,0.3);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--crit);
  font-size: 12px;
  margin-bottom: 16px;
}
.auth-error.show { display: flex; }
.auth-error svg { width: 14px; height: 14px; flex-shrink: 0; }

@media (max-width: 860px) {
  .auth-visual { display: none; }
}

/* ---- Command palette ---- */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(5,7,8,0.6);
  display: none;
  align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  z-index: 300;
}
.cmdk-overlay.open { display: flex; }
.cmdk-box {
  width: 100%; max-width: 560px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  overflow: hidden;
  animation: modalIn .15s ease;
}
.cmdk-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.cmdk-input-row svg { width: 17px; height: 17px; color: var(--text-mute); flex-shrink: 0; }
.cmdk-input-row input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 14.5px; font-family: var(--font-ui);
}
.cmdk-input-row input::placeholder { color: var(--text-mute); }
.cmdk-input-row .kbd { font-family: var(--font-mono); font-size: 10.5px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; color: var(--text-mute); }
.cmdk-results { max-height: 420px; overflow-y: auto; padding: 6px 0; }
.cmdk-group-label { font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-mute); font-weight: 600; padding: 8px 16px 4px; }
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px; color: var(--text-dim);
}
.cmdk-item svg { width: 15px; height: 15px; color: var(--text-mute); flex-shrink: 0; }
.cmdk-item.active, .cmdk-item:hover { background: var(--accent-dim); color: var(--text); }
.cmdk-item.active svg, .cmdk-item:hover svg { color: var(--accent); }
.cmdk-empty { padding: 24px 16px; text-align: center; font-size: 12.5px; color: var(--text-mute); }

/* ---- Scrollbar (webkit) ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #33403a; }

/* ---- Responsive ---- */
/* ---- Hamburger menu (mobile) ---- */
.hamburger-btn {
  display: none;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 10px;
}
.hamburger-btn svg { width: 17px; height: 17px; }
.sidebar-scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,7,8,0.6);
  z-index: 40;
}
.sidebar-scrim.open { display: block; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; grid-template-areas: "status" "top" "main"; }
  .hamburger-btn { display: flex; }
  .sidebar {
    position: fixed; top: var(--statusbar-h); left: 0; bottom: 0;
    width: 260px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .two-col { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .dot.crit, .dot.ok, .live-tag .dot { animation: none; }
}

/* ---- Print styles (invoice, receipts) ---- */
@media print {
  .status-strip, .sidebar, .topbar, .back-link, .bulk-bar,
  .toast-stack, .modal-overlay, .btn, .row-actions, .pagination,
  .detail-head .actions, .toolbar { display: none !important; }

  html, body { background: #fff !important; height: auto; overflow: visible; }
  .app-shell { display: block !important; height: auto !important; overflow: visible !important; }
  .main { height: auto !important; overflow: visible !important; padding: 0 !important; }

  .panel, .metric-card, .kv-grid {
    background: #fff !important;
    border-color: #ddd !important;
    box-shadow: none !important;
  }
  .detail-head h1, .page-head h1, h2 { color: #000 !important; }
  .kv-item .k, .m-label, .text-mute, .text-dim { color: #555 !important; }
  .kv-item .v, .m-value, .data-table td, .data-table th { color: #000 !important; }
  .data-table th { border-bottom: 1px solid #999 !important; }
  .data-table td { border-bottom: 1px solid #ddd !important; }
  .pill { border: 1px solid currentColor; background: transparent !important; }

  .print-header {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 2px solid #000;
  }
  .print-header img { height: 28px; filter: grayscale(1) contrast(2); }
  .print-header .ph-meta { text-align: right; font-size: 11px; color: #555; }
}
.print-header { display: none; }
