/* ============================================================================
   AI Receptionist · Super Admin Panel
   Built on the AI Fitters "Modern Trade" brand system.
   Brand tokens (--blue, --sand, --ink, --orange ...) preserved; semantic app
   tokens map them into a themed dashboard surface (light + dark).
   ============================================================================ */

@font-face {
  font-family: "Manrope";
  src: url("fonts/Manrope-VariableFont_wght.ttf") format("truetype-variations"),
       url("fonts/Manrope-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-VariableFont_wght.ttf") format("truetype-variations"),
       url("fonts/JetBrainsMono-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 800; font-style: normal; font-display: swap;
}

:root {
  /* ---- brand core ---- */
  --blue-50:#F1F7FD; --blue-100:#E8F1FB; --blue-200:#B8D4F3; --blue-400:#4F8FE0;
  --blue:#1E6FD9; --blue-700:#185FA5; --blue-900:#0C2E50;
  --orange:#DF6F56; --orange-700:#C8543B;

  --font-sans:"Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:"JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* ---- accent / radius ---- */
  --accent:#1E6FD9;
  --accent-strong:#185FA5;
  --accent-soft:#E8F1FB;
  --accent-on:#FFFFFF;
  --radius-scale:1;

  --r-sm:calc(6px * var(--radius-scale));
  --r-md:calc(10px * var(--radius-scale));
  --r-lg:calc(14px * var(--radius-scale));
  --r-xl:calc(20px * var(--radius-scale));
  --r-full:9999px;

  --t-fast:100ms; --t-normal:150ms; --t-slow:220ms; --ease:cubic-bezier(.4,0,.2,1);
  --sidebar-w:248px;
}

/* ===================== LIGHT ===================== */
:root, :root[data-theme="light"] {
  --app-bg:#FAF8F3;
  --surface:#FFFFFF;
  --surface-2:#F7F3EB;
  --surface-3:#F1ECE1;
  --surface-inset:#F7F3EB;

  --text:#1A1A1A;
  --text-soft:#43474D;
  --text-muted:#76787C;
  --text-faint:#A0A0A0;

  --border:#E7E2D7;
  --border-soft:#F0EBE1;
  --border-strong:#D9D2C4;

  --sidebar-grad:linear-gradient(176deg,#0E3358 0%,#0A2645 100%);
  --sidebar-text:rgba(233,240,250,.66);
  --sidebar-text-active:#FFFFFF;
  --sidebar-active-bg:rgba(255,255,255,.10);
  --sidebar-border:rgba(255,255,255,.09);
  --sidebar-section:rgba(233,240,250,.42);
  --sidebar-hover:rgba(255,255,255,.05);

  --ok:#2D7A2D; --ok-bg:#E5F5E5;
  --warn:#B97A0A; --warn-bg:#FBF1DD;
  --bad:#C42F2F; --bad-bg:#FBE6E6;
  --info:#1E6FD9; --info-bg:#E8F1FB;
  --neutral-bg:#F1ECE1; --neutral-fg:#5C5E62;
  --purple:#7A4FBF; --purple-bg:#F0E9FA;

  --shadow-xs:0 1px 2px rgba(38,30,15,.05);
  --shadow-sm:0 2px 8px rgba(38,30,15,.07);
  --shadow-md:0 10px 28px rgba(38,30,15,.10),0 2px 6px rgba(38,30,15,.05);
  --shadow-lg:0 22px 48px rgba(20,28,40,.16);
  --overlay:rgba(28,24,16,.36);
  --focus:0 0 0 3px var(--accent-soft);
  --skeleton:linear-gradient(90deg,var(--surface-2) 25%,var(--surface-3) 37%,var(--surface-2) 63%);
}

/* ===================== DARK ===================== */
:root[data-theme="dark"] {
  --app-bg:#0B0F15;
  --surface:#141A22;
  --surface-2:#1A212B;
  --surface-3:#212A35;
  --surface-inset:#10151C;

  --text:#ECE8E0;
  --text-soft:#C3C8CF;
  --text-muted:#8C95A1;
  --text-faint:#5E6772;

  --border:#262F3A;
  --border-soft:#1D242E;
  --border-strong:#33404E;

  --sidebar-grad:linear-gradient(176deg,#0A0F16 0%,#060A0F 100%);
  --sidebar-text:rgba(214,222,232,.58);
  --sidebar-text-active:#FFFFFF;
  --sidebar-active-bg:rgba(255,255,255,.08);
  --sidebar-border:rgba(255,255,255,.06);
  --sidebar-section:rgba(214,222,232,.34);
  --sidebar-hover:rgba(255,255,255,.04);

  --accent:#4F8FE0;
  --accent-strong:#6BA3E8;
  --accent-soft:rgba(79,143,224,.16);
  --accent-on:#0B0F15;

  --ok:#5FBF6A; --ok-bg:rgba(95,191,106,.14);
  --warn:#E0A437; --warn-bg:rgba(224,164,55,.14);
  --bad:#E06B6B; --bad-bg:rgba(224,107,107,.14);
  --info:#4F8FE0; --info-bg:rgba(79,143,224,.15);
  --neutral-bg:#222B36; --neutral-fg:#9AA3AE;
  --purple:#A98AE0; --purple-bg:rgba(169,138,224,.15);

  --orange:#E8836C; --orange-700:#C8543B;

  --shadow-xs:0 1px 2px rgba(0,0,0,.4);
  --shadow-sm:0 2px 8px rgba(0,0,0,.42);
  --shadow-md:0 10px 28px rgba(0,0,0,.5),0 2px 6px rgba(0,0,0,.4);
  --shadow-lg:0 22px 52px rgba(0,0,0,.62);
  --overlay:rgba(4,7,11,.64);
  --focus:0 0 0 3px var(--accent-soft);
  --skeleton:linear-gradient(90deg,var(--surface-2) 25%,var(--surface-3) 37%,var(--surface-2) 63%);
}

/* ===================== BASE ===================== */
* { box-sizing:border-box; }
html,body { height:100%; margin:0; }
body {
  font-family:var(--font-sans);
  background:var(--app-bg);
  color:var(--text);
  font-size:18px; line-height:1.5;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
#root { height:100%; }
.mono { font-family:var(--font-mono); }
.muted { color:var(--text-muted); }
a { color:var(--accent); text-decoration:none; }
::selection { background:var(--accent-soft); }
:focus-visible { outline:none; box-shadow:var(--focus); border-radius:6px; }
button { font-family:inherit; }

*::-webkit-scrollbar { width:10px; height:10px; }
*::-webkit-scrollbar-thumb { background:var(--border-strong); border-radius:9999px; border:2px solid transparent; background-clip:padding-box; }
*::-webkit-scrollbar-thumb:hover { background:var(--text-faint); background-clip:padding-box; }
*::-webkit-scrollbar-track { background:transparent; }

.ic { display:inline-block; vertical-align:middle; }

/* ===================== BUTTONS ===================== */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  font-weight:600; font-size:16px; line-height:1;
  padding:9px 15px; border-radius:var(--r-md); border:1px solid transparent;
  cursor:pointer; white-space:nowrap; user-select:none;
  transition:transform var(--t-fast) var(--ease), background var(--t-normal) var(--ease),
             border-color var(--t-normal) var(--ease), color var(--t-normal) var(--ease), box-shadow var(--t-normal);
}
.btn:hover { transform:translateY(-1px); }
.btn:active { transform:translateY(0); }
.btn .ic { width:15px; height:15px; }
.btn-primary { background:var(--accent); color:var(--accent-on); border-color:var(--accent); }
.btn-primary:hover { background:var(--accent-strong); border-color:var(--accent-strong); }
.btn-orange { background:var(--orange); color:#fff; border-color:var(--orange); }
.btn-orange:hover { background:var(--orange-700); border-color:var(--orange-700); }
.btn-outline { background:var(--surface); color:var(--text); border-color:var(--border-strong); }
.btn-outline:hover { background:var(--surface-2); border-color:var(--text-faint); }
.btn-ghost { background:transparent; color:var(--text-soft); }
.btn-ghost:hover { background:var(--surface-2); }
.btn-danger { background:var(--bad); color:#fff; border-color:var(--bad); }
.btn-danger:hover { filter:brightness(.93); }
.btn-sm { padding:6px 11px; font-size:16px; gap:5px; }
.btn-sm .ic { width:14px; height:14px; }
.btn-lg { padding:13px 22px; font-size:16px; }
.btn[disabled] { opacity:.5; cursor:not-allowed; transform:none; }
.btn-block { width:100%; }

.icon-btn {
  display:inline-flex; align-items:center; justify-content:center;
  width:30px; height:30px; border-radius:var(--r-md);
  border:1px solid transparent; background:transparent; color:var(--text-muted);
  cursor:pointer; transition:background var(--t-normal), color var(--t-normal);
}
.icon-btn .ic { width:16px; height:16px; }
.icon-btn:hover { background:var(--surface-2); color:var(--text); }
.icon-btn.danger:hover { background:var(--bad-bg); color:var(--bad); }
.icon-btn.sm { width:26px; height:26px; }
.icon-btn.sm .ic { width:14px; height:14px; }

/* ===================== BADGES ===================== */
.badge {
  display:inline-flex; align-items:center; gap:5px;
  font-size:16px; font-weight:600; line-height:1;
  padding:4px 9px; border-radius:var(--r-full);
  border:1px solid transparent; white-space:nowrap;
}
.badge .dot { width:6px; height:6px; border-radius:50%; background:currentColor; flex-shrink:0; }
.badge.ok { background:var(--ok-bg); color:var(--ok); }
.badge.warn { background:var(--warn-bg); color:var(--warn); }
.badge.bad { background:var(--bad-bg); color:var(--bad); }
.badge.info { background:var(--info-bg); color:var(--info); }
.badge.neutral { background:var(--neutral-bg); color:var(--neutral-fg); }
.badge.purple { background:var(--purple-bg); color:var(--purple); }
.badge.accent { background:var(--accent-soft); color:var(--accent-strong); }
.badge.mono { font-family:var(--font-mono); font-weight:500; }

/* ===================== FORM FIELDS ===================== */
.field { display:flex; flex-direction:column; gap:6px; }
.field-label { font-size:16px; font-weight:600; color:var(--text); display:flex; align-items:center; gap:4px; }
.field-label .req { color:var(--bad); }
.field-hint { font-size:16px; color:var(--text-muted); }
.field-error { font-size:16px; color:var(--bad); font-weight:500; display:flex; align-items:center; gap:4px; }
.input, .textarea, .select {
  font-family:var(--font-sans); font-size:16px; color:var(--text);
  background:var(--surface); border:1px solid var(--border-strong);
  border-radius:var(--r-md); padding:9px 12px; width:100%;
  transition:border-color var(--t-normal), box-shadow var(--t-normal);
}
.input::placeholder, .textarea::placeholder { color:var(--text-faint); }
.input:focus, .textarea:focus, .select:focus { outline:none; border-color:var(--accent); box-shadow:var(--focus); }
.input.invalid, .textarea.invalid, .select.invalid { border-color:var(--bad); }
.textarea { resize:vertical; min-height:84px; line-height:1.55; }
.textarea.mono { font-family:var(--font-mono); font-size:16px; }
.select {
  appearance:none; cursor:pointer; padding-right:34px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2376787C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 11px center;
}
.input:disabled, .textarea:disabled, .select:disabled {
  background-color:var(--surface-inset);
  color:var(--text-muted);
  cursor:not-allowed;
  opacity:0.85;
}
.select:disabled {
  background-image:none;
  padding-right:12px;
}
.input-mono { font-family:var(--font-mono); font-size:16px; }

.toggle { display:inline-flex; align-items:center; gap:10px; cursor:pointer; user-select:none; }
.toggle-track { width:38px; height:22px; border-radius:9999px; background:var(--border-strong); position:relative; transition:background var(--t-normal) var(--ease); flex-shrink:0; }
.toggle-track::after { content:""; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:var(--shadow-xs); transition:transform var(--t-normal) var(--ease); }
.toggle.on .toggle-track { background:var(--accent); }
.toggle.on .toggle-track::after { transform:translateX(16px); }
.toggle-label { font-size:16px; color:var(--text); font-weight:500; }

.segmented { display:inline-flex; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-md); padding:3px; gap:2px; }
.segmented button { font-size:16px; font-weight:600; color:var(--text-muted); background:transparent; border:none; border-radius:calc(var(--r-md) - 3px); padding:6px 12px; cursor:pointer; transition:all var(--t-normal); white-space:nowrap; }
.segmented button.active { background:var(--surface); color:var(--text); box-shadow:var(--shadow-xs); }
.tab-count { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 5px; margin-left:5px; font-size:16px; font-weight:700; border-radius:999px; background:var(--border); color:var(--text-muted); line-height:1; vertical-align:middle; }
.segmented button.active .tab-count { background:var(--blue); color:#fff; }

/* ===================== CARDS ===================== */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); box-shadow:var(--shadow-xs); }
.stat-icon { width:38px; height:38px; border-radius:var(--r-md); display:flex; align-items:center; justify-content:center; background:var(--accent-soft); color:var(--accent-strong); }
.stat-icon .ic { width:19px; height:19px; }

/* ===================== TOOLBAR / SEARCH ===================== */
.toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.toolbar .spacer { flex:1; }
.search { position:relative; display:inline-flex; align-items:center; min-width:230px; flex:0 1 280px; }
.search .ic { position:absolute; left:11px; width:15px; height:15px; color:var(--text-faint); pointer-events:none; }
.search input { font-size:16px; color:var(--text); background:var(--surface); border:1px solid var(--border-strong); border-radius:var(--r-md); padding:8px 12px 8px 32px; width:100%; font-family:var(--font-sans); transition:border-color var(--t-normal), box-shadow var(--t-normal); }
.search input:focus { outline:none; border-color:var(--accent); box-shadow:var(--focus); }

/* ===================== LOG FILTER BAR ===================== */
.log-filters { gap:14px; row-gap:10px; }
.lf-group { display:inline-flex; align-items:center; gap:8px; }
.lf-label { display:inline-flex; align-items:center; gap:5px; font-size:16px; font-weight:600; color:var(--text-muted); white-space:nowrap; width:62px; flex-shrink:0; }
.lf-label .ic { width:14px; height:14px; flex-shrink:0; color:var(--text-faint); }
.lf-select, .lf-date { font-family:var(--font-sans); font-size:16px; color:var(--text); background:var(--surface); border:1px solid var(--border-strong); border-radius:var(--r-md); padding:7px 10px; transition:border-color var(--t-normal), box-shadow var(--t-normal); }
.lf-select { padding-right:30px; min-width:160px; }
.lf-date { color-scheme:var(--scheme,light); }
.lf-select:focus, .lf-date:focus { outline:none; border-color:var(--accent); box-shadow:var(--focus); }
.lf-dash { color:var(--text-faint); font-weight:600; }
/* Leads filter row: Stage dropdown matches the Client dropdown width below it */
.lead-stage-group .select { width:160px; min-width:160px; }
.lead-filters { gap:14px; }
.lead-stage-group { width:230px; flex-shrink:0; }
.leads-page .log-filters .lf-select { width:160px; }
/* Filter labels fixed width so their fields start at a predictable x (all log pages) */
.lead-stage-group .lead-filter-label { width:62px; flex-shrink:0; }
.lead-status-group .lead-filter-label,
.leads-page .log-filters .lf-group:nth-child(2) .lf-label { width:72px; }
/* Status segmented control sits directly above the Dates fields and matches their width */
.lead-status-group .segmented { width:236px; }
.lead-status-group .segmented button { flex:1; text-align:center; }
@media (max-width:760px){
  .log-filters .lf-group { flex-wrap:nowrap; width:100%; }
  .log-filters .spacer { display:none; }
  .log-filters .btn { width:100%; justify-content:center; }
}

/* ===================== ACCOUNT SETTINGS ===================== */
.acct-tabs { display:flex; gap:4px; padding:3px; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-md); margin-bottom:18px; }
.acct-tab { flex:1; display:inline-flex; align-items:center; justify-content:center; gap:7px; font-size:16px; font-weight:600; color:var(--text-muted); background:transparent; border:none; border-radius:calc(var(--r-md) - 3px); padding:8px 10px; cursor:pointer; transition:all var(--t-fast); }
.acct-tab .ic { width:15px; height:15px; }
.acct-tab:hover { color:var(--text); }
.acct-tab.active { background:var(--surface); color:var(--accent-strong); box-shadow:var(--shadow-xs); }
.acct-pane { display:flex; flex-direction:column; gap:18px; }

.range { -webkit-appearance:none; appearance:none; flex:1; height:5px; border-radius:9999px; background:var(--surface-3,var(--border)); outline:none; }
.range::-webkit-slider-thumb { -webkit-appearance:none; appearance:none; width:18px; height:18px; border-radius:50%; background:var(--accent); border:2px solid var(--surface); box-shadow:var(--shadow-sm); cursor:pointer; }
.range::-moz-range-thumb { width:18px; height:18px; border-radius:50%; background:var(--accent); border:2px solid var(--surface); box-shadow:var(--shadow-sm); cursor:pointer; }

/* members */
.members-head { display:flex; align-items:flex-end; justify-content:space-between; gap:14px; }
.members-title { font-size:16px; font-weight:700; color:var(--text); }
.members-sub { font-size:16px; color:var(--text-muted); margin-top:2px; max-width:380px; }
.member-list { display:flex; flex-direction:column; gap:8px; }
.member-row { display:flex; align-items:center; gap:12px; padding:11px 13px; border:1px solid var(--border); border-radius:var(--r-md); background:var(--surface); }
.member-row:hover { border-color:var(--border-strong); }
.member-meta { flex:1; min-width:0; }
.member-name { font-size:16px; font-weight:600; color:var(--text); display:flex; align-items:center; gap:7px; }
.member-email { font-size:16px; color:var(--text-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.you-tag { font-size:16px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--accent-strong); background:var(--accent-soft); padding:2px 6px; border-radius:9999px; }
.member-actions { display:inline-flex; gap:2px; }
.member-actions .is-disabled { opacity:.35; pointer-events:none; }

/* my profile */
.profile-id { display:flex; align-items:center; gap:14px; padding:14px 16px; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-md); }
.profile-id-name { font-size:16px; font-weight:700; color:var(--text); }
.profile-id-role { font-size:16px; color:var(--text-muted); margin-top:3px; display:flex; align-items:center; gap:6px; }
.profile-note { display:flex; align-items:center; gap:9px; font-size:16px; color:var(--text-soft); background:var(--info-bg); border:1px solid color-mix(in oklab, var(--info) 25%, transparent); border-radius:var(--r-md); padding:10px 13px; }
.profile-note .ic { color:var(--info); flex:none; }

/* clickable sidebar profile + cog */
.sb-user { width:100%; background:none; border:none; text-align:left; cursor:pointer; border-radius:var(--r-md); transition:background var(--t-fast); }
.sb-user:hover { background:var(--surface-2); }
.sb-user .sb-cog { width:16px; height:16px; color:var(--text-faint); flex:none; transition:color var(--t-fast); }
.sb-user:hover .sb-cog { color:var(--text-muted); }

/* ===================== TABLE ===================== */
.table-wrap { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); overflow:hidden; box-shadow:var(--shadow-xs); min-width:0; width:100%; flex-shrink:0; }
.table-scroll { overflow-x:auto; }
table.data-table { width:100%; border-collapse:collapse; font-size:16px; }
.data-table thead th {
  background:var(--surface-2); color:var(--text-muted);
  font-size:16px; font-weight:700; letter-spacing:.04em; text-transform:uppercase;
  text-align:left; padding:0 14px; height:38px; white-space:nowrap; border-bottom:1px solid var(--border);
}
.data-table thead th.sortable { cursor:pointer; user-select:none; }
.data-table thead th.sortable:hover { color:var(--text); }
.data-table th .th-in { display:inline-flex; align-items:center; gap:5px; }
.data-table th .sort-ic { width:13px; height:13px; opacity:.45; }
.data-table th.sorted .sort-ic { opacity:1; color:var(--accent); }
.data-table th.actions-col, .data-table td.actions-col { text-align:right; width:1%; white-space:nowrap; }
.data-table tbody td { padding:0 14px; height:var(--row-h,44px); border-bottom:1px solid var(--border-soft); color:var(--text-soft); vertical-align:middle; }
.data-table tbody tr { transition:background var(--t-fast); }
@media (hover: hover) {
  .data-table tbody tr:hover { background:var(--surface-2); }
}
.data-table tbody tr:last-child td { border-bottom:none; }
.data-table tbody tr.clickable { cursor:pointer; }
.cell-strong { color:var(--text); font-weight:600; }
.lead-client-name { white-space:nowrap; }
.cell-mono { font-family:var(--font-mono); font-size:16px; color:var(--text-soft); }
.cell-faint { color:var(--text-faint); }
.row-actions { display:inline-flex; gap:2px; opacity:0; transition:opacity var(--t-fast); }
@media (hover: hover) {
  .data-table tbody tr:hover .row-actions { opacity:1; }
}
@media (hover: none) {
  .row-actions { opacity:1; }
}
.truncate { max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.cell-user { display:inline-flex; align-items:center; gap:9px; }

/* pagination */
.pagination { display:flex; align-items:center; gap:8px; padding:11px 14px; border-top:1px solid var(--border); background:var(--surface); }
.pagination .pginfo { font-size:16px; color:var(--text-muted); }
.pagination .spacer { flex:1; }
.page-btn { display:inline-flex; align-items:center; justify-content:center; min-width:30px; height:30px; padding:0 8px; border-radius:var(--r-sm); border:1px solid var(--border-strong); background:var(--surface); color:var(--text-soft); font-size:16px; font-weight:600; cursor:pointer; transition:all var(--t-fast); }
.page-btn:hover:not(:disabled) { background:var(--surface-2); }
.page-btn.active { background:var(--accent); border-color:var(--accent); color:var(--accent-on); }
.page-btn:disabled { opacity:.4; cursor:not-allowed; }

/* skeleton + empty */
.skel { background:var(--skeleton); background-size:400% 100%; animation:shimmer 1.3s ease-in-out infinite; border-radius:var(--r-sm); height:12px; }
@keyframes shimmer { 0%{background-position:100% 0;} 100%{background-position:-100% 0;} }
.empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:56px 24px; gap:6px; }
.empty-ic { width:56px; height:56px; border-radius:var(--r-lg); background:var(--surface-2); color:var(--text-faint); display:flex; align-items:center; justify-content:center; margin-bottom:8px; }
.empty-ic .ic { width:26px; height:26px; }
.empty-title { font-size:16px; font-weight:700; color:var(--text); }
.empty-sub { font-size:16px; color:var(--text-muted); max-width:320px; }

/* ===================== MODAL ===================== */
.overlay { position:fixed; inset:0; background:var(--overlay); backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px); z-index:60; display:flex; align-items:flex-start; justify-content:center; padding:48px 20px; overflow-y:auto; }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }
.modal { background:var(--surface); border:1px solid var(--border); border-radius:var(--r-xl); box-shadow:var(--shadow-lg); width:100%; max-width:560px; display:flex; flex-direction:column; max-height:calc(100dvh - 96px); min-width:0; }
.modal.wide { max-width:720px; }
.modal.narrow { max-width:440px; }
@keyframes modalIn { from{opacity:0; transform:translateY(12px) scale(.99);} to{opacity:1; transform:none;} }
.modal-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:20px 22px 14px; border-bottom:1px solid var(--border-soft); }
.modal-head-actions { display:flex; align-items:center; gap:6px; }
.modal-edit-link { display:inline-flex; align-items:center; gap:6px; font-size:16px; font-weight:600; color:var(--accent); background:none; border:none; cursor:pointer; padding:6px 10px; border-radius:var(--r-sm); transition:background .12s; }
.modal-edit-link:hover { background:var(--accent-soft); }
.modal-edit-link .ic { width:15px; height:15px; }

