/* Design tokens lifted from MOEV Board so the two read as one family
   (Glen 2026-10-26: "use similar visuals"). */
:root {
  color-scheme: light;
  --paper: #eef2ec;
  --surface: #ffffff;
  --surface-2: #f6f8f5;
  --ink: #1d2a21;
  --ink-soft: #55635a;
  --ink-faint: #9aa79c;
  --line: #d3dbd2;
  --line-soft: #e8ece7;
  --focus: #2b6cb0;
  --green: #3f8a4b;
  --green-wash: #dcebdc;
  --green-ink: #2f6e3a;
  --amber: #d69a1b;
  --amber-wash: #f6ead0;
  --amber-ink: #8f7400;
  --crimson: #a8283f;
  --crimson-wash: #f3dde1;
  --blue: #2f6fae;
  --blue-wash: #dde8f4;
  --radius-card: 10px;
  --radius-ctl: 7px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
}
a { color: var(--focus); }
h1, h2, h3 { font-family: var(--serif); font-weight: 650; margin: 0; letter-spacing: -0.01em; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------------------------------------------------------------- chrome */
.top {
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.top-in {
  max-width: 1320px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand { font-family: var(--serif); font-weight: 650; font-size: 19px; }
.brand span { color: var(--ink-faint); font-weight: 500; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a {
  padding: 7px 13px; border-radius: 99px; text-decoration: none;
  color: var(--ink-soft); font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--ink); color: var(--surface); }
.who { color: var(--ink-faint); font-size: 13px; }

.page-head { padding: 30px 0 20px; display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; }
.sub { color: var(--ink-soft); font-size: 14px; margin: 5px 0 0; }

/* ----------------------------------------------------------------- cards */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 7px;
}
.card .k { font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
           text-transform: uppercase; color: var(--ink-faint); }
.card .v {
  font-family: var(--serif); font-weight: 650; line-height: 1.12;
  /* a hyphen is a line-break opportunity, so "-Rp19,767,195" was splitting
     across two lines with the minus stranded on its own */
  white-space: nowrap;
  /* and the figure shrinks rather than overflowing its card on a narrow one */
  font-size: clamp(20px, 2vw, 29px);
}
.card .n { font-size: 13px; color: var(--ink-soft); line-height: 1.4; }
.card.good { background: var(--green-wash); border-color: #c3dcc3; }
.card.good .v { color: var(--green-ink); }
.card.warn { background: var(--amber-wash); border-color: #e6d4a6; }
.card.warn .v { color: var(--amber-ink); }
.card.bad  { background: var(--crimson-wash); border-color: #e4c2ca; }
.card.bad .v { color: var(--crimson); }

/* ---------------------------------------------------------------- panels */
/* the header is sticky, so an anchor needs to stop clear of it */
#claims { scroll-margin-top: 86px; }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); margin-top: 22px; overflow: hidden;
}
.panel > header {
  padding: 15px 20px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.panel > header h2 { font-size: 17px; }
.panel > header .count {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 99px; padding: 2px 10px; font-size: 12.5px;
  font-weight: 600; color: var(--ink-soft);
}
.panel > header .right { margin-left: auto; font-size: 13px; color: var(--ink-soft); }
.panel .body { padding: 18px 20px; }

/* ---------------------------------------------------------------- tables */
.scroll-x { overflow-x: auto; }
/* Glen 2026-10-26: Claimed and Spent stay as separate columns, so the type
   gets smaller to pay for the extra column rather than the data being merged. */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* Glen 2026-10-26: "idw to scroll" — the table is built to FIT instead. The
   floor is only a backstop for a phone, well under any laptop width. */
.scroll-x > table { min-width: 760px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-faint);
  padding: 10px 20px; border-bottom: 1px solid var(--line-soft); white-space: nowrap;
}
td { padding: 10px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { padding: 9px 10px; font-size: 10.5px; }
/* the claim and payee columns carry prose and need room to breathe */
td.c-claim { min-width: 205px; }
td.c-payee { min-width: 105px; }
td.c-date { white-space: nowrap; width: 1%; }
td.c-amt { min-width: 92px; }
td.c-act { width: 1%; white-space: nowrap; position: relative; }
/* the flag form is lifted out of the flow: inline, its 230px box was setting
   the whole column's width even while collapsed */
td.c-act .flag-pop {
  position: absolute; right: 16px; top: 44px; z-index: 5; width: 240px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-ctl); padding: 12px;
  box-shadow: 0 6px 20px rgba(29, 42, 33, .13);
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-main { font-weight: 500; }
.t-sub { color: var(--ink-faint); font-size: 11.5px; margin-top: 2px; line-height: 1.35; }
.empty { padding: 26px 20px; color: var(--ink-faint); font-size: 14px; }

/* ----------------------------------------------------------------- pills */
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.pill.green { background: var(--green-wash); color: var(--green-ink); }
.pill.amber { background: var(--amber-wash); color: var(--amber-ink); }
.pill.blue  { background: var(--blue-wash);  color: #255a8c; }
.pill.red   { background: var(--crimson-wash); color: var(--crimson); }
.pill.grey  { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }

/* ----------------------------------------------------------------- forms */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-ctl); background: var(--surface);
  font-family: var(--sans); font-size: 14.5px; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
.btn {
  appearance: none; border: 1px solid var(--ink); background: var(--ink);
  color: var(--surface); font-family: var(--sans); font-weight: 600; font-size: 14px;
  padding: 9px 17px; border-radius: var(--radius-ctl); cursor: pointer;
}
.btn:hover { background: #2a3a2f; }
.btn.ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { padding: 4px 9px; font-size: 11.5px; }
.btn.danger { background: var(--crimson); border-color: var(--crimson); color: #fff; }

.grid-caps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
details.caps { margin-top: 16px; }
details.caps > summary {
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  padding: 8px 0;
}

/* ----------------------------------------------------------------- bars */
.bars { display: flex; align-items: flex-end; gap: 10px; min-height: 200px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
           align-items: center; gap: 6px; min-width: 0; }
/* Settled and committed sit SIDE BY SIDE. Stacked, a tall month pushed its own
   value label out of the panel (Glen's July: Rp135.8M settled + Rp60.6M). */
.bar-pair { display: flex; align-items: flex-end; gap: 3px; width: 100%;
            max-width: 58px; height: 140px; }
.bar { flex: 1; border-radius: 4px 4px 0 0; background: var(--green); min-height: 2px;
       align-self: flex-end; }
.bar.pending { background: var(--amber); opacity: .6; }
.bar-lab { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }
.bar-val { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.meter { height: 9px; background: var(--line-soft); border-radius: 99px;
          overflow: hidden; display: flex; }
.meter > i { display: block; height: 100%; transition: width .2s ease; }
.meter > i.paid { background: var(--green); }
/* the projection: approved but not yet paid, same hue so it reads as the
   same budget, paler so it reads as not-yet-real */
.meter > i.pend { background: var(--green); opacity: .38; }
.meter.near > i.paid, .meter.near > i.pend { background: var(--amber); }
.meter.over > i.paid, .meter.over > i.pend { background: var(--crimson); }
td.c-prog { min-width: 210px; }
.meter-cap {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 5px; font-size: 11.5px; line-height: 1.35;
}
.meter-cap .ok    { color: var(--green-ink); font-weight: 600; }
.meter-cap .near  { color: var(--amber-ink); font-weight: 600; }
.meter-cap .over  { color: var(--crimson); font-weight: 600; }
.meter-cap .muted { color: var(--ink-faint); white-space: nowrap; }

/* ------------------------------------------------- stacked share bar */
/* one bar per month, stacked by category */
.sbars { display: flex; align-items: flex-end; gap: 12px; padding-top: 6px;
          min-height: 210px; }
.sbar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
            align-items: center; gap: 6px; min-width: 0; }
.sbar {
  width: 100%; max-width: 62px; display: flex; flex-direction: column-reverse;
  justify-content: flex-start; gap: 2px;   /* 2px surface gap between fills */
  border-radius: 4px 4px 0 0; overflow: hidden;
}
.sbar-seg:last-child { border-radius: 4px 4px 0 0; }  /* rounded data-end on top */
.sbars-wrap { position: relative; }
.sbar-seg { transition: opacity .12s ease; cursor: default; }
.sbar-seg:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* everything but the hovered category recedes, so one category can be followed
   straight across the months */
.sbars.focused .sbar-seg:not(.hot) { opacity: .22; }
.stack-key li.hot { background: var(--surface-2); border-radius: 6px; }
.stack-key li.hot .k-name { font-weight: 600; }

.viz-tip {
  position: absolute; transform: translate(-50%, -100%);
  background: var(--ink); color: #fff; border-radius: 8px;
  padding: 9px 12px; font-size: 12.5px; line-height: 1.45;
  pointer-events: none; z-index: 20; white-space: nowrap;
  box-shadow: 0 8px 22px rgba(29, 42, 33, .22);
}
.viz-tip b { display: block; font-size: 13px; }
.viz-tip .m { display: block; color: #a8b4ab; }
.viz-tip .v { display: block; color: #e7eae7; }
.viz-tip::after {           /* the little pointer under the bubble */
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink);
}
.stack-key {
  margin: 16px 0 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 28px;
}
.stack-key li {
  display: flex; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.stack-key .dot { flex: none; width: 11px; height: 11px; border-radius: 3px; }
/* the name carries identity, so nobody has to tell two fills apart by hue */
.stack-key .k-name { flex: 1 1 auto; min-width: 0; }
.stack-key .k-pct { font-variant-numeric: tabular-nums; font-weight: 600; width: 52px; text-align: right; }
.stack-key .k-val { font-variant-numeric: tabular-nums; color: var(--ink-soft); width: 110px; text-align: right; }
@media (max-width: 760px) { .stack-key { grid-template-columns: 1fr; } }

.note {
  background: var(--amber-wash); border: 1px solid #e6d4a6; color: #6b5712;
  border-radius: var(--radius-ctl); padding: 11px 14px; font-size: 13.5px; margin-top: 16px;
}

/* ----------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 32px; width: 100%; max-width: 380px;
}
.login h1 { font-size: 24px; margin-bottom: 6px; }
.login .sub { margin-bottom: 22px; }
.login .field { margin-bottom: 14px; }
.err { background: var(--crimson-wash); color: var(--crimson); border-radius: var(--radius-ctl);
       padding: 10px 13px; font-size: 13.5px; margin-bottom: 16px; }

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-caps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .grid-caps { grid-template-columns: 1fr; }
}
