/* =====================================================================
   Putra Benefits — HR Budget Tracking
   Design tokens are taken from DESIGN.md (colour + typography only).
   Everything structural is specific to a benefits-ledger dashboard.
   ===================================================================== */

:root {
  /* Colour — DESIGN.md */
  --canvas:      #F0F0FF;
  --surface:     #FFFFFF;
  --surface-soft:#F0FFFF;
  --ink:         #171717;
  --ink-soft:    #3D3D3D;
  --muted:       #737373;
  --muted-canvas:#6B6B6B;   /* AA-safe grey for text on the periwinkle wash */
  --line:        #E6E6E6;
  --line-strong: #D4D4D4;

  --blue:        #3C81F5;
  --blue-strong: #2F6FE0;   /* solid button fill; white text meets AA (4.7) */
  --blue-deep:   #1B4FD8;
  --cyan:        #00D1FF;
  --gradient:    linear-gradient(90deg, #3C81F5 0%, #00D1FF 100%);

  /* Semantic — status + thresholds (derived, harmonised with the palette).
     Text colours are darkened to meet WCAG AA; fills stay vivid. */
  --ok:          #077A5B;
  --ok-bg:       #E4F7F1;
  --danger:      #C1352B;
  --danger-bg:   #FDEBEC;
  --warn:        #E8890C;
  --warn-ink:    #9A5B00;
  --warn-bg:     #FCF1DF;
  --paid:        #5B4FE0;
  --paid-bg:     #ECEBFD;
  --neutral:     #595959;
  --neutral-bg:  #F1F1F1;
  --info-bg:     #EAF2FE;

  /* Geometry */
  --radius:      12px;
  --radius-sm:   8px;
  --radius-pill: 999px;
  --spine-w:     244px;
  --shadow-1:    0 1px 2px rgba(23, 23, 23, .05);
  --shadow-2:    0 1px 0 rgba(23, 23, 23, .04), 0 14px 30px -20px rgba(23, 23, 23, .35);
  --shadow-rail: 0 1px 2px rgba(23, 23, 23, .04), 0 26px 50px -34px rgba(23, 23, 23, .30);

  /* Type */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ------------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: var(--radius-sm); z-index: 60; transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* ----------------------------------------------------------------- shell */
.app { min-height: 100vh; }
.shell {
  display: grid;
  grid-template-columns: var(--spine-w) minmax(0, 1fr);
  min-height: 100vh;
}

.spine {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  gap: 8px;
  padding: 22px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 40;
}
.spine__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 18px;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--gradient);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
  flex: none;
}
.brand-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }

.spine__nav { display: flex; flex-direction: column; gap: 2px; }
.navlink {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14.5px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.navlink svg { flex: none; opacity: .85; }
.navlink:hover { background: var(--canvas); color: var(--ink); }
.navlink.is-active {
  background: var(--canvas);
  color: var(--blue-deep);
  border-left-color: var(--blue);
  font-weight: 600;
}

.spine__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; }
.who__avatar {
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  background: var(--canvas); color: var(--blue-deep);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
}
.who__meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who__name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who__role { font-size: 12px; color: var(--muted); }
.signout {
  display: block; padding: 8px 12px; font-size: 13.5px; color: var(--muted);
  border-radius: var(--radius-sm);
}
.signout:hover { background: var(--canvas); color: var(--ink); }