/* read-only view rows */
.view-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px 22px; }
.view-grid .full { grid-column:1 / -1; }
.view-field .vf-label { font-size:16px; font-weight:600; text-transform:uppercase; letter-spacing:.04em; color:var(--text-faint); margin-bottom:4px; }
.view-field .vf-val { font-size:16px; color:var(--text); line-height:1.5; }
.view-field .vf-val.pre { white-space:pre-wrap; }
.view-field .vf-val.mono { font-family:var(--font-mono); font-size:16px; }
.view-field .vf-val.empty { color:var(--text-faint); }
.view-sub-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:4px; }
.view-sub-title { font-size:16px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); }

/* company directory and its linked people */
.cell-company { display:inline-flex; align-items:center; gap:10px; }
.company-mark { width:30px; height:30px; display:inline-flex; align-items:center; justify-content:center; flex:none; border-radius:var(--r-sm); background:var(--accent-soft); color:var(--accent); }
.company-mark .ic { width:16px; height:16px; }
.company-contact-count { display:inline-flex; min-width:26px; height:26px; align-items:center; justify-content:center; padding:0 7px; border-radius:var(--r-full); background:var(--surface-2); color:var(--text-soft); font-size:16px; font-weight:700; font-variant-numeric:tabular-nums; }
.company-contacts { border-top:1px solid var(--border-soft); padding-top:16px; }
.company-contacts-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.company-contacts-head h3 { margin:0; color:var(--text); font-size:16px; font-weight:700; }
.company-contacts-head p { margin:3px 0 0; color:var(--text-muted); font-size:16px; }
.company-contact-list { border-top:1px solid var(--border); }
.company-contact-row { display:flex; align-items:center; gap:11px; min-height:54px; border-bottom:1px solid var(--border-soft); }
.company-contact-row:last-child { border-bottom:0; }
.company-contact-person { display:flex; min-width:0; flex:1; flex-direction:column; gap:1px; }
.company-contact-person .cell-strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.company-contact-secondary { color:var(--text-muted); font-size:16px; }
.company-contact-phone { flex:none; font-family:var(--font-mono); font-size:16px; }
.company-contact-empty { display:flex; align-items:center; gap:10px; padding:15px; border:1px dashed var(--border-strong); border-radius:var(--r-md); color:var(--text-muted); font-size:16px; }
.company-contact-empty .ic { width:17px; height:17px; color:var(--text-faint); }
.modal-title { font-size:18px; font-weight:800; letter-spacing:-.01em; }
.modal-sub { font-size:16px; color:var(--text-muted); margin-top:3px; }
.modal-body { padding:20px 22px; overflow-y:auto; display:flex; flex:1 1 auto; flex-direction:column; gap:16px; min-height:0; -webkit-overflow-scrolling:touch; }
.modal-foot { display:flex; align-items:center; gap:10px; padding:15px 22px; border-top:1px solid var(--border-soft); background:var(--surface-2); border-radius:0 0 var(--r-xl) var(--r-xl); }
.modal-foot .spacer { flex:1; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-grid .full { grid-column:1 / -1; }
.confirm-ic { width:44px; height:44px; border-radius:var(--r-md); background:var(--bad-bg); color:var(--bad); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.confirm-ic .ic { width:22px; height:22px; }

/* drawer (detail expand) */
.detail-block { background:var(--surface-inset); border:1px solid var(--border-soft); border-radius:var(--r-md); padding:13px 15px; }
.detail-label { font-size:16px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--text-faint); margin-bottom:6px; }
.detail-text { font-size:16px; color:var(--text-soft); line-height:1.6; white-space:pre-wrap; }
.detail-text.mono { font-family:var(--font-mono); font-size:16px; }

/* ===================== TOASTS ===================== */
.toast-wrap { position:fixed; bottom:22px; right:22px; z-index:90; display:flex; flex-direction:column; gap:10px; align-items:flex-end; }
.toast { display:flex; align-items:center; gap:11px; background:var(--surface); border:1px solid var(--border); box-shadow:var(--shadow-lg); border-radius:var(--r-md); padding:11px 15px 11px 13px; min-width:260px; max-width:360px; }
@keyframes toastIn { from{opacity:0; transform:translateX(16px);} to{opacity:1; transform:none;} }
.toast.out { animation:toastOut var(--t-normal) var(--ease) forwards; }
@keyframes toastOut { to{opacity:0; transform:translateX(16px);} }
.toast-ic { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.toast-ic .ic { width:16px; height:16px; }
.toast.success .toast-ic { background:var(--ok-bg); color:var(--ok); }
.toast.error .toast-ic { background:var(--bad-bg); color:var(--bad); }
.toast.info .toast-ic { background:var(--info-bg); color:var(--info); }
.toast-msg { font-size:16px; font-weight:600; color:var(--text); }
.toast-sub { font-size:16px; color:var(--text-muted); margin-top:1px; }

/* ===================== APP SHELL ===================== */
.app { display:flex; height:100vh; height:100dvh; overflow:hidden; }
.sidebar { width:var(--sidebar-w); flex-shrink:0; background:var(--sidebar-grad); border-right:1px solid var(--sidebar-border); display:flex; flex-direction:column; transition:width var(--t-slow) var(--ease), transform var(--t-slow) var(--ease); z-index:40; }
.sidebar-head { height:60px; display:flex; align-items:center; padding:0 18px; border-bottom:1px solid var(--sidebar-border); flex-shrink:0; gap:10px; }
.sidebar-head img.logo-full { height:26px; width:auto; }

/* Sidebar Account Selector (Super Admin) */
.sidebar-account-box {
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  background: rgba(0, 0, 0, 0.14);
}
.sidebar-account-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sidebar-section);
  margin-bottom: 6px;
}
.sidebar-account-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.sidebar-account-select-wrap .ic-acc {
  position: absolute;
  left: 9px;
  width: 14px;
  height: 14px;
  color: var(--sidebar-text);
  pointer-events: none;
}
.sidebar-account-select-wrap .ic-arrow {
  position: absolute;
  right: 9px;
  width: 13px;
  height: 13px;
  color: var(--sidebar-section);
  pointer-events: none;
}
.sidebar-account-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-md);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  padding: 6px 26px 6px 28px;
  cursor: pointer;
  outline: none;
  transition: all var(--t-fast);
}
.sidebar-account-select:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}
.sidebar-account-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(30, 111, 217, 0.35);
}
.sidebar-account-select option {
  background: #0B1E33;
  color: #FFFFFF;
}

