:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #5f6b7a;
  --border: #e1e5eb;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --ok: #1d7a46;
  --ok-bg: #e5f4ea;
  --warn: #8a5a00;
  --warn-bg: #fdf1d8;
  --bad: #b3261e;
  --bad-bg: #fbe7e5;
  --info-bg: #e8effa;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --text: #e3e8ef;
    --muted: #9aa6b5;
    --border: #2c3542;
    --accent: #6ea2f0;
    --accent-text: #0d1117;
    --ok: #6fd39a;
    --ok-bg: #173324;
    --warn: #f0c060;
    --warn-bg: #3a2e12;
    --bad: #f28b82;
    --bad-bg: #3b1d1b;
    --info-bg: #1b2a40;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* layout */
header.top {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.top-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; min-height: 56px;
}
.brand { font-weight: 700; color: var(--text); margin-right: .5rem; }
nav.main { display: flex; flex-wrap: wrap; gap: .15rem; flex: 1; }
nav.main a {
  color: var(--muted); padding: .35rem .6rem; border-radius: 6px; font-size: .92rem;
}
nav.main a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
nav.main a.active { color: var(--text); background: var(--bg); font-weight: 600; }
.who { display: flex; gap: .75rem; align-items: center; font-size: .9rem; color: var(--muted); }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 2fr 1fr; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px; min-width: 0;
}
.card > :last-child { margin-bottom: 0; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.spread h1, .spread h2 { margin: 0; }

/* stats */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; min-width: 150px; flex: 1; }
.stat .n { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: .85rem; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* forms */
form.stack { display: grid; gap: .75rem; }
form.inline { display: inline; }
.fields { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
label { display: grid; gap: .25rem; font-size: .88rem; font-weight: 500; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: .45rem .6rem; width: 100%;
}
input[type=checkbox] { width: auto; }
textarea { min-height: 7rem; resize: vertical; }
textarea.tall { min-height: 18rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .btn {
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  background: var(--accent); color: var(--accent-text);
  border: 1px solid var(--accent); border-radius: 6px; padding: .45rem .9rem;
  display: inline-block; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
button.secondary, .btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.danger { background: transparent; color: var(--bad); border-color: var(--border); }
button.link { background: none; border: 0; color: var(--muted); padding: 0; font-weight: 400; }
button.small, .btn.small { padding: .2rem .55rem; font-size: .8rem; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: .5rem; }

/* flash + badges */
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 16px; background: var(--ok-bg); color: var(--ok); border: 1px solid var(--border); }
.flash.err { background: var(--bad-bg); color: var(--bad); }
.notice { padding: .7rem 1rem; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); margin-bottom: 16px; }
.badge {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem;
  border-radius: 999px; background: var(--info-bg); color: var(--accent); white-space: nowrap;
}
.badge.nav { background: var(--bad); color: #fff; margin-left: .25rem; }
.b-approved, .b-complete, .b-completed, .b-on_track, .b-active, .b-accepted { background: var(--ok-bg); color: var(--ok); }
.b-pending, .b-at_risk, .b-self_review, .b-manager_review, .b-acknowledge, .b-on_leave { background: var(--warn-bg); color: var(--warn); }
.b-denied, .b-rejected, .b-off_track, .b-terminated, .b-outstanding { background: var(--bad-bg); color: var(--bad); }
.b-cancelled, .b-withdrawn, .b-closed, .b-not_started { background: var(--bg); color: var(--muted); }

progress { width: 100%; height: .5rem; accent-color: var(--accent); vertical-align: middle; }
td progress { width: 90px; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .45rem 0; border-bottom: 1px solid var(--border); }
ul.plain li:last-child { border-bottom: 0; }
.empty { color: var(--muted); font-style: italic; }

/* balances */
.balances { display: flex; gap: 12px; flex-wrap: wrap; }
.balance { flex: 1; min-width: 120px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.balance .n { font-size: 1.4rem; font-weight: 700; }

/* org chart */
ul.org, ul.org ul { list-style: none; margin: 0; padding-left: 1.4rem; }
ul.org { padding-left: 0; }
ul.org ul { border-left: 1px dashed var(--border); margin-left: .6rem; }
ul.org li { padding: .3rem 0; }
.person { display: inline-block; padding: .35rem .7rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.person .t { color: var(--muted); font-size: .85rem; }

/* schedule */
table.sched th, table.sched td { min-width: 110px; }
table.sched td:first-child, table.sched th:first-child { min-width: 160px; }
table.sched td.today, table.sched th.today { background: var(--info-bg); }
.shift { display: block; font-size: .82rem; padding: .2rem .4rem; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); margin-bottom: .25rem; }
.shift form { display: inline; }
.pto { display: block; font-size: .8rem; padding: .2rem .4rem; border-radius: 4px; background: var(--warn-bg); color: var(--warn); margin-bottom: .25rem; }

/* documents */
.doc { max-width: 75ch; }
.doc p { margin-bottom: 1rem; }
.quote { border-left: 3px solid var(--border); padding-left: .8rem; margin: .5rem 0 1rem; white-space: pre-wrap; }

/* login */
.login { max-width: 420px; margin: 10vh auto; }
.login .card { padding: 28px; }
.google { display: flex; justify-content: center; gap: .5rem; width: 100%; padding: .6rem; }

.row select, .row input:not([type=checkbox]) { width: auto; }
form.row input[type=search] { min-width: 260px; }
fieldset.card { margin: 0; }
legend { font-weight: 600; padding: 0 .25rem; }
.b-submitted { background: var(--warn-bg); color: var(--warn); }
.b-paid { background: var(--ok-bg); color: var(--ok); }
.b-void { background: var(--bg); color: var(--muted); text-decoration: line-through; }
.warn { color: var(--warn); }