.canvas { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px clamp(16px, 3vw, 40px);
  background: rgba(240, 240, 255, .82);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.topbar__side { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.year-chip {
  font-size: 12.5px; font-weight: 600; color: var(--blue-deep);
  background: var(--info-bg); padding: 4px 11px; border-radius: var(--radius-pill);
}
.burger {
  display: none; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 7px; cursor: pointer;
}

.content {
  flex: 1;
  padding: clamp(20px, 3vw, 40px);
  display: flex; flex-direction: column; gap: 26px;
  max-width: 1280px; width: 100%;
}
.footnote {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px;
  padding: 18px clamp(16px, 3vw, 40px) 30px;
  color: var(--muted-canvas); font-size: 12.5px;
}

/* --------------------------------------------------------- page heading */
.page-lead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-lead h2 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: -.02em; }
.page-lead p { color: var(--muted-canvas); margin-top: 4px; max-width: 62ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =====================================================================
   SIGNATURE ELEMENT — the statement rule.
   The dashboard is a statement of the fund: the consumed share carries
   the gradient (data, not decoration) and HR's warning thresholds sit as
   notches on the rule. This is the only elevated object on the page.
   ===================================================================== */
.rail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 2.6vw, 30px) clamp(20px, 3vw, 36px);
  box-shadow: var(--shadow-rail);
}
.rail__head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.rail__title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.rail__fiscal { display: flex; flex-direction: column; text-align: right; line-height: 1.4; }
.rail__fiscal b { font-size: 13px; font-weight: 600; color: var(--ink); }
.rail__fiscal span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.rail__meter {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: center; gap: clamp(18px, 3.2vw, 42px); margin-top: 20px;
}
.rail__figure { display: flex; flex-direction: column; align-items: flex-start; min-width: 108px; }
.rail__pct {
  font-size: clamp(30px, 4.6vw, 48px); font-weight: 700;
  letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums;
}
.rail__pct span { font-size: .46em; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 1px; }
.rail__state {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 9px;
  font-size: 12.5px; font-weight: 600;
}
.rail__state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.rail__track {
  position: relative; height: 40px;
  background: var(--canvas);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  overflow: hidden;
}
.rail__fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--gradient);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  transform-origin: left center;
  animation: rail-fill 900ms cubic-bezier(.2,.7,.2,1) both;
}
.rail__tick {
  position: absolute; top: 0; bottom: 0; width: 0;
  border-left: 1px dashed rgba(23,23,23,.35);
}
.rail__tick i {
  position: absolute; top: 5px; left: 4px;
  font-style: normal; font-size: 10.5px; font-weight: 600;
  color: rgba(23,23,23,.5); font-variant-numeric: tabular-nums;
}