.sidebar-account-static {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-md);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  padding: 6px 10px;
  min-height: 31px;
  box-sizing: border-box;
  user-select: none;
}
.sidebar-account-static .ic-acc {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--sidebar-text);
}
.sidebar-account-static-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav { flex:1; overflow-y:auto; padding:14px 12px; display:flex; flex-direction:column; gap:2px; }
.nav-section { font-size:16px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; color:var(--sidebar-text-active); padding:14px 10px 6px; }
.nav-item { display:flex; align-items:center; gap:11px; padding:9px 11px; border-radius:var(--r-md); color:var(--sidebar-text); font-size:15px; font-weight:600; cursor:pointer; position:relative; transition:background var(--t-fast), color var(--t-fast); border:none; background:transparent; width:100%; text-align:left; }
.nav-item .ic { width:18px; height:18px; flex-shrink:0; }
.nav-item:hover { background:var(--sidebar-hover); color:var(--sidebar-text-active); }
.nav-item.active { background:var(--sidebar-active-bg); color:var(--sidebar-text-active); }
.nav-item.active::before { content:""; position:absolute; left:-12px; top:50%; transform:translateY(-50%); width:3px; height:20px; border-radius:0 3px 3px 0; background:var(--accent); }
.nav-item .nav-count { margin-left:auto; font-size:15px; font-weight:600; font-family:var(--font-mono); color:var(--sidebar-section); background:rgba(255,255,255,.07); padding:1px 7px; border-radius:9999px; }
.nav-item.active .nav-count { color:var(--sidebar-text-active); }
.sidebar-foot { padding:12px; border-top:1px solid var(--sidebar-border); flex-shrink:0; }
.sb-user { display:flex; align-items:center; gap:10px; padding:8px 9px; border-radius:var(--r-md); }
.sb-user .meta { min-width:0; }
.sb-user .nm { font-size:16px; font-weight:700; color:var(--sidebar-text-active); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sb-user .rl { font-size:16px; color:var(--sidebar-section); }

.main { flex:1; display:flex; flex-direction:column; min-width:0; overflow:hidden; }
.topbar { position: sticky; top: 0; z-index: 30; height:60px; flex-shrink:0; display:flex; align-items:center; gap:12px; padding:0 22px; background:var(--surface); border-bottom:1px solid var(--border); }
.topbar .spacer { flex:1; }
.topbar-burger { display:none; }
@keyframes menuIn { from{opacity:0; transform:translateY(-6px);} to{opacity:1; transform:none;} }

/* menu (generic dropdown) */
.menu { position:absolute; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); box-shadow:var(--shadow-lg); z-index:55; padding:5px; min-width:170px; }
.menu-item { display:flex; align-items:center; gap:9px; padding:8px 10px; border-radius:var(--r-sm); font-size:16px; color:var(--text-soft); cursor:pointer; font-weight:500; }
.menu-item .ic { width:15px; height:15px; }
.menu-item:hover { background:var(--surface-2); color:var(--text); }
.menu-item.danger { color:var(--bad); }
.menu-item.danger:hover { background:var(--bad-bg); }

