/* Leave Desk — Editorial HR Operations Ledger Design System */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --ink: #0f172a;
  --ink-2: #334155;
  --ink-muted: #64748b;

  --teal: #0f766e;
  --teal-hover: #0d625b;
  --teal-soft: #f0fdfa;
  --teal-border: #99f6e4;

  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --blue-border: #bfdbfe;

  --amber: #c2410c;
  --amber-bright: #d97706;
  --amber-soft: #fff4eb;
  --amber-row: #fff6ee;
  --amber-border: #fed7aa;

  --red: #b91c1c;
  --red-soft: #fef2f2;
  --red-border: #fecaca;

  --emerald: #047857;
  --emerald-soft: #ecfdf5;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.06);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--ink-muted); }
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* =====================================================================
   Auth & Setup Wizard Screens
   ===================================================================== */
.auth-body {
  min-height: 100vh;
  background: radial-gradient(circle at 18% 12%, #e6f4f1 0%, transparent 42%),
              radial-gradient(circle at 86% 88%, #eff6ff 0%, transparent 45%),
              var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.auth-shell { width: 100%; max-width: 420px; }
.install-shell { width: 100%; max-width: 720px; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.brand-lockup h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-lockup p { margin: 2px 0 0; font-size: 13px; }

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--teal);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.28);
}
.brand-mark-sm { width: 32px; height: 32px; border-radius: 8px; font-size: 13px; }

.login-form, .install-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footnote {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}

.install-section {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.install-section h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}
.install-section > p { margin: 0 0 12px; font-size: 13px; }

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

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}
.field .field-hint { font-size: 11.5px; color: var(--ink-muted); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--teal); }

.code-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Alerts */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 14px;
}
.alert-danger { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-border); }
.alert-success { background: var(--emerald-soft); color: var(--emerald); border: 1px solid #a7f3d0; }
.alert-warning { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s, transform 0.08s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 11px 18px; font-size: 14.5px; }

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--teal-hover); }

.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--surface-subtle); border-color: #94a3b8; }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-muted); color: var(--ink); }

.btn-danger-ghost { background: transparent; color: var(--red); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--red-soft); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #991b1b; }

/* =====================================================================
   Topbar Navigation
   ===================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15.5px;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
}

.year-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  padding: 3px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.primary-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  min-width: 0;
}

.tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 17px 10px 15px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.14s, border-color 0.14s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}
.user-name { font-weight: 600; color: var(--ink-2); }
.role-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 999px;
}
.role-badge.role-admin { background: var(--teal-soft); color: var(--teal); }
.role-badge.role-viewer { background: var(--surface-muted); color: var(--ink-muted); }

/* =====================================================================
   Main Layout & Cards
   ===================================================================== */
.main-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

.viewer-banner {
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  color: #1e3a8a;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 13px;
}

.tab-panel { display: none; animation: panelIn 0.16s ease-out; }
.tab-panel.active { display: block; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.page-subtitle {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 13.5px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  display: flex;
  justify-content: flex-end;
}

/* Segmented Toggle */
.segmented {
  display: inline-flex;
  background: var(--surface-muted);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.seg-btn {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.14s;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* =====================================================================
   Dashboard KPI Row, Breakdown & Review Queue
   ===================================================================== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}
.kpi-value.kpi-teal { color: var(--teal); }
.kpi-value.kpi-red { color: var(--red); }
.kpi-meta { font-size: 12.5px; color: var(--ink-muted); }

.dash-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
}

.breakdown-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: 24px;
  padding: 22px 24px;
}

