/* VELLUNA HMS — the desk.
   Solid colours only: no gradients anywhere, by house rule. The palette is a
   near-black room with one violet light in it; everything else is restraint. */
:root {
  --ink:        #08080B;
  --surface:    #101015;
  --surface-2:  #17171F;
  --line:       #24242F;
  --line-soft:  #1C1C25;
  --text:       #ECECF1;
  --text-dim:   #9A9AA8;
  --text-faint: #63636F;
  --accent:     #7A5CFF;
  --accent-ink: #FFFFFF;
  --ok:         #3FB98A;
  --warn:       #D8A13A;
  --bad:        #E0555F;
  --radius:     10px;
  --radius-lg:  14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

/* ---- shell ---------------------------------------------------------------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.app[hidden] { display: none; }

.side {
  background: var(--surface);
  border-right: 1px solid var(--line-soft);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent);
  display: grid; place-items: center;
  color: var(--accent-ink); font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.brand-name { font-weight: 650; letter-spacing: .14em; font-size: 12px; text-transform: uppercase; }
.brand-sub { color: var(--text-faint); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }

nav { display: flex; flex-direction: column; gap: 2px; }
nav button {
  text-align: left; background: none; border: 0; cursor: pointer;
  padding: 9px 12px; border-radius: var(--radius);
  color: var(--text-dim); font-size: 14px;
}
nav button:hover { background: var(--surface-2); color: var(--text); }
nav button[aria-current="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 550; }

.side-foot { margin-top: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 8px; }
.who { font-size: 12px; color: var(--text-faint); line-height: 1.4; }
.who b { color: var(--text-dim); font-weight: 550; }

main { padding: 26px 30px 60px; max-width: 1500px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
h1 { font-size: 24px; letter-spacing: -.015em; margin: 0 0 4px; font-weight: 640; }
.sub { color: var(--text-faint); font-size: 13px; margin: 0; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- primitives ----------------------------------------------------------- */
.btn {
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: var(--radius); cursor: pointer;
  color: var(--text); font-size: 13px;
}
.btn:hover { border-color: #33333F; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 550; }
.btn.primary:hover { background: #6B4CF0; }
.btn.ghost { background: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

input, select {
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 7px 11px; border-radius: var(--radius); font-size: 13px; min-width: 0;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-faint); }

.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); }
.card + .card { margin-top: 16px; }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.card-body { padding: 16px 18px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 15px 16px; }
.stat .k { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .09em; }
.stat .v { font-size: 25px; font-weight: 620; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .n { color: var(--text-faint); font-size: 12px; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--text-faint); font-weight: 550; font-size: 11px;
  text-transform: uppercase; letter-spacing: .08em; padding: 0 14px 9px;
}
td { padding: 11px 14px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; letter-spacing: .02em; border: 1px solid var(--line);
  color: var(--text-dim); background: var(--surface-2); white-space: nowrap;
}
.tag.ok   { color: var(--ok);   border-color: #24503F; background: #12261E; }
.tag.warn { color: var(--warn); border-color: #4E3D18; background: #241D0E; }
.tag.bad  { color: var(--bad);  border-color: #55262A; background: #261316; }
.tag.on   { color: var(--accent); border-color: #3A2E73; background: #1A1633; }

.muted { color: var(--text-faint); }
.empty { padding: 34px 18px; text-align: center; color: var(--text-faint); font-size: 13px; }
.money { font-variant-numeric: tabular-nums; }

/* ---- grid board ----------------------------------------------------------- */
.board-wrap { overflow-x: auto; }
.board { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.board th, .board td { padding: 8px 10px; border-top: 1px solid var(--line-soft); white-space: nowrap; }
.board th.date { font-size: 10.5px; text-align: center; }
.board td.cell { text-align: center; font-variant-numeric: tabular-nums; }
.board .rt { position: sticky; left: 0; background: var(--surface); font-weight: 550; }
.cell .a { font-size: 14px; }
.cell .p { font-size: 10.5px; color: var(--text-faint); margin-top: 1px; }
.cell.none .a { color: var(--bad); }
.cell.tight .a { color: var(--warn); }
.cell.shut { background: #1B1216; }
.cell.shut .a { color: var(--bad); text-decoration: line-through; }

/* ---- login ---------------------------------------------------------------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
/* author display wins over the UA's [hidden], so say it explicitly */
.login[hidden] { display: none; }
.login-card { width: 100%; max-width: 380px; }
.login .brand { justify-content: center; margin-bottom: 22px; }
.login .card-body { display: flex; flex-direction: column; gap: 14px; }
.hint { font-size: 12px; color: var(--text-faint); line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font-size: 11.5px; padding: 4px 9px; }

/* ---- toast ---------------------------------------------------------------- */
#toast {
  position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px;
  z-index: 50; max-width: 380px;
}
.toast {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 11px 14px; border-radius: var(--radius); font-size: 13px;
}
.toast.bad { border-left-color: var(--bad); }
.toast.ok  { border-left-color: var(--ok); }

/* ---- drawer --------------------------------------------------------------- */
.scrim { position: fixed; inset: 0; background: #000000B8; z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: var(--surface); border-left: 1px solid var(--line);
  z-index: 41; overflow-y: auto; padding: 22px 24px 40px;
}
.drawer h2 { margin: 0 0 2px; font-size: 19px; letter-spacing: -.01em; }
.drawer .close { position: absolute; top: 16px; right: 18px; }
.kv { display: grid; grid-template-columns: 128px 1fr; gap: 7px 14px; font-size: 13px; margin: 18px 0; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 8px 0 8px 16px; border-left: 1px solid var(--line); position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -4px; top: 14px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