/* ===================== PAGE LAYOUT ===================== */
.page { flex:1; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.page-inner { max-width:1320px; margin:0 auto; padding:26px 30px 60px; }
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
.page-title { font-size:18px; font-weight:800; letter-spacing:-.02em; line-height:1.15; }
.page-desc { font-size:16px; color:var(--text-muted); margin-top:5px; max-width:560px; }
.section-title { font-size:16px; font-weight:700; margin-bottom:12px; display:flex; align-items:center; gap:8px; }

/* theme toggle */
.theme-toggle { display:inline-flex; background:var(--surface-2); border:1px solid var(--border); border-radius:9999px; padding:3px; gap:2px; }
.theme-toggle button { width:30px; height:26px; border:none; background:transparent; border-radius:9999px; color:var(--text-muted); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; transition:all var(--t-normal); }
.theme-toggle button .ic { width:15px; height:15px; }
.theme-toggle button.active { background:var(--surface); color:var(--accent); box-shadow:var(--shadow-xs); }

/* ===================== LOGIN ===================== */
.login-stage { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; background:var(--app-bg); position:relative; overflow:hidden; }
.app-loading-spinner { width:24px; height:24px; border:2px solid var(--border-strong); border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite; }
.login-bg { position:absolute; inset:0; background:var(--sidebar-grad); }
.login-bg::after { content:""; position:absolute; inset:0; background:radial-gradient(circle at 22% 18%, rgba(79,143,224,.28), transparent 48%), radial-gradient(circle at 82% 88%, rgba(30,111,217,.22), transparent 52%); }
.login-card { position:relative; width:100%; max-width:404px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-xl); box-shadow:var(--shadow-lg); padding:34px 32px 30px; z-index:1; }
@media (prefers-reduced-motion: no-preference) { .login-card { animation:modalIn var(--t-slow) var(--ease); } }
.login-mark { width:50px; height:50px; border-radius:13px; box-shadow:var(--shadow-sm); display:block; margin-bottom:18px; }
.login-title { font-size:18px; font-weight:800; letter-spacing:-.02em; }
.login-sub { font-size:16px; color:var(--text-muted); margin-top:6px; margin-bottom:24px; }
.login-form { display:flex; flex-direction:column; gap:15px; }
.login-err { display:flex; align-items:center; gap:9px; font-size:16px; font-weight:600; color:var(--bad); background:var(--bad-bg); border:1px solid color-mix(in srgb, var(--bad) 24%, transparent); padding:10px 13px; border-radius:var(--r-md); animation:shake .35s var(--ease); }
@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-5px);} 75%{transform:translateX(5px);} }
.login-theme { position:absolute; top:22px; right:22px; z-index:2; }

