/* SIBKL Budget, styled with the Prodex AI "Batik" theme (prodex-ai.com v2):
   cream cloth ground, indigo and soga dyes for text and dark surfaces, ochre gold and maroon as accents,
   Hanken Grotesk with light-weight headlines, pill-shaped controls. */
:root {
  --ground: #ECE0C8;
  --white: #F6EEDF;
  --card: #FBF6EC;
  --fog: #E3D5B8;
  --fog-2: #D9C8A6;
  --ink: #1E2B55;
  --ink-2: #2A3A6E;
  --muted: #54493A;
  --subtle: #6B5D48;
  --line: #D8C7A6;
  --line-2: #C6B28C;
  --accent: #D9A33A;
  --accent-deep: #B7841F;
  --accent-soft: #F2DCA6;
  --accent-wash: #F1DFB4;
  --navy-2: #26356A;
  --on-navy: #FBF6EC;
  --on-navy-muted: #CDBD98;
  --soga: #7A4A24;
  --maroon: #7C2B26;
  --pass: #2F6B45;
  --pass-soft: #DCE8D3;
  --review: #8A5A0B;
  --bad: #7C2B26;
  --bad-soft: #F0D6CC;
  --r-sm: 12px;
  --r-md: 20px;
  --shadow-sm: 0 2px 6px rgba(30, 43, 85, .06), 0 10px 24px -14px rgba(30, 43, 85, .16);
  --shadow-md: 0 18px 40px -22px rgba(30, 43, 85, .28);
  --font: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%; min-height: 100%;
  background:
    radial-gradient(70% 50% at 100% 0%, rgba(241, 223, 180, .95) 0%, rgba(241, 223, 180, 0) 60%),
    radial-gradient(60% 45% at 0% 100%, rgba(217, 200, 166, .7) 0%, rgba(217, 200, 166, 0) 60%),
    var(--ground);
  background-repeat: no-repeat;
}
body { margin: 0; color: var(--ink); font: 400 15.5px/1.55 var(--font); background: transparent; min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-weight: 300; letter-spacing: -.028em; margin: 0 0 .35em; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.5rem); line-height: 1.05; }
h2 { font-size: 1.35rem; font-weight: 400; letter-spacing: -.018em; }
h3 { font-size: 1.05rem; font-weight: 500; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: .2em; }
small, .muted { color: var(--muted); }
code { font-family: var(--mono); font-size: .85em; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 24px 16px 64px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 10px clamp(16px, 3vw, 32px); min-height: 64px;
  background: rgba(236, 224, 200, .9); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.2rem; font-weight: 600; letter-spacing: -.03em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .thin { font-weight: 400; color: var(--subtle); }
.mark { width: 30px; height: 30px; flex-shrink: 0; display: block; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a { padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; text-decoration: none; }
.nav a.on, .nav a:hover { background: var(--fog); color: var(--ink); }
.who { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who a { color: var(--ink); font-weight: 600; text-align: right; line-height: 1.15; text-decoration: none; }
.who small { display: block; font-weight: 400; font-size: .78rem; }
.demo { text-align: center; font-size: .82rem; padding: 5px 16px; background: var(--accent-wash); color: var(--soga); border-bottom: 1px solid var(--line); }

/* Surfaces */
.card { background: var(--card); border: 1px solid rgba(30, 43, 85, .08); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 20px 22px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { padding: 16px 18px; text-decoration: none; }
a.stat:hover { box-shadow: var(--shadow-md); }
.stat b { display: block; font-size: 1.65rem; font-weight: 300; letter-spacing: -.035em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .86rem; }
.stat.dark { background: var(--ink); color: var(--on-navy); border-color: var(--ink); position: relative; overflow: hidden; }
.stat.dark::before { content: ""; position: absolute; right: -30%; top: -60%; width: 90%; height: 160%; background: radial-gradient(closest-side, rgba(217, 163, 58, .28), rgba(217, 163, 58, 0)); }
.stat.dark b, .stat.dark span { position: relative; } .stat.dark span { color: var(--on-navy-muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.right { text-align: right; }
.mt { margin-top: 14px; }
.neg { color: var(--maroon); }

.flash { padding: 11px 16px; border-radius: var(--r-sm); margin-bottom: 14px; background: var(--pass-soft); color: var(--pass); border: 1px solid #C2D6B9; }
.flash.err { background: var(--bad-soft); color: var(--maroon); border-color: #E2BBAD; }
.warnbox { background: var(--accent-wash); border: 1px solid var(--accent-soft); border-left: 4px solid var(--accent); border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 16px; }
.warnbox li { margin: 3px 0; }

/* Tables */
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--white); position: sticky; top: 0; letter-spacing: .01em; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.sub td { background: var(--white); font-weight: 600; }
tr.tot td { background: var(--accent-wash); font-weight: 700; border-top: 2px solid var(--accent); }
tr.sec td { font-weight: 500; font-size: 1.02rem; letter-spacing: -.01em; padding-top: 16px; border-bottom: none; color: var(--ink); }
tr.grp td { color: var(--soga); font-weight: 500; }
td.ind1 { padding-left: 24px; } td.ind2 { padding-left: 40px; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-sm); }

/* Status pills */
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.s-draft { background: var(--fog); color: var(--muted); }
.s-submitted { background: var(--accent-soft); color: var(--review); }
.s-endorsed { background: #D9DDEE; color: var(--ink-2); }
.s-approved { background: var(--pass-soft); color: var(--pass); }
.s-returned { background: var(--bad-soft); color: var(--maroon); }
.kind { font-size: .74rem; color: var(--subtle); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 8px; }

/* Buttons */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: transparent; color: var(--ink);
  padding: .72em 1.25em; border-radius: 999px; font: 500 .95rem/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .2s, border-color .2s, color .2s;
}
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--on-navy); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.good { background: var(--accent); color: var(--ink); border-color: var(--accent); font-weight: 600; }
.btn.good:hover { background: var(--accent-soft); }
.btn.bad { color: var(--maroon); border-color: #D7B3A6; }
.btn.bad:hover { border-color: var(--maroon); }
.btn.sm { padding: .55em 1em; font-size: .86rem; }
button.link { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { color: var(--maroon); }

/* Forms */
label { display: block; font-weight: 500; font-size: .9rem; margin: 12px 0 6px; color: var(--ink); }
input, select, textarea {
  font: 400 .95rem/1.4 var(--font); color: var(--ink); width: 100%; padding: 10px 12px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { outline: none; background: #FFFDF8; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(30, 43, 85, .10); }
input[type=file] { padding: 7px 10px; }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; color: var(--muted); }
.check input { width: 17px; height: 17px; accent-color: var(--ink); }
.inline { display: inline; }

/* Line editors */
.editor td { padding: 4px; }
.editor input, .editor select { padding: 7px 8px; border-radius: 9px; font-size: .88rem; }
.editor input.m { width: 86px; text-align: right; }
.editor input.money { text-align: right; min-width: 104px; }
.editor .desc { min-width: 250px; }
.editor .acct { min-width: 175px; }
.editor td.calc { font-weight: 600; text-align: right; white-space: nowrap; padding-right: 10px; font-variant-numeric: tabular-nums; }
tr.is-income td:first-child select { border-left: 3px solid var(--pass); }
.rm-row { border: none; background: none; color: var(--subtle); cursor: pointer; font-size: 1.15rem; }
.rm-row:hover { color: var(--maroon); }
.sticky-actions { position: sticky; bottom: 0; background: rgba(236, 224, 200, .94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 12px; }

/* Approval trail */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.timeline .c { background: var(--white); border-radius: 10px; padding: 7px 11px; margin-top: 5px; }

/* Login */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login .card { width: 100%; max-width: 420px; padding: 32px; }
.login h1 { font-size: 2.2rem; margin-top: 18px; }

.bar { height: 8px; border-radius: 999px; background: var(--fog); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--ink); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 7px 15px; border-radius: 999px; background: var(--white); border: 1px solid var(--line); color: var(--muted); font-weight: 500; text-decoration: none; }
.tabs a:hover { border-color: var(--line-2); color: var(--ink); }
.tabs a.on { background: var(--ink); color: var(--on-navy); border-color: var(--ink); }
details summary { cursor: pointer; font-weight: 500; }

/* Footer */
.foot { max-width: 1280px; margin: 0 auto; padding: 20px 16px 32px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--subtle); font-size: .85rem; border-top: 1px solid var(--line); }
.foot .pmark { height: 24px; width: auto; display: block; }
.foot b { color: var(--ink); font-weight: 600; letter-spacing: -.02em; }
.byline { display: inline-flex; align-items: center; gap: 8px; color: var(--subtle); font-size: .85rem; margin-top: 22px; }
.byline .pmark { height: 22px; width: auto; }

@media (max-width: 720px) {
  .who small { display: none; }
  .card { padding: 14px; }
  .stat b { font-size: 1.25rem; }
  .stat { padding: 12px 14px; }
  .grid { gap: 10px; }
}
@media print {
  .topbar, .demo, .noprint, .flash, .foot { display: none !important; }
  html, body { background: #fff; font-size: 11px; }
  .card { box-shadow: none; border: none; padding: 0; background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .page { page-break-after: always; }
  th { position: static; }
}

/* dashboards */
.viz { width: 100%; min-height: 60px; }
.viz svg { display: block; overflow: visible; }
.viz .axis, .viz text.axis { font: 500 11px var(--font); fill: var(--subtle); }
.viz .viz-label { font: 500 12px var(--font); fill: var(--ink); }
.viz .viz-direct { font: 600 11.5px var(--font); fill: var(--ink); }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--muted); margin: 0 0 8px; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i { display: inline-block; width: 12px; height: 10px; border-radius: 3px; }
.viz-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--on-navy); font-size: .82rem;
  line-height: 1.45; padding: 8px 11px; border-radius: 10px; box-shadow: var(--shadow-md); max-width: 280px; transition: opacity .12s; }
.viz-tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.card h2 + .sub { margin: -4px 0 12px; color: var(--muted); font-size: .88rem; }
.pipe { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.pipe a { display: block; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; text-decoration: none; }
.pipe b { display: block; font-size: 1.3rem; font-weight: 300; letter-spacing: -.02em; }
.pipe span { font-size: .78rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select { width: auto; }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); }
@media (max-width: 720px) { .grid.wide { grid-template-columns: 1fr; } }
