/* ==========================================================================
   TrendLoom Biometric — License Management & Client Portal
   Design System: Daylight Workspace (Light-Only Architectural UI)
   Two-tier top navigation · Bento telemetry · Split-pane views · No dark mode
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  color-scheme: light;

  /* Core Daylight Surfaces */
  --bg: #F6F7FA;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --surface-3: #F1F5F9;
  --surface-tint: #EFF6FF;

  /* Borders & Hairlines */
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --border-subtle: #EEF1F6;

  /* Typography Ink (never used as dark container backgrounds) */
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --muted-2: #98A2B3;

  /* Brand & Accent Colors */
  --blue: #1D4ED8;
  --royal: #1E40AF;
  --blue-bright: #2563EB;
  --sky: #3B82F6;
  --teal: #0D9488;
  --teal-soft: #F0FDFA;

  /* Semantic Status Tokens (Light-Only) */
  --ok: #16A34A;
  --ok-soft: #ECFDF3;
  --ok-text: #15803D;
  --ok-border: #ABEFC6;

  --warn: #D97706;
  --warn-soft: #FFFAEB;
  --warn-text: #B45309;
  --warn-border: #FEDF89;

  --bad: #DC2626;
  --bad-soft: #FEF3F2;
  --bad-text: #B42318;
  --bad-border: #FECDCA;

  --info: #2563EB;
  --info-soft: #EFF6FF;
  --info-text: #1D4ED8;
  --info-border: #BFDBFE;

  /* Subtle Daylight Elevation */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.03);
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.06), 0 2px 6px rgba(16, 24, 40, 0.03);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, 0.10), 0 4px 12px rgba(16, 24, 40, 0.04);
  --glow: 0 2px 10px rgba(29, 78, 216, 0.16);

  /* Radii */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  /* Shell Dimensions */
  --header-h: 58px;
  --dock-h: 52px;
  --max-width: 1840px;

  --transition: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- Base & Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); color: var(--text); }
html, body { min-height: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.skip-link {
  position: fixed;
  top: -64px;
  left: 16px;
  z-index: 600;
  background: var(--blue);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.skip-link:focus { top: 12px; }

.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Inline SVG Icons ---------- */
.icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: -0.15em;
  pointer-events: none;
}
.icon-lg { width: 18px; height: 18px; }
.icon path, .icon circle, .icon rect, .icon line, .icon polyline, .icon polygon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-lg path, .icon-lg circle, .icon-lg rect, .icon-lg line, .icon-lg polyline {
  stroke-width: 1.9;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap;
}

/* =========================================================================
   SPLIT-PANE DAYLIGHT AUTH GATE
   ========================================================================= */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background-color: var(--bg);
  background-image: radial-gradient(#D5DCE6 1px, transparent 1px);
  background-size: 22px 22px;
}

.gate-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.gate-showcase {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 40px 36px;
  background: linear-gradient(155deg, #EFF6FF 0%, #F8FAFC 58%, #F0FDFA 100%);
  border-right: 1px solid var(--border);
}

.gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gate-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--blue-bright), var(--blue));
  color: #FFFFFF;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.3px;
  box-shadow: var(--glow);
}

.gate-brand-name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.gate-brand-tagline { font-size: 12.5px; color: var(--muted); }

.gate-hero-copy h1 {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 14px 0 10px;
}
.gate-hero-copy p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
}

.gate-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
}
.gate-feature {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(208, 213, 221, 0.7);
  border-radius: var(--r-sm);
}
.gate-feature-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--info-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.gate-feature strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.gate-feature span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.gate-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 38px;
  background: var(--surface);
}

.gate-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 5px;
}
.gate-hint { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }

.gate-error {
  background: var(--bad-soft);
  color: var(--bad-text);
  border: 1px solid var(--bad-border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.gate-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.gate-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  padding-top: 8px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
}
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

/* =========================================================================
   TWO-TIER TOP NAVIGATION APP SHELL (No Left Sidebar on Desktop)
   ========================================================================= */
#appShell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header-spacer { flex: 1; }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}
.brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--blue-bright), var(--blue));
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.3px;
  box-shadow: var(--glow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 700; font-size: 14.5px; letter-spacing: -0.02em; color: var(--text); }
.brand-sub { font-size: 11px; color: var(--muted); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--info-soft);
  color: var(--blue);
  border: 1px solid var(--info-border);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role { font-size: 10.5px; color: var(--muted); text-transform: capitalize; }

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  place-items: center;
}

/* ---------- Tier 2: Horizontal Segmented Navigation Dock ---------- */
.app-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.side-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 8px 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.side-nav::-webkit-scrollbar { display: none; }

.nav-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.nav-group-title {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 700;
  padding: 0 6px 0 2px;
  user-select: none;
}

.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 8px;
  flex-shrink: 0;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.nav-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.nav-btn.active {
  background: var(--info-soft);
  color: var(--blue);
  font-weight: 600;
  border-color: var(--info-border);
  box-shadow: var(--shadow-xs);
}

.sidebar-foot { display: none; }
.sidebar-scrim {
  position: fixed;
  inset: var(--header-h) 0 0;
  background: rgba(16, 24, 40, 0.25);
  z-index: 95;
  backdrop-filter: blur(2px);
}

/* ---------- Centered Main Workspace ---------- */
.main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 28px 64px;
  min-width: 0;
}

.view { display: none; }
.view.active {
  display: block;
  animation: view-in 240ms ease-out;
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.view-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 4px;
}
.view-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--text);
}
.view-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.link-back {
  background: none;
  border: 0;
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 600;
  padding: 0 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.link-back:hover { text-decoration: underline; }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  min-height: 37px;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform 80ms ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-2); color: var(--text); text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #FFFFFF;
  box-shadow: var(--glow);
}
.btn.primary:hover { background: var(--royal); border-color: var(--royal); color: #FFFFFF; }

.btn.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #FFFFFF;
}
.btn.danger:hover { filter: brightness(0.93); color: #FFFFFF; }

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--surface-3); color: var(--text); border-color: transparent; }

.btn.small { padding: 5px 11px; min-height: 31px; font-size: 12px; border-radius: var(--r-xs); }
.btn.icon { width: 34px; height: 34px; padding: 0; min-height: 34px; }
.btn.block { width: 100%; }
.btn.link {
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--blue);
  padding: 2px 6px;
  min-height: 0;
  justify-content: flex-start;
  text-align: left;
  font-weight: 600;
  font-size: 12.5px;
}
.btn.link:hover { background: var(--info-soft); color: var(--royal); }
.btn:disabled, .btn[disabled] { opacity: 0.48; cursor: not-allowed; pointer-events: none; }