/* password input affordance */
.input-affix { position:relative; }
.input-affix .input { padding-right:40px; }

/* responsive */
.scrim { display:none; }
@media (max-width:1080px) {
}
@media (max-width:860px) {
  .sidebar { position:fixed; top:0; bottom:0; left:0; transform:translateX(-100%); box-shadow:var(--shadow-lg); }
  .sidebar.open { transform:translateX(0); }
  .scrim.show { display:block; position:fixed; inset:0; background:var(--overlay); z-index:35; }
  .topbar-burger { display:inline-flex; }
  .page-inner { padding:20px 18px 50px; }
}
@media (max-width:560px) {
  .form-grid, .view-grid { grid-template-columns:1fr; }
  .view-grid { gap:12px; }
  .toolbar .search { flex-basis:100%; order:5; }

  .overlay { top:60px; bottom:env(safe-area-inset-bottom); padding:16px 12px; }
  .modal { max-width:100% !important; max-height:calc(100dvh - 92px - env(safe-area-inset-bottom)) !important; }
  .modal-body { padding:16px 14px; }
  .modal-foot { padding:12px 14px; }
  .modal-head { padding:16px 14px 12px; }
  .modal-title { word-break:break-word; }
  .modal-sub { word-break:break-all; }

  .view-sub-head { flex-direction:column; align-items:flex-start; gap:8px; width:100%; }
  .view-sub-head .segmented { width:100%; display:flex; }
  .view-sub-head .segmented button { flex:1; text-align:center; padding:6px 4px; font-size:16px; }
}
.hide-sm { }
@media (max-width:720px){ .hide-sm { display:none !important; } }

