@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/fonts/bricolage.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --paper: #f2f5ee;
  --sheet: #fbfcf8;
  --band: #e9eee4;
  --ink: #16241d;
  --soft: #5d6b63;
  --rule: #d3dbcf;
  --pine: #1f6f5b;
  --pine-ink: #165244;
  --amber: #d99a06;
  --amber-wash: #fbf0cf;
  --rest: #b4beb6;
  --danger: #a3341f;
  --font: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1713;
    --sheet: #151f1a;
    --band: #1a2620;
    --ink: #e2e9e1;
    --soft: #8e9c93;
    --rule: #2a3830;
    --pine: #5cc4a6;
    --pine-ink: #8ad9c1;
    --amber: #efb73a;
    --amber-wash: #33290f;
    --rest: #4c5a52;
    --danger: #f08a73;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1713;
  --sheet: #151f1a;
  --band: #1a2620;
  --ink: #e2e9e1;
  --soft: #8e9c93;
  --rule: #2a3830;
  --pine: #5cc4a6;
  --pine-ink: #8ad9c1;
  --amber: #efb73a;
  --amber-wash: #33290f;
  --rest: #4c5a52;
  --danger: #f08a73;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.45 var(--font);
  font-optical-sizing: auto;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
a { color: inherit; }
h1, h2, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

/* ---- Top bar ---- */
.top {
  display: flex; align-items: center; gap: 8px 28px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--rule);
}
.mark { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em; color: var(--pine-ink); }
.mark span { color: var(--ink); }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 7px 13px; border-radius: 999px; text-decoration: none; color: var(--soft); font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { background: var(--ink); color: var(--paper); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.quiet { background: none; border: 0; padding: 7px 10px; border-radius: 8px; color: var(--soft); cursor: pointer; display: inline-flex; align-items: center; }
.quiet:hover { color: var(--ink); background: var(--band); }

/* ---- Page frame ---- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 72px; }
.page > section, .two > section { margin-top: 44px; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.005em; margin-bottom: 14px; }
.sub { color: var(--soft); margin-top: 4px; }
.sub b { color: var(--ink); font-weight: 650; }
.note { color: var(--soft); font-size: 0.875rem; margin-top: 14px; max-width: 68ch; }
.bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.controls { display: flex; gap: 12px; flex-wrap: wrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.scroll { overflow-x: auto; margin-inline: calc(-1 * clamp(16px, 4vw, 40px)); padding-inline: clamp(16px, 4vw, 40px); }

.stepper, .switch { display: inline-flex; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); overflow: hidden; }
.stepper a, .switch a { padding: 7px 13px; text-decoration: none; font-weight: 500; color: var(--soft); min-width: 40px; text-align: center; }
.stepper a + a, .switch a + a { border-left: 1px solid var(--rule); }
.stepper a:hover, .switch a:hover { color: var(--ink); background: var(--band); }
.stepper a[aria-current], .switch a[aria-current] { color: var(--ink); font-weight: 650; }
.switch a[aria-current] { background: var(--ink); color: var(--paper); }

.primary { background: var(--pine); color: var(--sheet); border: 0; border-radius: 9px; padding: 9px 16px; font-weight: 650; cursor: pointer; }
:root[data-theme="dark"] .primary { color: #0f1713; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .primary { color: #0f1713; } }
.primary:hover { filter: brightness(1.08); }

/* ---- Timesheet: the ledger ---- */
.sheet { width: 100%; min-width: 760px; border-collapse: collapse; background: var(--sheet); border: 1px solid var(--rule); }
.sheet th, .sheet td { padding: 11px 12px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.sheet thead th { font-weight: 500; color: var(--soft); font-size: 0.875rem; border-bottom: 2px solid var(--ink); vertical-align: bottom; }
.sheet thead th b { display: block; font-size: 1.35rem; font-weight: 650; color: var(--ink); line-height: 1.1; }
.sheet .what { text-align: left; white-space: normal; min-width: 230px; position: sticky; left: 0; background: var(--sheet); }
.sheet tbody tr:nth-child(even) td, .sheet tbody tr:nth-child(even) .what { background: var(--band); }
.sheet tbody .what { font-weight: 400; display: grid; grid-template-columns: auto 1fr; gap: 0 9px; align-items: baseline; }
.sheet tbody .what .dot { transform: translateY(-1px); }
.sheet .task { font-weight: 650; }
.sheet .proj { grid-column: 2; color: var(--soft); font-size: 0.8125rem; }
.sheet td { font-size: 1rem; }
.sheet .weekend { color: var(--soft); }
.sheet .today { box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--amber) 13%, transparent); }
.sheet thead .today b { color: var(--amber); }
.sheet .sum { font-weight: 650; border-left: 1px solid var(--rule); }
.sheet tfoot th, .sheet tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 650; background: var(--sheet); }
.sheet .grand { font-size: 1.3rem; color: var(--pine-ink); }
.sheet .empty td { text-align: left; color: var(--soft); padding: 34px 16px; white-space: normal; }

