/* Layout: balance readout up top (filterable by person), two entry forms, then the ledger. */
:root {
  --bg: #f3f5f8; --surface: #ffffff; --fg: #18202b; --muted: #5d6878; --line: #dbe1ea;
  --accent: #1d5fd1; --accent-ink: #ffffff; --block: #1d5fd1; --block-off: #e3e8f0;
  --good: #137a4b; --bad: #b4232c;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11151c; --surface: #19202a; --fg: #e7ecf3; --muted: #97a3b4; --line: #2a3442;
  --accent: #6c9bff; --accent-ink: #0b1220; --block: #6c9bff; --block-off: #2a3442;
  --good: #4cc98c; --bad: #ff7a80; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #11151c; --surface: #19202a; --fg: #e7ecf3; --muted: #97a3b4; --line: #2a3442;
  --accent: #6c9bff; --accent-ink: #0b1220; --block: #6c9bff; --block-off: #2a3442;
  --good: #4cc98c; --bad: #ff7a80; color-scheme: dark }

body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--body); }
[hidden] { display: none !important; }
.wrap { max-width: 1040px; margin: 0 auto; padding-block: 28px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 28px; }
h1, h2 { font-family: var(--display); text-wrap: balance; margin: 0; }
h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 700; }
.sub { color: var(--muted); margin: 4px 0 0; }
.label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.mono, td.t, .big { font-family: var(--mono); font-variant-numeric: tabular-nums; }

header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px; }
.stats { display: flex; flex-wrap: wrap; gap: 28px; }
.stat { display: grid; gap: 2px; }
.big { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat.main .big { font-size: 2.6rem; color: var(--accent); }
.stat.main .big.neg, td.neg { color: var(--bad); }
.who { display: grid; gap: 4px; min-width: 180px; }

.forms { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }
@media (max-width: 760px) { .forms { grid-template-columns: 1fr; } }
form { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > .field { flex: 1 1 140px; }
.field { display: grid; gap: 4px; min-width: 0; }
input, textarea, select { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; box-sizing: border-box; }
#otDur, #takDur { font-family: var(--mono); }
textarea { resize: vertical; min-height: 72px; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
button { font: 600 .95rem var(--body); border-radius: 6px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 4px 6px; color: var(--muted); font-weight: 600; }
button.link:hover { color: var(--fg); }
button.link.danger { color: var(--bad); }
.msg { font-size: .9rem; color: var(--muted); }
.msg.err { color: var(--bad); }


section.ledger { display: grid; gap: 12px; min-width: 0; }
.ledger-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.tabs { display: flex; gap: 4px; }
.tabs button[aria-selected="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; min-width: 640px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.t { white-space: nowrap; }
td.work { min-width: 220px; white-space: pre-wrap; }
td.acts { white-space: nowrap; text-align: right; }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.unavail { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { button { transition: background .15s, color .15s; } }

/* accounts, approvals, settings */
.topbar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px 12px; font-size: .9rem; color: var(--muted); }
.topbar a, a.link { color: var(--muted); font-weight: 600; text-decoration: none; padding: 4px 6px; }
.topbar a:hover, a.link:hover { color: var(--fg); }
.badge { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.status { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.status.pending { color: #a15c00; } .status.rejected { color: var(--bad); } .status.approved { color: var(--good); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status.pending { color: #f0b45a; } }
:root[data-theme="dark"] .status.pending { color: #f0b45a; }
.status small { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }
.panel { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 10px; }
.note { margin: 0; color: var(--muted); font-size: .9rem; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
td select { width: auto; padding: 4px 8px; }
.secret { font-family: var(--mono); background: var(--bg); border: 1px dashed var(--line); border-radius: 6px; padding: 10px 12px; margin: 0; user-select: all; word-break: break-all; }
.muted { color: var(--muted); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; box-sizing: border-box; }
.login-wrap form { width: min(380px, 100%); }