/* utility */
.flex { display:flex; }
.items-center { align-items:center; }
.gap-2 { gap:8px; }

/* -------------------------- Account billing terms ------------------------ */
.billing-terms-status,
.billing-terms-alert {
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  max-width:1040px; padding:14px 16px; border:1px solid var(--border);
  border-radius:var(--r-md); background:var(--surface); color:var(--text-soft);
}
.billing-terms-alert { border-color:color-mix(in srgb, var(--bad) 28%, var(--border)); background:var(--bad-bg); color:var(--text); }
.billing-terms-scheduled {
  margin:16px 26px 0; padding:12px 14px; border:1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius:var(--r-md); background:var(--accent-soft); color:var(--text-soft); font-size:16px; line-height:1.5;
}
.billing-terms-scheduled strong { color:var(--text); }
.billing-terms-panel {
  max-width:1040px; background:var(--surface); border:1px solid var(--border);
  border-left:3px solid var(--accent); border-radius:var(--r-lg); box-shadow:var(--shadow-xs);
  overflow:hidden;
}
.billing-terms-panel-head {
  display:flex; align-items:flex-start; justify-content:space-between; gap:24px;
  padding:23px 26px 19px; border-bottom:1px solid var(--border-soft);
}
.billing-terms-panel-head h2 { margin:0; font-size:16px; line-height:1.35; font-weight:700; color:var(--text); }
.billing-terms-panel-head p { margin:5px 0 0; color:var(--text-muted); font-size:16px; }
.billing-cycle-badge {
  display:inline-flex; align-items:center; gap:7px; white-space:nowrap;
  padding:7px 10px; color:var(--accent-strong); background:var(--accent-soft);
  border-radius:var(--r-full); font-size:16px; font-weight:700;
}
.billing-cycle-badge .ic { width:14px; height:14px; }
.billing-currency-row {
  display:flex; align-items:flex-end; justify-content:space-between; gap:20px;
  padding:20px 26px 16px;
}
.billing-currency-row .field { width:190px; }
.billing-started { padding-bottom:8px; color:var(--text-muted); font-size:16px; }
.billing-started strong { color:var(--text-soft); font-weight:600; }
.billing-terms-table-wrap { overflow-x:auto; padding:0 26px; }
.billing-terms-table { width:100%; min-width:650px; border-collapse:collapse; }
.billing-terms-table th,
.billing-terms-table td { padding:13px 12px; border-top:1px solid var(--border-soft); text-align:left; }
.billing-terms-table thead th {
  color:var(--text-faint); font-size:16px; font-weight:700; letter-spacing:.035em;
  text-transform:uppercase; padding-top:12px; padding-bottom:11px;
}
.billing-terms-table th:first-child,
.billing-terms-table td:first-child { padding-left:0; }
.billing-terms-table th:last-child,
.billing-terms-table td:last-child { padding-right:0; }
.billing-terms-table tbody th { width:34%; font-weight:400; }
.billing-service-name { display:block; color:var(--text); font-size:16px; font-weight:700; }
.billing-service-note { display:block; margin-top:2px; color:var(--text-faint); font-size:16px; font-weight:400; }
.billing-terms-table .input { min-width:128px; }
.billing-rate-field { display:flex; align-items:center; gap:8px; }
.billing-currency-code { min-width:30px; color:var(--text-muted); font-size:16px; font-weight:700; }
.billing-rate-unit { color:var(--text-faint); font-size:16px; white-space:nowrap; }
.billing-terms-footer {
  display:flex; align-items:center; justify-content:space-between; gap:20px;
  margin:4px 26px 0; padding:16px 0 20px; border-top:1px solid var(--border-soft);
}
.billing-terms-footnote { max-width:590px; color:var(--text-faint); font-size:16px; line-height:1.5; }
.billing-usage-panel {
  max-width:1040px; margin-top:18px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--r-lg); box-shadow:var(--shadow-xs); overflow:hidden;
}
.billing-usage-head {
  display:flex; align-items:flex-start; justify-content:space-between; gap:24px;
  padding:22px 26px 18px; border-bottom:1px solid var(--border-soft);
}
.billing-usage-head h2 { margin:0; font-size:16px; line-height:1.35; font-weight:700; color:var(--text); }
.billing-usage-head p { margin:5px 0 0; color:var(--text-muted); font-size:16px; }
.billing-usage-updated { color:var(--text-faint); font-size:16px; white-space:nowrap; }
.billing-usage-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding:20px 26px; }
.billing-usage-item { display:flex; flex-direction:column; gap:7px; padding:15px; border:1px solid var(--border-soft); border-radius:var(--r-md); background:var(--surface-subtle,var(--surface)); }
.billing-usage-label { color:var(--text-muted); font-size:16px; font-weight:600; }
.billing-usage-item strong { color:var(--text); font-size:18px; font-variant-numeric:tabular-nums; }
.billing-usage-item strong span { color:var(--text-faint); font-size:16px; font-weight:500; }
.billing-usage-item small { color:var(--text-faint); font-size:16px; }
.billing-usage-total { grid-column:1/-1; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 2px 0; border-top:1px solid var(--border-soft); color:var(--text-muted); font-size:16px; }
.billing-usage-total strong { color:var(--text); font-size:16px; font-variant-numeric:tabular-nums; }
.monthly-quota-summary {
  display:flex; flex-direction:column; align-items:flex-start; gap:6px; max-width:1040px;
  margin:-7px 0 16px; padding:12px 16px; border:1px solid var(--border);
  border-radius:var(--r-md); background:var(--surface); color:var(--text-muted);
  font-size:16px; font-variant-numeric:tabular-nums;
}
.monthly-quota-period { color:var(--accent-strong); font-size:18px; font-weight:700; line-height:1.3; text-transform:capitalize; }
.monthly-quota-values { display:flex; align-items:baseline; flex-wrap:wrap; gap:8px; }
.monthly-quota-summary strong { color:var(--text); font-weight:700; }
.monthly-quota-separator { color:var(--text-faint); }
.super-billing-toolbar { display:flex; align-items:flex-end; justify-content:space-between; gap:18px; max-width:1040px; margin:0 0 16px; }
.super-billing-toolbar .field { width:220px; margin:0; }
.super-billing-toolbar > span { padding:0 2px 9px; color:var(--text-faint); font-size:16px; }
.super-billing-list { display:grid; gap:10px; max-width:1040px; }
.super-billing-card { overflow:hidden; border:1px solid var(--border); border-radius:var(--r-md); background:var(--surface); box-shadow:var(--shadow-xs); }
.super-billing-card > summary { display:flex; align-items:center; gap:18px; min-height:74px; padding:14px 18px; cursor:pointer; list-style:none; }
.super-billing-card > summary::-webkit-details-marker { display:none; }
.super-billing-account { display:flex; flex:0 0 220px; flex-direction:column; gap:4px; min-width:0; }
.super-billing-account strong { overflow:hidden; color:var(--text); font-size:16px; text-overflow:ellipsis; white-space:nowrap; }
.super-billing-account small { overflow:hidden; color:var(--text-faint); font-size:16px; text-overflow:ellipsis; white-space:nowrap; }
.super-billing-preview { flex:1; color:var(--text-muted); font-size:16px; font-variant-numeric:tabular-nums; }
.super-billing-chevron { flex:0 0 auto; width:16px; height:16px; color:var(--text-faint); transition:transform .16s ease; }
.super-billing-card[open] .super-billing-chevron { transform:rotate(180deg); }
.super-billing-content { padding:18px; border-top:1px solid var(--border-soft); }
.super-billing-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.super-billing-metric { display:flex; flex-direction:column; gap:7px; min-width:0; padding:14px; border:1px solid var(--border-soft); border-radius:var(--r-md); background:var(--surface-subtle,var(--surface)); }
.super-billing-metric > span { color:var(--text-muted); font-size:16px; font-weight:600; }
.super-billing-metric > strong { color:var(--text); font-size:18px; font-variant-numeric:tabular-nums; }
.super-billing-metric > strong small { color:var(--text-faint); font-size:16px; font-weight:500; }
.super-billing-metric > em { color:var(--text-faint); font-size:16px; font-style:normal; }
.super-billing-extra { margin-top:14px; padding:14px; border:1px solid var(--border-soft); border-radius:var(--r-md); }
.super-billing-extra-head, .super-billing-extra > div:not(.super-billing-extra-head) { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.super-billing-extra-head { margin-bottom:8px; padding-bottom:10px; border-bottom:1px solid var(--border-soft); }
.super-billing-extra-head strong { color:var(--text); font-size:16px; }
.super-billing-extra-head span, .super-billing-extra > div > span { color:var(--text-faint); font-size:16px; }
.super-billing-extra > div:not(.super-billing-extra-head) { padding:6px 0; }
.super-billing-extra > div > strong { color:var(--text-soft); font-size:16px; font-variant-numeric:tabular-nums; }
.super-billing-extra .super-billing-extra-total { margin-top:5px; padding-top:11px !important; border-top:1px solid var(--border-soft); }
.super-billing-extra-total > span { color:var(--text) !important; font-weight:700; }
.super-billing-extra-total > strong { color:var(--text) !important; font-size:16px !important; }
.super-billing-empty { padding:18px; border-top:1px solid var(--border-soft); color:var(--text-faint); font-size:16px; }
@media (max-width:720px) {
  .billing-terms-panel-head { flex-direction:column; gap:12px; padding:20px 18px 16px; }
  .billing-currency-row { padding:18px 18px 14px; }
  .billing-terms-table-wrap { padding:0 18px; }
  .billing-terms-footer { align-items:flex-start; flex-direction:column; margin:4px 18px 0; }
  .billing-terms-scheduled { margin:14px 18px 0; }
  .billing-usage-head { flex-direction:column; gap:8px; padding:20px 18px 16px; }
  .billing-usage-grid { grid-template-columns:1fr; padding:16px 18px; }
  .billing-usage-total { grid-column:1; }
  .monthly-quota-summary { align-items:flex-start; flex-direction:column; gap:6px; margin:-7px 0 14px; }
  .super-billing-card > summary { align-items:flex-start; gap:8px; padding:14px; }
  .super-billing-account { flex-basis:auto; flex:1; }
  .super-billing-preview { display:none; }
  .super-billing-metrics { grid-template-columns:1fr; }
  .super-billing-content { padding:14px; }
}
@media (max-width:480px) {
  .billing-terms-panel-head p { max-width:290px; }
  .billing-cycle-badge { white-space:normal; }
  .billing-currency-row { align-items:flex-start; flex-direction:column; gap:6px; }
  .billing-currency-row .field { width:100%; max-width:220px; }
}
.spin { animation:spin 1s linear infinite; }
@keyframes spin { to{transform:rotate(360deg);} }

/* Keep table body text uniform while preserving the existing column headers. */
#root table tbody th,
#root table tbody td,
#root table tbody th *,
#root table tbody td * {
  font-size:15px !important;
  font-weight:400 !important;
}