.rail__ledger {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 22px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line);
}
.rail__ledger > div { display: flex; flex-direction: column; gap: 4px; }
.rail__ledger > div + div { border-left: 1px solid var(--line); padding-left: clamp(14px, 2vw, 22px); }
.rail__ledger dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.rail__ledger dd { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

@keyframes rail-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* threshold colour cues on the state line */
.rail[data-level="ok"] .rail__state      { color: var(--blue-deep); }
.rail[data-level="watch"] .rail__state   { color: var(--blue-deep); }
.rail[data-level="caution"] .rail__state { color: var(--warn-ink); }
.rail[data-level="warning"] .rail__state { color: var(--warn-ink); }
.rail[data-level="over"] .rail__state    { color: var(--danger); }

/* ------------------------------------------------ slim inline usage bar */
.meter { display: inline-flex; align-items: center; gap: 10px; min-width: 150px; }
.meter__track {
  position: relative; flex: 1; height: 7px; min-width: 70px;
  background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius-pill);
  overflow: hidden;
}
.meter__fill { position: absolute; inset: 0 auto 0 0; background: var(--gradient); border-radius: var(--radius-pill); }
.meter__pct { font-size: 12.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.meter[data-level="caution"] .meter__fill { background: var(--warn); }
.meter[data-level="warning"] .meter__fill { background: var(--warn); }
.meter[data-level="over"] .meter__fill { background: var(--danger); }
.meter--open .meter__fill { background: var(--line-strong); }

/* ----------------------------------------------------------------- cards */
.grid-funds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.fund {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px;
}
.fund__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fund__name { font-size: 15px; font-weight: 700; }
.fund__cap { font-size: 12px; color: var(--muted); }
.fund__num { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 12px 0 10px; font-variant-numeric: tabular-nums; }
.fund__num small { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.fund .meter { width: 100%; min-width: 0; }
.fund__note { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.fund__note .fund__level { font-weight: 600; }

/* ----------------------------------------------------------------- panel */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.panel__head h3 { font-size: 15.5px; font-weight: 700; }
.panel__head p { font-size: 12.5px; color: var(--muted); }
.panel__body { padding: 4px 20px 8px; }
.panel__foot { padding: 14px 20px; border-top: 1px solid var(--line); }
.panel__more { font-size: 13.5px; font-weight: 600; color: var(--blue-deep); }
.panel__more:hover { text-decoration: underline; }

/* split layout used on dashboard + staff detail */
.split { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }

/* ----------------------------------------------------------------- table */
.data { font-size: 14px; }
.data thead th {
  text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--muted); padding: 12px 20px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface);
}
.data thead th.num, .data td.num { text-align: right; }
.data tbody td { padding: 13px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr:hover { background: var(--surface-soft); }
.data .who-cell { display: flex; flex-direction: column; gap: 1px; }
.data .who-cell strong { font-weight: 600; font-size: 14px; }
.data .who-cell span { font-size: 12px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--draft    { background: var(--neutral-bg); color: var(--neutral); }
.badge--submitted{ background: var(--info-bg);    color: var(--blue-deep); }
.badge--approved { background: var(--ok-bg);      color: var(--ok); }
.badge--rejected { background: var(--danger-bg);  color: var(--danger); }
.badge--paid     { background: var(--paid-bg);    color: var(--paid); }
.badge--payroll  { background: var(--warn-bg);    color: var(--warn-ink); }
.badge--open     { background: var(--canvas);     color: var(--blue-deep); }
.badge--muted    { background: var(--neutral-bg);  color: var(--muted); }

.tag-open { color: var(--ok); font-weight: 600; font-size: 13px; }

/* small benefit chips (staff register) */
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; padding: 2px 9px;
  border-radius: var(--radius-pill); background: var(--canvas);
  border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink-soft);
}

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--blue-strong); color: #fff; }
.btn--primary:hover { background: var(--blue-deep); }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue-deep); }
.btn--quiet { color: var(--muted); padding: 6px 8px; }
.btn--quiet:hover { color: var(--ink); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { opacity: .9; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }

/* ------------------------------------------------------------------ form */
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--danger); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(60,129,245,.16);
}
.textarea { min-height: 96px; resize: vertical; }
.input--error, .select--error { border-color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions {
  display: flex; gap: 10px; align-items: center;
  border-top: 1px solid var(--line); margin-top: 4px; padding-top: 20px;
}
.form-actions .spacer { margin-left: auto; }

/* callout / inline note */
.note {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; border: 1px solid var(--line);
}
.note strong { font-weight: 700; }
.note--info { background: var(--info-bg); border-color: #CFE0FC; color: #17408f; }
.note--warn { background: var(--warn-bg); border-color: #F3DCB4; color: #8a5205; }
.note--danger { background: var(--danger-bg); border-color: #F6C9CB; color: #a4242a; }
.note--ok { background: var(--ok-bg); border-color: #C4EBDF; color: #08664d; }

/* filters bar */
.filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.filters .field { gap: 4px; min-width: 150px; }
.filters .field > label { font-size: 11.5px; }

/* ------------------------------------------------------------- toasts */
.toast {
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13.5px; font-weight: 500;
  border: 1px solid var(--line); animation: toast-in .35s cubic-bezier(.2,.7,.2,1) both;
}
.toast--success { background: var(--ok-bg); border-color: #C4EBDF; color: #08664d; }
.toast--error   { background: var(--danger-bg); border-color: #F6C9CB; color: #a4242a; }
.toast--info    { background: var(--info-bg); border-color: #CFE0FC; color: #17408f; }
.toast--warn    { background: var(--warn-bg); border-color: #F3DCB4; color: #8a5205; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------- empty state */
.empty { text-align: center; padding: 46px 20px; }
.empty__mark {
  width: 44px; height: 44px; margin: 0 auto 14px; border-radius: var(--radius);
  background: var(--canvas); display: grid; place-items: center; color: var(--blue-deep);
}
.empty h3 { font-size: 16px; font-weight: 700; }
.empty p { color: var(--muted); margin: 6px auto 16px; max-width: 46ch; }

/* --------------------------------------------------------- report print */
.report-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.report-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.report-summary--5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) {
  .report-summary, .report-summary--5 { grid-template-columns: repeat(2, 1fr); }
  .report-summary > div, .report-summary--5 > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .report-summary > div:last-child, .report-summary--5 > div:last-child { border-bottom: 0; }
}
.report-summary > div { padding: 16px 20px; border-right: 1px solid var(--line); }
.report-summary > div:last-child { border-right: 0; }
.report-summary dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.report-summary dd { margin: 6px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 120px; align-items: center; gap: 14px; padding: 9px 20px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.bar-row:last-child { border-bottom: 0; }
.bar-row__label { color: var(--muted); }
.bar-row__track { height: 10px; background: var(--canvas); border-radius: var(--radius-pill); overflow: hidden; position: relative; }
.bar-row__fill { height: 100%; background: var(--gradient); border-radius: var(--radius-pill); }
.bar-row__val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* report letterhead — template-driven header shown on screen + print */
.report-letterhead {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px clamp(18px, 3vw, 32px); display: flex; align-items: center; gap: 20px;
  box-shadow: var(--shadow-1);
}
.report-logo { display: block; flex: 0 1 auto; width: auto; max-width: 25%; object-fit: contain; }
.report-letterhead__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.report-title { font-size: clamp(20px, 2.6vw, 28px); font-weight: 700; letter-spacing: -.02em; }
.report-subtitle { color: var(--muted); font-size: 14px; }
.report-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.report-footer { color: var(--muted); font-size: 12px; text-align: center; padding-top: 6px; }
.report-signatories {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 40px; padding: 24px 4px 8px;
}
.signatory { display: flex; flex-direction: column; gap: 4px; }
.signatory__line { height: 1px; background: var(--line-strong); margin-bottom: 30px; }
.signatory__role { font-size: 13px; font-weight: 600; }
.signatory__name { font-size: 12.5px; color: var(--muted); }

/* checkbox row (settings / template editor) */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.check input { margin: 0; }
.section-row { padding: 4px 0; }
.section-row .btn--quiet { font-size: 15px; line-height: 1; padding: 4px 10px; }

/* payroll / dependent sub-block inside forms */
.fieldset {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px; background: var(--canvas);
}
.fieldset__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.fieldset__head .hint { font-size: 12px; color: var(--muted); }

/* table footers (payroll report totals) */
.data tfoot td { padding: 13px 20px; font-size: 13.5px; border-top: 1px solid var(--line-strong); background: var(--surface); }
.data tfoot td.num { text-align: right; }
/* grouped monthly report rows (benefit-type group headers) */
.data tr.group-row td { padding: 9px 20px; background: var(--canvas); border-bottom: 1px solid var(--line); font-size: 13px; }
.data tr.group-row td:first-child { border-left: 3px solid var(--blue); }

/* confirm dialog */
dialog.confirm {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  max-width: 420px; box-shadow: var(--shadow-2); color: var(--ink);
}
dialog.confirm::backdrop { background: rgba(23,23,23,.35); }
dialog.confirm h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
dialog.confirm p { color: var(--muted); margin-bottom: 20px; }
dialog.confirm menu { display: flex; justify-content: flex-end; gap: 10px; margin: 0; padding: 0; }

/* ----------------------------------------------------------------- login */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.auth__aside {
  padding: clamp(32px, 5vw, 72px);
  background:
    radial-gradient(circle at 100% 0%, #F0FFFF 0%, #F0F0FF 70%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth__brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 16px; }
.auth__pitch h1 { font-size: clamp(30px, 4vw, 50px); font-weight: 700; letter-spacing: -.03em; line-height: 1.08; max-width: 18ch; }
.auth__pitch p { color: var(--muted-canvas); margin-top: 18px; max-width: 44ch; }
.auth__facts { display: flex; gap: 34px; margin-top: 34px; flex-wrap: wrap; }
.auth__facts div span { display: block; }
.auth__facts .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.auth__facts .k { font-size: 12.5px; color: var(--muted-canvas); margin-top: 2px; }
.auth__main { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.auth__card { width: min(380px, 100%); }
.auth__card h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.auth__card .sub { color: var(--muted); margin: 6px 0 24px; }
.demo-hint {
  margin-top: 22px; font-size: 12.5px; color: var(--muted);
  background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; line-height: 1.7;
}
.demo-hint code { font-weight: 600; color: var(--ink); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* --------------------------------------------------------------- helpers */
.stack { display: flex; flex-direction: column; gap: 26px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hr { height: 1px; background: var(--line); border: 0; margin: 4px 0; }
.dot-sep { color: var(--line-strong); }
.nowrap-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.link { color: var(--blue-deep); font-weight: 600; }
.link:hover { text-decoration: underline; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .split { grid-template-columns: 1fr; }
  .grid-funds { grid-template-columns: repeat(2, 1fr); }
  .report-summary { grid-template-columns: repeat(2, 1fr); }
  .report-summary > div:nth-child(2) { border-right: 0; }
  .report-summary > div:nth-child(1),
  .report-summary > div:nth-child(2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .spine {
    position: fixed; inset: 0 auto 0 0; width: 264px;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .spine.is-open { transform: none; box-shadow: var(--shadow-2); }
  .spine-scrim { position: fixed; inset: 0; background: rgba(23,23,23,.35); z-index: 35; }
  .burger { display: inline-flex; }
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
}
@media (max-width: 620px) {
  .grid-funds, .report-summary, .report-summary--5, .form-grid { grid-template-columns: 1fr; }
  .report-summary > div, .report-summary--5 > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .report-summary > div:last-child, .report-summary--5 > div:last-child { border-bottom: 0; }
  .rail__meter { grid-template-columns: 1fr; gap: 16px; }
  .rail__figure { flex-direction: row; align-items: baseline; gap: 12px; min-width: 0; }
  .rail__state { margin-top: 0; }
  .rail__ledger { grid-template-columns: 1fr; }
  .rail__ledger > div { padding-bottom: 12px; }
  .rail__ledger > div:last-child { padding-bottom: 0; }
  .rail__ledger > div + div { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 12px; }
  .report-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .data thead { display: none; }
  .data tbody td { display: block; border: 0; padding: 4px 20px; }
  .data tbody tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .data td.num { text-align: left; }
  .table-scroll { overflow-x: auto; }
}

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .rail__fill { transform: none; }
}

.payroll-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.monthly-claims-report .data tr.staff-subtotal > th,
.monthly-claims-report .data tr.staff-subtotal > td {
  background: var(--canvas); color: var(--ink); font-weight: 700;
  padding: 14px 12px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong);
}
.monthly-claims-report .data tfoot th,
.monthly-claims-report .data tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); }

.monthly-claims-report .staff-subtotal th { text-align: right; }
.monthly-claims-report .data .monthly-claimable > * { background: var(--canvas); font-weight: 700; }
.monthly-claims-report .claimable-formula { font-weight: 400; }

/* ------------------------------------------------------------ print (A4) */
@media print {
  @page { size: A4; margin: 16mm; }
  @page monthly-report { size: A4 landscape; margin: 12mm; }
  body.report-landscape { page: monthly-report; }
  body { background: #fff; font-size: 11.5px; }
  .spine, .topbar, .footnote, .page-actions, .filters, .no-print, .signout, .toast { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; gap: 16px; }
  .panel, .rail, .report-summary, .fund { box-shadow: none; break-inside: avoid; }
  .report-letterhead { box-shadow: none; border: 0; padding: 0 0 8px; break-inside: avoid; }
  .report-signatories { break-inside: avoid; }
  .data thead th, .data tbody td { padding: 6px 10px; }
  .rail__fill { animation: none; }
  .report-landscape .shell,
  .report-landscape .content { width: 100%; min-width: 0; }
  .monthly-claims-report { break-inside: auto; overflow: visible; }
  .monthly-claims-report .panel__head { break-after: avoid; }
  .monthly-claims-report .table-scroll { overflow: visible; }
  .monthly-claims-report .data { width: 100%; min-width: 0; table-layout: fixed; }
  .monthly-claims-report .claim-benefit { width: 10%; }
  .monthly-claims-report .claim-deduction { width: 10%; }
  .monthly-claims-report .claim-date { width: 9%; }
  .monthly-claims-report .claim-staff { width: 16%; }
  .monthly-claims-report .claim-relation { width: 7%; }
  .monthly-claims-report .claim-patient { width: 13%; }
  .monthly-claims-report .claim-receipt { width: 10%; }
  .monthly-claims-report .claim-clinic { width: 15%; }
  .monthly-claims-report .claim-fee { width: 10%; }
  .monthly-claims-report .data thead { display: table-header-group; }
  .monthly-claims-report .data tfoot { display: table-row-group; }
  .monthly-claims-report .data tr { display: table-row; break-inside: avoid; }
  .monthly-claims-report .data th,
  .monthly-claims-report .data td {
    display: table-cell; padding: 7px 8px; font-size: 11px;
    white-space: normal; overflow-wrap: anywhere; vertical-align: top;
  }
  .monthly-claims-report .data .num { text-align: right; white-space: nowrap; }
  .payroll-claims-report { break-inside: auto; overflow: visible; }
  .payroll-claims-report .panel__head { break-after: avoid; }
  .payroll-claims-report .table-scroll { overflow: visible; }
  .payroll-claims-report .data { width: 100%; min-width: 0; table-layout: fixed; }
  .payroll-claims-report .payroll-id { width: 10%; }
  .payroll-claims-report .payroll-name { width: 21%; }
  .payroll-claims-report .payroll-department { width: 16%; }
  .payroll-claims-report .payroll-benefit { width: 18%; }
  .payroll-claims-report .payroll-date { width: 11%; }
  .payroll-claims-report .payroll-amount { width: 12%; }
  .payroll-claims-report .data thead { display: table-header-group; }
  .payroll-claims-report .data tfoot { display: table-row-group; }
  .payroll-claims-report .data tr { display: table-row; break-inside: avoid; }
  .payroll-claims-report .data th,
  .payroll-claims-report .data td {
    display: table-cell; padding: 7px 8px; font-size: 11px;
    white-space: normal; overflow-wrap: anywhere; vertical-align: top;
  }
  .payroll-claims-report .data .num { text-align: right; white-space: nowrap; }
}
