/* estbooks — an internal professional accounting platform.
   Dense, quiet, keyboard-friendly. Not a consumer bookkeeping app. */
:root {
  --ink: #16191d; --ink-2: #4a5158; --ink-3: #767f88;
  --line: #e2e6ea; --line-2: #eef1f4;
  --bg: #f6f7f9; --panel: #ffffff; --panel-2: #fafbfc;
  --brand: #14532d; --brand-2: #1c6b3c; --brand-tint: #e8f2ec;
  --red: #b42318; --red-tint: #fef3f2;
  --amber: #b54708; --amber-tint: #fffaeb;
  --blue: #175cd3; --blue-tint: #eff6ff;
  --green: #067647; --green-tint: #ecfdf3;
  --radius: 6px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.45 var(--sans); color: var(--ink); background: var(--bg);
       -webkit-font-smoothing: antialiased; }
.boot { padding: 64px; text-align: center; color: var(--ink-3); }
a { color: var(--blue); text-decoration: none; }
h1,h2,h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 18px; } h2 { font-size: 15px; } h3 { font-size: 13px; }

/* ---------------------------------------------------------------- layout */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center;
  gap: 14px; height: 52px; padding: 0 16px; background: var(--brand); color: #fff; }
.topbar .logo { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.topbar .logo span { opacity: .6; font-weight: 400; }
.topbar .spacer { flex: 1; }
.topbar button, .topbar .chip { background: rgba(255,255,255,.12); color: #fff;
  border: 1px solid rgba(255,255,255,.18); }
.topbar button:hover { background: rgba(255,255,255,.2); }

.contextbar { position: sticky; top: 52px; z-index: 35; display: flex; align-items: center;
  gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  flex-wrap: wrap; }
.contextbar .client { font-weight: 650; font-size: 14px; }

.wrap { padding: 16px; max-width: 1600px; margin: 0 auto; }
.workspace { display: grid; grid-template-columns: 208px 1fr; gap: 0; align-items: start; }
.sidenav { position: sticky; top: 104px; padding: 12px 8px; }
.sidenav .group { font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); padding: 12px 8px 4px; font-weight: 600; }
.sidenav a { display: block; padding: 6px 10px; border-radius: var(--radius);
  color: var(--ink-2); font-size: 13px; }