.entries .dayhead { display: flex; justify-content: space-between; font-weight: 650; padding: 18px 0 8px; border-bottom: 1px solid var(--ink); }
.entries li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.entries .desc p { max-width: 82ch; }
.entries .meta { color: var(--soft); font-size: 0.8125rem; margin-top: 2px; }
.entries .dur { font-weight: 650; }

/* ---- Calendar: week ---- */
.week { min-width: 880px; background: var(--sheet); border: 1px solid var(--rule); }
.week-head, .week-body { display: grid; grid-template-columns: 58px repeat(7, minmax(0, 1fr)); }
.week-head { border-bottom: 2px solid var(--ink); }
.col-head { padding: 9px 10px; color: var(--soft); font-size: 0.875rem; border-left: 1px solid var(--rule); display: flex; align-items: baseline; gap: 6px; }
.col-head b { color: var(--ink); font-size: 1.2rem; font-weight: 650; }
.col-head .tot { margin-left: auto; color: var(--ink); font-weight: 650; }
.col-head.today b { color: var(--amber); }
.week-body { position: relative; }
.week-body .gutter { display: grid; grid-auto-rows: 52px; }
.week-body .gutter span { font-size: 0.75rem; color: var(--soft); text-align: right; padding: 3px 8px 0 0; }
.col {
  position: relative; border-left: 1px solid var(--rule);
  background-image: linear-gradient(var(--rule) 1px, transparent 1px);
  background-size: 100% 52px;
}
.col.today { background-color: color-mix(in srgb, var(--amber) 9%, transparent); }
.block {
  position: absolute; overflow: hidden; padding: 4px 7px 4px 9px; margin: 0;
  border-radius: 5px; border-left: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 17%, var(--sheet));
  box-shadow: 0 0 0 1px var(--sheet);
  font-size: 0.78rem; line-height: 1.25;
  display: grid; grid-template-columns: 1fr auto; gap: 0 6px; align-content: start;
}
.block b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.block span { color: var(--soft); }
.block p { grid-column: 1 / -1; color: var(--soft); overflow: hidden; }
.block.small { padding-block: 1px; }
.block.small p { display: none; }
.block.placed { border-left-style: dashed; }
.block.unbilled { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 17%, var(--sheet)) 0 6px, var(--sheet) 6px 12px); }
.block:hover, .block:focus { z-index: 2; overflow: visible; height: auto !important; min-width: 100%; box-shadow: 0 0 0 1px var(--ink); outline: 0; }
.block:hover p, .block:focus p { display: block; }

/* ---- Calendar: month ---- */
.month { background: var(--sheet); border: 1px solid var(--rule); }
.month-head, .month-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 64px; }
.month-head { border-bottom: 2px solid var(--ink); color: var(--soft); font-size: 0.875rem; }
.month-head span { padding: 8px 10px; }
.month-row + .month-row { border-top: 1px solid var(--rule); }
.cell { min-height: 92px; padding: 8px 10px; text-decoration: none; border-right: 1px solid var(--rule); display: grid; grid-template-rows: auto 1fr auto auto; gap: 2px; }
.cell:hover { background: var(--band); }
.cell .dnum { color: var(--soft); font-size: 0.875rem; }
.cell b { font-size: 1.2rem; font-weight: 650; align-self: end; }
.cell.out { opacity: 0.42; }
.cell.today .dnum { color: var(--sheet); background: var(--amber); border-radius: 999px; padding: 0 7px; justify-self: start; font-weight: 650; }
.fill { height: 4px; background: var(--band); border-radius: 2px; overflow: hidden; }
.fill i { display: block; height: 100%; background: var(--pine); }
.dots { display: flex; gap: 3px; height: 7px; }
.dots .dot { width: 6px; height: 6px; }
.month .wk { align-self: center; text-align: right; padding-right: 12px; font-weight: 650; color: var(--pine-ink); }
.month-head .wk { color: var(--soft); font-weight: 400; }