/* =========================================================================
   SURFACES, PANELS & BENTO WORKSPACE
   ========================================================================= */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
}
.panel-title { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.panel-sub { font-size: 12px; color: var(--muted); }
.panel-body { padding: 20px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

/* Asymmetric 7:5 Bento Dashboard Grid */
.dash-bento {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 20px;
  align-items: start;
}
.dash-bento-main { display: flex; flex-direction: column; min-width: 0; }
.dash-bento-rail { display: flex; flex-direction: column; min-width: 0; }

/* Hero Welcome Strip (Client & Admin Dashboards) */
.hero-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  margin-bottom: 20px;
  background: linear-gradient(120deg, #FFFFFF 0%, #F4F8FF 65%, #F0FDFA 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}
.hero-strip-copy h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.hero-strip-copy p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.notice {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--info-soft);
  color: var(--text-2);
  border: 1px solid var(--info-border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 18px;
}
.notice .icon { color: var(--blue); flex-shrink: 0; margin-top: 2px; }

/* =========================================================================
   BENTO KPI STAT TILES (Top Accent Hairline, No Left Heavy Bar)
   ========================================================================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--blue);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-tile.tone-ok { border-top-color: var(--ok); }
.stat-tile.tone-warn { border-top-color: var(--warn); }
.stat-tile.tone-bad { border-top-color: var(--bad); }
.stat-tile.tone-info { border-top-color: var(--info); }

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}
.stat-value {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 6px;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
}

/* =========================================================================
   CHARTS & DISTRIBUTION & ACTIVITY TIMELINE RAIL
   ========================================================================= */
.distribution-row {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 1fr 48px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.distribution-row:last-child { border-bottom: 0; }
.distribution-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.distribution-track {
  height: 9px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.distribution-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-bright), var(--teal));
  border-radius: var(--r-pill);
  transition: width 0.35s ease;
}
.distribution-count {
  text-align: right;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.chart-wrap {
  width: 100%;
  height: 210px;
  overflow-x: auto;
  padding-top: 8px;
}
.chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 170px;
  padding-top: 8px;
}
.chart-col {
  flex: 1 0 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 46px;
}
.chart-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
  white-space: nowrap;
}
.chart-track {
  width: 100%;
  height: 122px;
  display: flex;
  align-items: flex-end;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  padding: 2px 2px 0;
}
.chart-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--blue-bright) 0%, var(--blue) 100%);
  border-radius: 5px 5px 0 0;
  min-height: 4px;
  transition: height 0.4s ease, filter 0.2s;
}
.chart-col:hover .chart-bar { filter: brightness(1.08); }
.chart-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  white-space: nowrap;
}

.activity-list {
  display: flex;
  flex-direction: column;
  position: relative;
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.activity-item:first-child { padding-top: 2px; }
.activity-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.activity-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--blue-bright);
  box-shadow: 0 0 0 4px var(--info-soft);
  flex-shrink: 0;
}
.activity-main { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.activity-main strong { color: var(--text); font-weight: 600; }
.activity-time { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

/* =========================================================================
   TOOLBARS & FORM CONTROLS
   ========================================================================= */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.toolbar.wrap { flex-wrap: wrap; }
.toolbar-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

input, select, textarea, .search, .select, .input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--text);
  min-height: 38px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.search { flex: 1 1 220px; max-width: 340px; }
.select { width: auto; min-width: 150px; padding-right: 28px; }
textarea { resize: vertical; min-height: 82px; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }

input:focus, select:focus, textarea:focus, .search:focus, .select:focus, .input:focus {
  outline: none;
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: var(--surface);
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}
.inline-field .input { width: auto; min-height: 34px; padding: 5px 10px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
  min-width: 0;
}
.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.field .help { font-size: 11.5px; color: var(--muted); }
.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--bad-text);
  margin-top: 2px;
}
.field-error-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--bad);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"],
.field input:user-invalid,
.field textarea:user-invalid,
.field select:user-invalid {
  border-color: var(--bad);
  background: var(--bad-soft);
}
.field input[aria-invalid="true"]:focus,
.field textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}
.form-alert {
  background: var(--bad-soft);
  color: var(--bad-text);
  border: 1px solid var(--bad-border);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 4px;
}
.input-readonly-code {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--text-2);
}

