/* Tracopus Autofill · "Ledger" theme */
:root {
  --ground: #f5f6f3; --panel: #ffffff; --line: #e2e5df; --line-soft: #eceee9;
  --ink: #1d2421; --muted: #5b635f; --faint: #8a918d;
  --accent: #0b5f58; --accent-ink: #07423d; --accent-bg: #e5f0ee;
  --ok: #0b5f58; --ok-bg: #e5f0ee;
  --warn: #7a4300; --warn-bg: #fff7ea; --warn-line: #f1d6a8;
  --bad: #a3271b; --bad-bg: #fdeeec; --bad-line: #f3c7c1;
  --info: #2f4f8f; --info-bg: #eaf0fa;
  --proj-a: #0b5f58; --proj-b: #6d8f3a; --proj-c: #3f6aa8; --proj-d: #8b5aa6; --leave: #d08a2c; --holiday: #3f6aa8;
  --radius: 12px;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--sans); color: var(--ink); background: var(--ground); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 13px; }
code { background: #eef0ec; padding: 1px 6px; border-radius: 4px; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- layout: left sidebar ---------- */
body.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 20px;
        position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); padding: 4px 8px; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand.big { justify-content: center; margin-bottom: 18px; font-size: 18px; }
.mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: #fff; font: 600 14px var(--mono); }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #3e4642; font-size: 14px; }
.side nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; color: var(--faint); }
.side nav a:hover { background: #f1f3ef; text-decoration: none; color: var(--ink); }
.side nav a.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.side nav a.on svg { color: var(--accent); }
.side nav .count { margin-left: auto; background: #fdebd3; color: #8a4b00; border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 600; }
.navhead { text-transform: uppercase; font-size: 11px; letter-spacing: .08em; color: var(--faint); margin: 16px 10px 6px; font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 14px 6px 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.who-name { font-weight: 600; font-size: 14px; }
.who form { margin: 0; }
.link { background: none; border: 0; color: var(--muted); padding: 0; cursor: pointer; font: inherit; font-size: 13px; }
.link:hover { color: var(--accent); text-decoration: underline; }

.content { padding: 32px 36px 64px; max-width: 1200px; width: 100%; }
.narrow { padding: 56px 16px; }
.auth { max-width: 420px; margin: 0 auto; }
.auth h1 { text-align: center; margin-bottom: 6px; }
.auth > p { text-align: center; }
.pagehead { margin-bottom: 22px; }
.pagehead.split { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.pagehead p { margin: 4px 0 0; max-width: 760px; }
.pagehead .tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- surfaces ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; overflow-x: auto; }
.card.flush { padding: 0; }
.card.flush > .card-head { padding: 18px 20px 6px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.grid2 .card, .grid3 .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* ---------- forms ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
label .muted { font-weight: 400; }
input, textarea, select { font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid #cfd4cc; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 400; }
input:focus, textarea:focus, select:focus { outline: 2px solid #bfdcd7; outline-offset: 0; border-color: var(--accent); }
input[type=number], .hrs { font-family: var(--mono); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.hint { font-weight: 400; font-size: 12.5px; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
fieldset.days, fieldset.hours, fieldset.seg { display: flex; gap: 14px; flex-wrap: wrap; }
fieldset.hours label { width: 84px; }
fieldset.hours input { text-align: center; }

.btn { font: inherit; font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: 8px; border: 1px solid #d5d9d2; background: #fff; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { background: #f3f5f1; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; color: var(--muted); background: transparent; }
.btn.ghost:hover { background: #f1f3ef; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.seg-tabs { display: inline-flex; gap: 4px; }
.seg-tabs .btn { border: 0; background: #eef0ec; padding: 6px 12px; font-size: 13px; }
.seg-tabs .btn.on { background: var(--ink); color: #fff; }

/* ---------- feedback ---------- */
.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #c3dcd8; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.flash.error { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.banner svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.banner .grow { flex: 1; min-width: 240px; }
.banner a { color: var(--warn); font-weight: 600; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 999px; background: #eef0ec; color: #4a524e; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: #fdebd3; color: #8a4b00; }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-size: 14px; }
.tbl tbody tr:hover td { background: #fafbf9; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.dim td { color: #9aa19d; }
.tbl td.msg { font-size: 13px; color: var(--muted); max-width: 520px; }
td.act { width: 1%; }
td.act .actions { min-width: 150px; max-width: 280px; margin-left: auto; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.actions form { margin: 0; }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.yearpick { display: flex; gap: 6px; margin-bottom: 14px; }

/* ---------- ledger grid (dashboard) ---------- */
.ledger { width: 100%; border-collapse: collapse; min-width: 720px; }
.ledger th, .ledger td { padding: 12px 14px; border-bottom: 1px solid #e6e8e3; text-align: center; font: 500 14px var(--mono); }
.ledger thead th { font: 600 13px var(--sans); color: var(--ink); }
.ledger thead th.rowhead { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ledger thead th.today { background: var(--accent-bg); color: var(--accent); }
.ledger tbody th { text-align: left; font: 500 14px var(--sans); }
.ledger .code { display: block; margin-left: 18px; font: 400 12px var(--mono); color: #6b736f; }
.ledger .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 10px; vertical-align: 1px; }
.ledger td.zero { color: #a3aaa6; }
.ledger td.leave { background: #fff4e3; color: var(--warn); }
.ledger td.holiday { background: var(--info-bg); color: var(--info); }
.ledger td.off { color: var(--bad); }
.ledger tfoot th, .ledger tfoot td { border-bottom: 0; font-weight: 600; }
.ledger tfoot td { color: var(--accent); }
.ledger tfoot td.short { color: var(--bad); }
.ledger tfoot th { text-align: left; font-family: var(--sans); }
.ledger .wk { font-weight: 600; }
.empty-day { color: var(--faint); font: 13px var(--sans); padding: 24px; text-align: center; }

.ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.ticks li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.ticks .t { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--ok-bg); color: var(--ok); flex: none; }
.ticks li.todo { color: var(--ink); }
.ticks li.todo .t { background: #fdebd3; color: #8a4b00; }
.kv { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.kv li { display: flex; justify-content: space-between; gap: 12px; }
.kv .tag-leave { color: #8a4b00; font-weight: 500; white-space: nowrap; }
.kv .tag-hol { color: var(--accent); font-weight: 500; white-space: nowrap; }
.kv .tag-ask { color: var(--bad); font-weight: 500; white-space: nowrap; }
.runs-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.runs-mini .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 500; }
.runs-mini .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.st-ok { color: var(--ok); font-weight: 600; } .st-partial { color: #a35a00; font-weight: 600; }
.st-failed { color: var(--bad); font-weight: 600; } .st-skipped, .st-running { color: var(--muted); font-weight: 600; }

/* ---------- projects allocation grid ---------- */
.alloc td.num, .alloc th.num { text-align: center; }
.alloc input.hrs { width: 66px; text-align: center; padding: 7px 4px; }
.alloc tfoot th { border-top: 1px solid var(--line); padding-top: 12px; text-transform: none; font-size: 14px; color: var(--ink); letter-spacing: 0; }
.tot { display: inline-block; min-width: 48px; padding: 2px 8px; border-radius: 999px; font: 600 13px var(--mono); }
.tot.ok { background: var(--ok-bg); color: var(--ok); }
.tot.under { background: #fdebd3; color: #8a4b00; }
.tot.over { background: var(--bad-bg); color: var(--bad); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  body.app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); gap: 12px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side nav a span:not(.count) { white-space: nowrap; }
  .navhead { width: 100%; margin: 6px 10px 0; }
  .who { border-top: 0; padding-top: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 48px; }
}
.alloc td.act { min-width: 0; }
.alloc td:first-child { min-width: 220px; }

/* ---------- timesheet status ---------- */
.monthnav { display: flex; align-items: center; gap: 6px; }
.monthnav .mlabel { min-width: 130px; text-align: center; font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tile .tl { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile .tv { font: 600 30px var(--mono); letter-spacing: -0.02em; margin-top: 2px; }
.tile .ts { font-size: 12.5px; color: var(--muted); }
.tile.alert { background: #fff7f5; border-color: var(--bad-line); }
.tile.alert .tv { color: var(--bad); }
.split2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 20px; }
.split2 .card { margin-bottom: 20px; }

/* status colours: differ in lightness as well as hue, and every state also has a symbol */
.s-filled    { --c-bg: #d6ebe6; --c-fg: #0b5f58; --c-line: #9fcdc4; }
.s-partial   { --c-bg: #fde3bf; --c-fg: #7a4300; --c-line: #efbd73; }
.s-failed    { --c-bg: #b42318; --c-fg: #ffffff; --c-line: #b42318; }
.s-missed    { --c-bg: #fde8e5; --c-fg: #a3271b; --c-line: #e9a49b; }
.s-scheduled { --c-bg: #ffffff; --c-fg: #5b635f; --c-line: #cfd4cc; }
.s-none, .s-inactive { --c-bg: #f1f2ef; --c-fg: #8a918d; --c-line: #e6e8e3; }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sq { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; font-size: 10px; font-weight: 700;
      background: var(--c-bg); color: var(--c-fg); border: 1px solid var(--c-line); }
.sq.inline { vertical-align: -3px; margin-right: 2px; }

.cal { display: flex; flex-direction: column; gap: 6px; }
.cal-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cal-head div { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0 4px; }
.cal-cell { min-height: 92px; border-radius: 10px; padding: 8px 10px; background: var(--c-bg); color: var(--c-fg); border: 1px solid var(--c-line);
            display: flex; flex-direction: column; gap: 2px; }
.cal-cell.blank { background: transparent; border: 1px dashed var(--line-soft); }
.cal-cell.is-today { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal-cell.s-missed { border-style: dashed; border-width: 1.5px; }
.cal-top { display: flex; justify-content: space-between; align-items: center; }
.cal-day { font: 600 16px var(--mono); }
.cal-sym { font-weight: 700; font-size: 14px; }
.cal-status { font-size: 13px; font-weight: 600; }
.cal-meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; }
.hrs-t { font-family: var(--mono); opacity: .85; }
.kind { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: rgba(255,255,255,.7); }
.k-leave { color: #8a4b00; } .k-hol { color: var(--info); }
.s-failed .kind { background: rgba(255,255,255,.9); }
.cal.compact .cal-cell { min-height: 72px; }
.cal-counts { margin-top: auto; display: flex; flex-wrap: wrap; gap: 2px 8px; font: 500 12px var(--mono); }
.cal-counts .bad { font-weight: 700; }

.attn { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attn li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.attn li:last-child { border-bottom: 0; }
.attn a { font-weight: 600; }
.attn-counts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }

.matrix { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.matrix th, .matrix td { padding: 3px 2px; text-align: center; }
.matrix thead th { font: 600 11px var(--mono); color: var(--muted); vertical-align: bottom; min-width: 26px; }
.matrix thead th .dow { display: block; font-size: 10px; color: var(--faint); }
.matrix thead th.today { color: var(--ink); background: var(--accent-bg); border-radius: 6px 6px 0 0; }
.matrix .wk-start { padding-left: 10px; }
.matrix .who-col { text-align: left; padding-right: 14px; white-space: nowrap; font: 500 14px var(--sans); min-width: 160px; position: sticky; left: 0; background: var(--panel); }
.matrix thead .who-col { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.matrix tbody tr:hover th, .matrix tbody tr:hover td { background: #fafbf9; }
.matrix .dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; font-size: 11px; font-weight: 700;
               background: var(--c-bg); color: var(--c-fg); border: 1px solid var(--c-line); }
.matrix .dot.s-missed { border-style: dashed; }
.matrix td.num { font-family: var(--mono); padding: 0 8px; }
.matrix td.num.bad { color: var(--bad); font-weight: 600; }

@media (max-width: 900px) { .split2 { grid-template-columns: 1fr; } .cal-cell { min-height: 70px; padding: 6px; } .cal-status { display: none; } }
.btn:disabled { opacity: .55; cursor: default; }