.donut-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-center-val {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.donut-center-lbl {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
}

.breakdown-table { width: 100%; border-collapse: collapse; }
.breakdown-table tr { border-bottom: 1px solid var(--border); }
.breakdown-table tr:last-child { border-bottom: none; }
.breakdown-table td { padding: 11px 4px; font-size: 13.5px; }
.breakdown-table td.num { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.swatch-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 9px;
  vertical-align: middle;
}

.review-list { padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--surface-subtle);
  cursor: pointer;
  transition: background-color 0.14s, border-color 0.14s;
  text-align: left;
  width: 100%;
  font: inherit;
}
.review-item:hover { background: var(--surface-muted); border-color: var(--border); }
.review-item.has-issue {
  background: var(--red-soft);
  border-color: var(--red-border);
}
.review-item.has-issue:hover { background: #fee2e2; }
.review-item-label { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.review-item-count {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}
.review-item.has-issue .review-item-count {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* Monthly Chart */
.chart-legend-inline {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.dot-teal { background: #0f766e; }
.dot-amber { background: #ea580c; }
.dot-blue { background: #2563eb; }
.dot-slate { background: #94a3b8; }

.monthly-chart-wrap { padding: 18px 20px 20px; overflow-x: auto; }
.monthly-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(46px, 1fr));
  gap: 10px;
  align-items: end;
  height: 165px;
  padding-top: 22px;
}
.m-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
}
.m-total {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  min-height: 14px;
}
.m-stack {
  width: 28px;
  border-radius: 5px 5px 2px 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  background: var(--surface-muted);
  min-height: 3px;
  transition: opacity 0.14s;
}
.m-stack:hover { opacity: 0.85; }
.m-seg { width: 100%; }
.m-lbl { font-size: 11.5px; font-weight: 600; color: var(--ink-muted); }

.notes-strip {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.note-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--ink-2);
}
.note-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-top: 4px;
  flex-shrink: 0;
}
.swatch-blue { background: var(--blue); }
.swatch-teal { background: var(--teal); }
.swatch-orange { background: #ea580c; }

/* =====================================================================
   Filter Toolbar & Data Tables
   ===================================================================== */
.toolbar {
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}
.search-box { flex: 1; min-width: 210px; max-width: 310px; }
.search-box input, .toolbar select {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
}
.toolbar select { width: auto; min-width: 140px; }
.toolbar input:focus, .toolbar select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.toolbar-meta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.table-card { overflow: hidden; }
.table-scroll { width: 100%; overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead tr.group-header-row th {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.grp-slate { background: #f1f5f9; color: #475569; }
.grp-blue { background: #eff6ff; color: #1d4ed8; }
.grp-teal { background: #f0fdfa; color: #0f766e; }

.data-table thead tr:last-child th {
  background: var(--surface-subtle);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 700;
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.data-table thead tr:last-child th.num { text-align: right; }
.data-table thead tr:last-child th.col-input {
  background: #f3f8ff;
  color: #1e40af;
}

.data-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr.clickable-row { cursor: pointer; }

/* Former employee orange row (exact Excel visual convention) */
.data-table tbody tr.row-former { background: var(--amber-row); }
.data-table tbody tr.row-former:hover { background: #ffedd5; }

.cell-negative {
  color: var(--red) !important;
  font-weight: 700;
  background: var(--red-soft);
}

.emp-name-cell { display: flex; flex-direction: column; }
.emp-name-primary { font-weight: 600; color: var(--ink); }
.emp-name-sub { font-size: 11.5px; color: var(--ink-muted); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-ok { background: var(--emerald-soft); color: var(--emerald); }
.badge-danger { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-border); }
.badge-amber { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }
.badge-blue { background: var(--blue-soft); color: var(--blue); border: 1px solid var(--blue-border); }
.badge-slate { background: var(--surface-muted); color: var(--ink-2); }
.badge-teal { background: var(--teal-soft); color: var(--teal); border: 1px solid var(--teal-border); }

/* Inline Usage Bar (Excel DataBar equivalent) */
.usage-bar-cell { display: flex; align-items: center; gap: 8px; min-width: 115px; }
.usage-track {
  flex: 1;
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.usage-fill { height: 100%; border-radius: 999px; background: var(--teal); }
.usage-fill.warn { background: var(--amber-bright); }
.usage-fill.over { background: var(--red); }
.usage-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  width: 40px;
  text-align: right;
}

.row-actions { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-muted);
}

/* =====================================================================
   Policy Tab
   ===================================================================== */
.policy-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  align-items: start;
}
.policy-fields { padding: 8px 20px 14px; }
.policy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.policy-row:last-child { border-bottom: none; }
.policy-label { display: flex; flex-direction: column; gap: 2px; }
.policy-label label { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.policy-label .hint { font-size: 12px; color: var(--ink-muted); }
.policy-control { width: 170px; flex-shrink: 0; }
.policy-control input, .policy-control select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--blue-border);
  background: var(--blue-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}
.policy-control select { text-align: left; font-family: var(--font-sans); }
.policy-control input.readonly-input {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--ink-muted);
}
.policy-control input:disabled, .policy-control select:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.policy-info-card { padding: 20px 22px; }
.rule-list {
  margin: 14px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.rule-list code {
  background: var(--surface-muted);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* =====================================================================
   Modal & Drawer
   ===================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.16s ease-out;
}
.modal-dialog.modal-lg { max-width: 780px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-title { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.modal-subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.icon-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.icon-close:hover { background: var(--surface-muted); color: var(--ink); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.live-preview-strip {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.lp-cell { display: flex; flex-direction: column; }
.lp-lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--ink-muted); }
.lp-val { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--ink); }

.emp-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.mini-stat {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.mini-stat-lbl { font-size: 11px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; }
.mini-stat-val { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--ink); margin-top: 2px; }

/* Toasts */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  animation: toastIn 0.18s ease-out;
}
.toast.toast-error { background: var(--red); }
.toast.toast-success { background: #065f46; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   Responsive Breakpoints
   ===================================================================== */
@media (max-width: 1120px) {
  .topbar-inner { flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
}

@media (max-width: 1024px) {
  .dash-grid, .policy-grid { grid-template-columns: 1fr; }
  .notes-strip { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .topbar-inner { padding: 10px 14px; }
  .main-container { padding: 16px 14px 40px; }
  .kpi-row { grid-template-columns: 1fr; }
  .breakdown-layout { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3, .live-preview-strip, .emp-summary-grid { grid-template-columns: 1fr 1fr; }
  .policy-row { flex-direction: column; align-items: stretch; }
  .policy-control { width: 100%; }
}