/* Searchable Combobox (State / City dropdowns) */
.combobox {
  position: relative;
  width: 100%;
}
.combobox-control {
  position: relative;
  display: flex;
  align-items: center;
}
.combobox-input {
  padding-right: 62px;
}
.combobox-clear,
.combobox-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  padding: 0;
  transition: background var(--transition), color var(--transition);
}
.combobox-toggle { right: 6px; }
.combobox-clear { right: 34px; font-size: 16px; line-height: 1; }
.combobox-clear:hover,
.combobox-toggle:hover {
  background: var(--surface-3);
  color: var(--text);
}
.combobox-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  max-height: 224px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.combobox-menu.open-up {
  top: auto;
  bottom: calc(100% + 4px);
}
.combobox-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  min-height: 36px;
}
.combobox-option:hover,
.combobox-option.active {
  background: var(--info-soft);
  color: var(--blue);
}
.combobox-option[aria-selected="true"] {
  font-weight: 600;
}
.combobox-option-meta {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.combobox-option.active .combobox-option-meta,
.combobox-option:hover .combobox-option-meta {
  color: var(--blue);
}
.combobox-empty {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

@media (pointer: coarse) {
  .combobox-input { min-height: 44px; font-size: max(1rem, 1em); }
  .combobox-clear,
  .combobox-toggle { width: 34px; height: 34px; }
  .combobox-toggle { right: 4px; }
  .combobox-clear { right: 38px; }
  .combobox-input { padding-right: 74px; }
  .combobox-option { min-height: 44px; padding: 10px 12px; }
}

.form-grid { display: grid; gap: 12px 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.two > .span-2 { grid-column: 1 / -1; }

/* Settings Split Anchor Layout */
.settings-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.settings-index {
  position: sticky;
  top: calc(var(--header-h) + var(--dock-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  box-shadow: var(--shadow-xs);
}
.settings-index-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 10px 8px;
}
.settings-index a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--r-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.settings-index a:hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row input {
  accent-color: var(--blue);
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex-shrink: 0;
}
.switch-copy { display: flex; flex-direction: column; min-width: 0; }
.switch-copy strong { font-size: 13px; font-weight: 600; color: var(--text); }
.switch-copy small { font-size: 12px; color: var(--muted); }
.settings-form .panel-body.form-grid.two { padding-bottom: 6px; }

/* =========================================================================
   MODULE CARDS (Package & Licence Forms)
   ========================================================================= */
.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.module-title { display: flex; align-items: center; gap: 9px; }
.module-title h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 700;
}
.module-count {
  background: var(--info-soft);
  color: var(--blue);
  border: 1px solid var(--info-border);
  border-radius: var(--r-pill);
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 700;
}

.check-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.module-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.module-card:hover { border-color: var(--blue-bright); background: var(--surface-2); }
.module-card:has(input:checked) { border-color: var(--blue); background: var(--info-soft); }

.module-left { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.module-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.module-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.module-info { min-width: 0; }
.module-name { font-weight: 600; color: var(--text); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-desc { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-checkbox { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 2; }
.module-box {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.module-box-check {
  display: none;
  width: 12px;
  height: 12px;
  stroke: #FFFFFF;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.module-checkbox:checked ~ .module-box { background: var(--blue); border-color: var(--blue); }
.module-checkbox:checked ~ .module-box .module-box-check { display: block; }
input:read-only, textarea:read-only {
  background: var(--surface-2);
  color: var(--text-2);
  cursor: default;
}
.module-card:has(input:disabled) {
  opacity: 0.78;
  cursor: not-allowed;
}
.module-card:has(input:disabled):hover {
  border-color: var(--border-strong);
  background: var(--surface);
}
.module-card:has(input:checked:disabled):hover {
  border-color: var(--blue);
  background: var(--info-soft);
}

/* =========================================================================
   TABLES & EMPTY / LOADING STATES
   ========================================================================= */
.table-host { min-height: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-2);
  vertical-align: middle;
}
.data-table tbody tr { transition: background 120ms ease; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td .mono, .data-table td .pill { white-space: nowrap; }
.data-table td.actions, .data-table th.actions { width: 1%; white-space: nowrap; text-align: right; }

.row-title { font-weight: 600; color: var(--text); }
.row-sub { font-size: 11.5px; color: var(--muted); }
.cell-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.cell-stack .btn.link {
  padding: 0;
  font-size: 13px;
  line-height: 1.4;
}
.cell-stack .btn.link:hover { background: none; text-decoration: underline; }
.cell-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.cell-actions .btn.small {
  padding: 5px 10px;
  min-height: 30px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.cell-actions .btn.small.ghost {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-2);
}
.cell-actions .btn.small.ghost:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
}
.cell-actions [data-delete-client]:hover,
.cell-actions [data-delete-package]:hover,
.cell-actions [data-lic-act="revoke"]:hover,
.cell-actions [data-deactivate]:hover {
  background: var(--bad-soft);
  border-color: var(--bad-border);
  color: var(--bad-text);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 46px 24px;
  color: var(--muted);
}
.empty .icon, .empty-icon { font-size: 26px; color: var(--muted-2); opacity: 0.65; }
.empty p { font-size: 13.5px; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 42px 24px;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   PILLS, CHIPS & KEYS
   ========================================================================= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-pill);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
  border: 1px solid var(--border);
  text-transform: capitalize;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill.ok { background: var(--ok-soft); color: var(--ok-text); border-color: var(--ok-border); }
.pill.warn { background: var(--warn-soft); color: var(--warn-text); border-color: var(--warn-border); }
.pill.bad { background: var(--bad-soft); color: var(--bad-text); border-color: var(--bad-border); }
.pill.info { background: var(--info-soft); color: var(--info-text); border-color: var(--info-border); }
.pill.muted { background: var(--surface-3); color: var(--muted); border-color: var(--border); }

.chip {
  display: inline-block;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  margin: 2px 4px 2px 0;
}

.key-value {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 3px 8px;
  color: var(--text);
}

/* =========================================================================
   PROFILE & PACKAGE GRIDS
   ========================================================================= */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(290px, 360px) 1fr;
  gap: 20px;
  align-items: start;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}
.package-grid .panel { margin-bottom: 0; }

.kv {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px 14px;
  font-size: 13px;
}
.kv dt { color: var(--muted); font-size: 12px; font-weight: 500; }
.kv dd { margin: 0; color: var(--text); font-weight: 500; word-break: break-word; }

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}
.preset-pill {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.preset-pill:hover {
  border-color: var(--blue-bright);
  background: var(--info-soft);
  color: var(--blue);
}
.preset-pill.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #FFFFFF;
}
.package-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-2);
}
.package-preview strong { color: var(--text); }

/* =========================================================================
   SEGMENTED REPORT TABS
   ========================================================================= */
.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}
.tab {
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.tab:hover { background: var(--surface-3); color: var(--text); }
.tab.active {
  background: var(--info-soft);
  color: var(--blue);
  border-color: var(--info-border);
}

/* =========================================================================
   MODALS & SLIDE-OVER INSPECTOR DRAWER
   ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 40, 0.24);
  backdrop-filter: blur(3px);
  padding: 20px;
  animation: fade-in 150ms ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(600px, 95%);
  max-height: min(88vh, 840px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 180ms ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.modal.wide { width: min(960px, 95%); }
.modal.drawer {
  width: min(660px, 96%);
  margin-left: auto;
  height: 100%;
  max-height: 100vh;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  border-right: 0;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.modal-title { font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.modal-body { flex: 1 1 auto; min-height: 0; padding: 20px 22px; overflow-y: auto; background: var(--surface); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.modal-copy { color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.modal-close { font-size: 20px; line-height: 1; }
.modal-subhead {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 700;
  margin: 20px 0 10px;
  display: block;
}
.modal-subhead:first-child { margin-top: 0; }

.warning-box {
  background: var(--warn-soft);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.key-display {
  font-family: var(--font-mono);
  font-size: 15.5px;
  letter-spacing: 0.8px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px dashed var(--info-border);
  border-radius: var(--r-sm);
  padding: 16px;
  text-align: center;
  word-break: break-all;
  user-select: all;
  color: var(--text);
}
.drawer-section { margin-bottom: 24px; }

/* =========================================================================
   TOASTS
   ========================================================================= */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(400px, calc(100vw - 40px));
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--blue);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  animation: toast-in 200ms ease-out;
  cursor: pointer;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }

/* =========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================= */
@media (max-width: 1080px) {
  .dash-bento { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-index { position: static; flex-direction: row; flex-wrap: wrap; }
  .settings-index-title { width: 100%; padding-bottom: 2px; }
}

@media (max-width: 900px) {
  .gate-shell { grid-template-columns: 1fr; max-width: 480px; }
  .gate-showcase { display: none; }
  .gate-card { padding: 32px 26px; }

  .header-inner { padding: 0 16px; }
  .menu-toggle { display: inline-grid; }

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: 0;
    width: 272px;
    z-index: 120;
    background: var(--surface);
    border-right: 1px solid var(--border);
    border-bottom: 0;
    transform: translateX(-104%);
    transition: transform 200ms ease;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }

  .side-nav {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 12px 28px;
    gap: 4px;
  }
  .nav-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
  }
  .nav-group-title { padding: 12px 10px 4px; }
  .nav-divider { display: none; }
  .nav-btn { border-radius: var(--r-sm); padding: 9px 12px; }

  .main { padding: 20px 16px 48px; }
  .profile-grid, .grid-2, .grid-3, .form-grid.two, .check-group { grid-template-columns: 1fr; }
  .brand-sub, .user-meta { display: none; }
  .user-chip { padding: 3px; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 24px; }
  .package-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   BILLING, INVOICE BUILDER, INVOICE SHEET & PRINT STYLES
   ========================================================================= */
.billing-client-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-2);
}
.billing-client-card strong { color: var(--text); display: block; font-size: 13px; }
.billing-client-card span { display: block; color: var(--muted); font-size: 12px; }