/* entrance animations — gated so paused/reduced-motion/print show resting state */
@media (prefers-reduced-motion: no-preference) {
  .overlay { animation:fadeIn var(--t-normal) var(--ease); }
  .modal { animation:modalIn var(--t-slow) var(--ease); }
  .gus-menu { animation:menuIn var(--t-normal) var(--ease); }
  .menu { animation:menuIn var(--t-fast) var(--ease); }
  .toast { animation:toastIn var(--t-slow) var(--ease); }
}

/* Shared date filter calendar, independent of browser-native date popups. */
.lf-date-picker { position: relative; flex: 0 1 160px; min-width: 0; }
.lf-date-picker .lf-date { width: 100%; padding-right: 32px; }
.lf-date-picker .lf-date[aria-invalid="true"] { border-color: var(--danger, #dc5959); }
.lf-calendar-trigger { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--text-muted); padding: 3px; cursor: pointer; display: flex; }
.lf-calendar-trigger .ic { width: 14px; height: 14px; }
.lf-calendar { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; width: 280px; max-width: calc(100vw - 32px); padding: 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: 0 8px 28px #0004; }
.lf-date-picker:last-child .lf-calendar { left: auto; right: 0; }
.lf-calendar-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.lf-calendar button { font-family: var(--font-sans); color: var(--text); background: transparent; border: 0; border-radius: 5px; cursor: pointer; }
.lf-calendar-heading button { width: 32px; height: 32px; font-size: 24px; }
.lf-calendar-heading strong { font-size: 15px; }
.lf-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.lf-calendar-grid span { font-size: 12px; color: var(--text-muted); padding: 5px 0; }
.lf-calendar-grid button { height: 32px; font-size: 14px; }
.lf-calendar button:hover { background: var(--surface-hover, #8882); }
.lf-calendar-grid button.is-selected { background: var(--accent, #2171df); color: white; }
.lf-calendar button:disabled { opacity: .3; cursor: default; }
.lf-calendar-clear { display: block; margin: 8px auto 0; padding: 6px 12px; font-size: 13px; }