.sidenav a:hover { background: var(--line-2); }
.sidenav a.on { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.sidenav a.soon { opacity: .45; pointer-events: none; }
.sidenav a.soon::after { content: " Ph2"; font-size: 9px; vertical-align: super; }
.panebody { padding: 16px; min-width: 0; }

/* ---------------------------------------------------------------- pieces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.card + .card { margin-top: 14px; }
.card > header { display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--line-2); }
.card > header .spacer { flex: 1; }
.card .body { padding: 14px; }

button, .btn { font: inherit; font-size: 12.5px; padding: 6px 11px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--panel-2); border-color: #cdd4da; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--brand-2); border-color: var(--brand-2); }
button.danger { color: var(--red); border-color: #f3c3bf; }
button.sm { padding: 3px 8px; font-size: 11.5px; }
button.link { border: none; background: none; color: var(--blue); padding: 2px 4px; }

input, select, textarea { font: inherit; font-size: 13px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-tint);
  border-color: var(--brand-2); }
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; font-size: 11.5px; color: var(--ink-2);
  margin-bottom: 4px; font-weight: 550; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 140px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-3); padding: 8px 10px;
  border-bottom: 1px solid var(--line); background: var(--panel-2);
  position: sticky; top: 0; z-index: 2; white-space: nowrap; }
td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--brand-tint); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono);
  font-size: 12px; white-space: nowrap; }
td.code { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
tfoot td { font-weight: 650; border-top: 2px solid var(--line); border-bottom: none;
  background: var(--panel-2); }
.tablewrap { overflow-x: auto; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--line-2); color: var(--ink-2); }
.pill.grey   { background: var(--line-2);   color: var(--ink-2); }
.pill.blue   { background: var(--blue-tint);  color: var(--blue); }
.pill.amber  { background: var(--amber-tint); color: var(--amber); }
.pill.red    { background: var(--red-tint);   color: var(--red); }
.pill.green  { background: var(--green-tint); color: var(--green); }

.rail { display: inline-flex; gap: 2px; vertical-align: middle; }
.rail i { width: 9px; height: 8px; border-radius: 2px; background: var(--line); display: block; }
.rail i.done { background: var(--brand-2); }
.rail i.now  { background: var(--amber); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; }
.kpi .n { font-size: 22px; font-weight: 650; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.kpi.alert .n { color: var(--red); }

.attention { background: var(--amber-tint); border: 1px solid #fde68a; border-radius: 8px;
  padding: 11px 14px; margin-bottom: 14px; }
.attention h3 { color: var(--amber); font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; margin-bottom: 7px; }
.attention li { margin: 3px 0; font-size: 12.5px; }
.attention ul { margin: 0; padding-left: 18px; }

.muted { color: var(--ink-3); }
.small { font-size: 11.5px; }
.empty { padding: 36px 16px; text-align: center; color: var(--ink-3); }
.neg { color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack > * + * { margin-top: 10px; }

/* journal entry grid — the screen staff live in */
.jegrid td { padding: 3px 4px; }
.jegrid input, .jegrid select { border-color: var(--line-2); background: var(--panel-2);
  padding: 5px 7px; }
.jegrid tr:hover input, .jegrid tr:hover select { border-color: var(--line); background: var(--panel); }
.jegrid input:focus, .jegrid select:focus { background: var(--panel); border-color: var(--brand-2); }
.jegrid th.num { text-align: right; }
.jefoot { display: flex; gap: 18px; align-items: center; padding: 10px 14px;
  border-top: 2px solid var(--line); background: var(--panel-2); flex-wrap: wrap; }
.jefoot .t { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.jefoot .diff.ok  { color: var(--green); font-weight: 700; }
.jefoot .diff.off { color: var(--red);   font-weight: 700; }

.modal-bg { position: fixed; inset: 0; background: rgba(15,20,25,.45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px;
  overflow: auto; }
.modal { background: var(--panel); border-radius: 10px; width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 900px; }
.modal > header { padding: 14px 16px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; }
.modal > .body { padding: 16px; }
.modal > footer { padding: 12px 16px; border-top: 1px solid var(--line-2);
  display: flex; gap: 8px; justify-content: flex-end; }

#toast-root { position: fixed; bottom: 18px; right: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px;
  font-size: 12.5px; max-width: 420px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--red); }
.toast.ok  { background: var(--green); }

.login { max-width: 380px; margin: 9vh auto; }
.login .card { padding: 24px; }
.login h1 { text-align: center; margin-bottom: 4px; }
.login .sub { text-align: center; color: var(--ink-3); margin-bottom: 20px; font-size: 12.5px; }
.demo { margin-top: 14px; padding: 11px; background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: var(--radius); font-size: 11.5px; }
.demo code { font-family: var(--mono); }
.demo button { margin: 2px 3px 0 0; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
  overflow-x: auto; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; padding: 8px 12px; color: var(--ink-2); }
.tabs button.on { border-bottom-color: var(--brand); color: var(--brand); font-weight: 650; }

.fs-line { display: flex; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.fs-line .lbl { flex: 1; }
.fs-line .amt { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right;
  min-width: 130px; }
.fs-line.total { font-weight: 700; border-top: 2px solid var(--line); border-bottom: none;
  margin-top: 4px; padding-top: 7px; }
.fs-line.sub { font-weight: 600; }
.fs-line.indent .lbl { padding-left: 14px; }
.fs-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); font-weight: 600; margin: 14px 0 4px; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .sidenav { position: static; display: flex; gap: 4px; overflow-x: auto;
    border-bottom: 1px solid var(--line); padding: 8px; }
  .sidenav .group { display: none; }
  .sidenav a { white-space: nowrap; }
  .grid2 { grid-template-columns: 1fr; }
  .panebody { padding: 12px 0; }
  .wrap { padding: 10px; }
}
@media print {
  .topbar, .contextbar, .sidenav, .tabs, button { display: none !important; }
  body { background: #fff; } .card { border: none; }
}