/* ---- Dashboard ---- */
.ranges { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.ranges > a, .ranges summary { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--rule); text-decoration: none; color: var(--soft); font-weight: 500; cursor: pointer; list-style: none; background: var(--sheet); }
.ranges summary::-webkit-details-marker { display: none; }
.ranges > a:hover, .ranges summary:hover { color: var(--ink); border-color: var(--soft); }
.ranges [aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ranges details { display: contents; }
.ranges details form { flex-basis: 100%; display: flex; gap: 12px; flex-wrap: wrap; align-items: end; padding-top: 8px; }
.ranges label { display: grid; gap: 3px; font-size: 0.8125rem; color: var(--soft); }
input { background: var(--sheet); border: 1px solid var(--rule); border-radius: 9px; padding: 8px 11px; }
input:focus-visible { border-color: var(--pine); }

.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 32px 56px; align-items: end; margin-top: 34px !important; }
.hero .when { color: var(--soft); font-weight: 500; }
.figure { font-size: clamp(4.2rem, 2rem + 11vw, 9.5rem); font-weight: 750; letter-spacing: -0.045em; line-height: 0.92; margin: 6px 0 14px -0.04em; color: var(--pine-ink); }
.lede { color: var(--soft); max-width: 46ch; }
.lede .num { color: var(--ink); font-weight: 650; }
.splitbar { height: 14px; background: var(--rest); border-radius: 3px; overflow: hidden; }
.splitbar .bill { display: block; height: 100%; background: var(--pine); border-right: 2px solid var(--paper); }
.split dl { margin-top: 12px; }
.split dl div { display: grid; grid-template-columns: 1fr auto 3.2rem; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.split dt { color: var(--soft); display: flex; align-items: center; gap: 8px; }
.split dd { font-weight: 650; text-align: right; }
.pc { color: var(--soft); font-weight: 400 !important; text-align: right; }
.key { width: 10px; height: 10px; border-radius: 2px; }
.key.bill, .plot .bill { background: var(--pine); }
.key.unbill, .plot .unbill { background: var(--rest); }

.chart { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.axis { display: flex; flex-direction: column; justify-content: space-between; height: 220px; font-size: 0.75rem; color: var(--soft); text-align: right; transform: translateY(-0.5em); }
.plot {
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: clamp(1px, 0.5vw, 6px);
  border-bottom: 2px solid var(--ink);
  background: linear-gradient(var(--rule) 1px, transparent 1px) 0 0 / 100% 110px;
  height: 222px; margin-bottom: 24px;
}
.slot { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 220px; }
.slot.weekend { background: color-mix(in srgb, var(--band) 70%, transparent); }
.stack { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; }
.stack i { display: block; min-height: 0; }
.stack i:first-of-type { border-radius: 3px 3px 0 0; }
.stack .unbill + .bill { border-radius: 0; }
.stack .unbill[style="height:0.000%"] + .bill { border-radius: 3px 3px 0 0; }
.val { font-size: 0.72rem; text-align: center; color: var(--soft); padding-bottom: 3px; white-space: nowrap; overflow: visible; display: none; }
.chart[style*="--n:7"] .val, .slot:hover .val { display: block; }
.slot:hover .val { color: var(--ink); font-weight: 650; position: relative; z-index: 1; }
.slot:hover .bill { background: var(--pine-ink); }
.lab { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); padding-top: 6px; font-size: 0.75rem; color: var(--soft); white-space: nowrap; }

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 56px; }
.shares li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.shares .row, .tasks li { display: grid; grid-template-columns: 1fr auto 3.2rem; gap: 12px; align-items: baseline; }
.shares .name { display: flex; align-items: baseline; gap: 9px; font-weight: 650; min-width: 0; }
.shares small { color: var(--soft); font-weight: 400; font-size: 0.8125rem; }
.shares .row > .num, .tasks li > .num { font-weight: 650; }
.meter { height: 5px; background: var(--band); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; }
.tasks li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.tasks .name { min-width: 0; display: grid; }
.tasks b { font-weight: 650; }
.tasks small { color: var(--soft); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Login ---- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login main { width: min(100%, 360px); }
.dial { width: 84px; margin-bottom: 22px; color: var(--pine); }
.dial-face { fill: var(--sheet); stroke: currentColor; stroke-width: 4; }
.dial-ticks path { stroke: var(--rest); stroke-width: 3; stroke-linecap: round; fill: none; }
.dial-hands { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.login h1 { font-size: 2.4rem; font-weight: 750; letter-spacing: -0.03em; }
.login .lede { margin: 4px 0 26px; }
.login form { display: grid; gap: 14px; }
.login label { display: grid; gap: 5px; font-size: 0.875rem; color: var(--soft); }
.login input { font-size: 1rem; padding: 11px 12px; color: var(--ink); }
.login .primary { padding: 12px 16px; margin-top: 6px; }
.alert { border-left: 4px solid var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 10px 12px; margin-bottom: 18px; border-radius: 0 6px 6px 0; }

/* ---- Small screens ---- */
@media (max-width: 760px) {
  .top { gap: 10px 12px; }
  .tabs { order: 3; flex-basis: 100%; }
  .tabs a { flex: 1; text-align: center; }
  .hero { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  .cell { min-height: 68px; padding: 6px 5px; }
  .cell b { font-size: 0.9rem; }
  .cell .dots { display: none; }
  .month-head, .month-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .month .wk { display: none; }
  .month-head span { padding: 6px 5px; }
  .axis, .plot, .slot { height: 170px; }
  .plot { height: 172px; background-size: 100% 85px; }
  .sheet .what { min-width: 150px; }
}

@media (prefers-reduced-motion: no-preference) {
  .stack i { transition: background-color 120ms; }
}