.invoice-items-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow-x: auto;
  background: var(--surface);
}
.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.invoice-items-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.invoice-items-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.invoice-items-table tbody tr:last-child td { border-bottom: 0; }
.invoice-items-table input { min-height: 34px; padding: 6px 8px; font-size: 13px; }
.invoice-items-table .num-col { width: 92px; }
.invoice-items-table .gst-col { width: 78px; }
.invoice-items-table .calc-col { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; width: 104px; padding-right: 10px; }
.invoice-items-table .act-col { width: 40px; text-align: center; }

.invoice-items-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.invoice-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px;
}
.invoice-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--blue);
  margin-bottom: 18px;
}
.invoice-sheet-brand { font-size: 18px; font-weight: 700; color: var(--blue); letter-spacing: -0.02em; }
.invoice-sheet-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.invoice-sheet-meta { text-align: right; }
.invoice-sheet-num { font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--text); }
.invoice-sheet-badges { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }

.invoice-sheet-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
.invoice-sheet-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  font-size: 12.5px;
}
.invoice-sheet-box h4 {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}
.invoice-totals-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}
.invoice-totals-card {
  width: min(320px, 100%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}
.invoice-total-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.invoice-total-line.grand {
  border-top: 1px solid var(--border-strong);
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}
.invoice-total-line.balance {
  color: var(--blue);
  font-weight: 700;
}

@media (max-width: 720px) {
  .invoice-sheet-grid { grid-template-columns: 1fr; }
  .invoice-sheet-meta { text-align: left; }
  .invoice-sheet-badges { justify-content: flex-start; }
}

@media print {
  body { background: #FFFFFF !important; }
  .app-header,
  .sidebar,
  .sidebar-scrim,
  #main,
  #toasts,
  .modal-head,
  .modal-foot,
  .no-print {
    display: none !important;
  }
  .modal-backdrop {
    position: static !important;
    background: #FFFFFF !important;
    padding: 0 !important;
    backdrop-filter: none !important;
    display: block !important;
  }
  .modal,
  .modal.wide {
    width: 100% !important;
    max-height: none !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
  }
  .modal-body {
    padding: 0 !important;
    overflow: visible !important;
  }
  .invoice-sheet {
    border: 0 !important;
    padding: 0 !important;
  }
}
