/* ============================================================
   unarii timesheet — "the engineering ledger"
   IBM Plex Sans (display) · Inter (body) · JetBrains Mono (data)

   Tokens mirror unarii-v2/astro/src/styles/global.css exactly.
   The rules that make it read as unarii: paper/ink never white/black;
   hairlines instead of boxes, with a --rule-strong opener on every list;
   uppercase mono micro-labels as the only decorative typography; one
   brand accent, mostly on hover; 0.15s ease and a 3px nudge as the
   entire motion budget.
   ============================================================ */

@font-face {
    font-family: "IBM Plex Sans";
    src: url("/static/fonts/ibm-plex-sans-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans";
    src: url("/static/fonts/ibm-plex-sans-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans";
    src: url("/static/fonts/ibm-plex-sans-600.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans";
    src: url("/static/fonts/ibm-plex-sans-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

/* latin-ext first so Slovak diacritics resolve from the same family. */
@font-face {
    font-family: "Inter Variable";
    src: url("/static/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
    font-weight: 100 900;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Inter Variable";
    src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
    font-weight: 100 900;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
        U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "JetBrains Mono Variable";
    src: url("/static/fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2-variations");
    font-weight: 100 800;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
        U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "JetBrains Mono Variable";
    src: url("/static/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
    font-weight: 100 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122,
        U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */

:root {
    --paper: #faf7f6;
    --ink: #1d1418;
    --muted: #6b5f64;
    --rule: #e6dcdf;
    --rule-strong: #1d1418;
    --surface: #f2ebec;
    --card: #fffdfe;
    --brand: #c9185a;
    --brand-soft: rgba(201, 24, 90, 0.08);
    --brand-border: rgba(201, 24, 90, 0.35);
    --brand-contrast: #ffffff;
    --shadow: 0 1px 2px rgba(29, 20, 24, 0.05), 0 16px 40px -20px rgba(29, 20, 24, 0.22);
    --radius-s: 6px;
    --radius-m: 10px;

    /* Status colours, carried over from the unarii status page. */
    --st-up: #21a466;
    --st-down: #e5484d;
    --st-pending: #eba813;
    --st-info: #4f78d2;

    --font-display: "IBM Plex Sans", "Inter Variable", system-ui, sans-serif;
    --font-body: "Inter Variable", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
    --paper: #151013;
    --ink: #f3edef;
    --muted: #a89aa0;
    --rule: rgba(255, 255, 255, 0.13);
    --rule-strong: #f3edef;
    --surface: #1c1518;
    --card: #1a1316;
    --brand: #ff5a93;
    --brand-soft: rgba(255, 90, 147, 0.1);
    --brand-border: rgba(255, 90, 147, 0.4);
    --brand-contrast: #1d0a12;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 16px 40px -20px rgba(0, 0, 0, 0.6);

    --st-up: #35c483;
    --st-down: #ff6b70;
    --st-pending: #ffc53d;
    --st-info: #7a9ff0;
}

/* ---------- reset ---------- */

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}

/* Subtle film grain: de-flattens the solid paper/ink fills. Sits under the
   nav (z 50) so the bar stays crisp; overlay blend adapts to light and dark. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    opacity: 0.22;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 140px 140px;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg {
    display: block;
    max-width: 100%;
}

ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

dl,
dd,
figure {
    margin: 0;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 500;
    margin: 0;
    text-wrap: balance;
}

p {
    margin: 0;
    text-wrap: pretty;
}

table {
    border-collapse: collapse;
    width: 100%;
}

button {
    font: inherit;
}

::selection {
    background: var(--brand);
    color: var(--brand-contrast);
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ---------- typography primitives ---------- */

.micro {
    font-family: var(--font-mono);
    font-size: 0.69rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.micro .idx {
    color: var(--brand);
}

.mono {
    font-family: var(--font-mono);
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.muted {
    color: var(--muted);
}

.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- layout ---------- */

.shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px;
}

.shell.narrow {
    max-width: 780px;
}

.page {
    padding: 40px 0 96px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid var(--rule-strong);
    margin-bottom: 2rem;
}

.page-head h1 {
    font-size: clamp(1.7rem, 3.2vw, 2.4rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.page-head .lede {
    color: var(--muted);
    font-size: 0.95rem;
    max-width: 54ch;
    margin-top: 0.35rem;
}

.head-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 2.4rem;
}

.split-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 2.4rem;
    align-items: start;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.section-head h2 {
    font-size: 1.3rem;
    letter-spacing: -0.018em;
}

/* ---------- nav ---------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--paper) 85%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid var(--rule);
}

.nav .shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 2rem;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 2.2rem;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* The mark is artwork, not a styled letterform. Its own rounded corners come
   from the SVG so it stays crisp at any size. */
.mark {
    display: block;
    flex-shrink: 0;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.015em;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    position: relative;
    font-size: 0.86rem;
    color: var(--muted);
    transition: color 0.15s ease;
    padding: 0.2rem 0;
    white-space: nowrap;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 1px;
    width: 100%;
    background: var(--brand);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.nav-links a:hover {
    color: var(--ink);
}

.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after {
    transform: scaleX(1);
}

.nav-links a[aria-current="page"] {
    color: var(--ink);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    height: 40px;
    min-width: 40px;
    padding: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-s);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
    color: var(--ink);
    border-color: var(--ink);
    background: var(--surface);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.6rem;
    border-left: 1px solid var(--rule);
    margin-left: 0.2rem;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--rule);
    background: var(--surface);
    color: var(--ink);
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.nav-toggle {
    display: none;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 1.15rem;
    border-radius: var(--radius-s);
    border: 1px solid var(--rule-strong);
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-body);
    font-size: 0.87rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
        transform 0.1s ease;
}

.btn:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-contrast);
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled:hover {
    background: var(--ink);
    border-color: var(--rule-strong);
    color: var(--paper);
}

.btn.ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule);
}

.btn.ghost:hover {
    border-color: var(--ink);
    background: var(--surface);
    color: var(--ink);
}

.btn.danger:hover {
    background: var(--st-down);
    border-color: var(--st-down);
    color: #fff;
}

.btn.small {
    height: 32px;
    padding: 0 0.75rem;
    font-size: 0.8rem;
    position: relative;
}

/* The visible button stays 32px; the touch target does not. */
.btn.small::before {
    content: "";
    position: absolute;
    inset: -4px;
}

.btn.block {
    width: 100%;
}

.btn .arrow {
    transition: transform 0.15s ease;
}

.btn:hover .arrow {
    transform: translateX(3px);
}

.textlink {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    transition: color 0.15s ease;
}

.textlink:hover {
    color: var(--brand);
}

.linkish {
    color: var(--muted);
    transition: color 0.15s ease;
}

.linkish:hover {
    color: var(--brand);
}

/* ---------- chips, pills, status ---------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 24px;
    padding: 0 0.55rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-s);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted);
    background: var(--card);
    white-space: nowrap;
}

.chip.accent {
    color: var(--brand);
    border-color: var(--brand-border);
    background: var(--brand-soft);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.3rem 0.62rem;
    border-radius: 999px;
    border: 1px solid var(--rule);
    color: var(--muted);
    background: var(--card);
    white-space: nowrap;
}

.pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.pill.draft {
    color: var(--muted);
}

.pill.submitted {
    color: var(--st-pending);
    border-color: color-mix(in srgb, var(--st-pending) 40%, transparent);
    background: color-mix(in srgb, var(--st-pending) 8%, transparent);
}

.pill.approved {
    color: var(--st-up);
    border-color: color-mix(in srgb, var(--st-up) 40%, transparent);
    background: color-mix(in srgb, var(--st-up) 8%, transparent);
}

.pill.rejected {
    color: var(--st-down);
    border-color: color-mix(in srgb, var(--st-down) 40%, transparent);
    background: color-mix(in srgb, var(--st-down) 8%, transparent);
}

.role-tag {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.role-tag.admin {
    color: var(--brand);
}

/* ---------- panels ---------- */

.panel {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-m);
    overflow: hidden;
}

.panel.raised {
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid var(--rule);
    flex-wrap: wrap;
}

.panel-body {
    padding: 1.2rem;
}

.panel-foot {
    padding: 0.85rem 1.2rem;
    border-top: 1px solid var(--rule);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Definition rows, the unarii spec-sheet pattern. */
.spec-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 1rem;
    padding: 0.7rem 1.2rem;
    align-items: baseline;
}

.spec-row + .spec-row {
    border-top: 1px solid var(--rule);
}

.spec-row dt {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.spec-row dd {
    font-size: 0.92rem;
}

/* ---------- ledger table ---------- */

.ledger {
    width: 100%;
    font-size: 0.9rem;
}

.ledger thead th {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    padding: 0.7rem 0.85rem;
    background: var(--surface);
    border-bottom: 1px solid var(--rule-strong);
    white-space: nowrap;
}

.ledger tbody td {
    padding: 0.8rem 0.85rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: baseline;
}

.ledger tbody tr {
    transition: background 0.15s ease;
}

.ledger tbody tr:hover {
    background: var(--surface);
}

.ledger tbody tr.is-total {
    background: transparent;
}

.ledger tbody tr.is-total td {
    border-top: 1px solid var(--rule-strong);
    border-bottom: 0;
    font-weight: 600;
    padding-top: 0.9rem;
}

.ledger .right {
    text-align: right;
}

.ledger .center {
    text-align: center;
}

.ledger td.num,
.ledger th.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    text-align: right;
    white-space: nowrap;
}

/* Row actions stay legible at rest and firm up on hover. They are never
   hidden outright: a touch device has no hover state, and an action nobody
   can see is an action nobody uses. */
.ledger .row-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
    opacity: 0.62;
    transition: opacity 0.15s ease;
}

.ledger tbody tr:hover .row-actions,
.ledger tbody tr:focus-within .row-actions {
    opacity: 1;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cell-strong {
    font-weight: 500;
}

.cell-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

/* ---------- week grid ---------- */

.weekbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
}

.week-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.week-label {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    min-width: 0;
}

.week-range {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 0.15rem;
}

.grid-day {
    text-align: right;
    min-width: 62px;
}

.grid-day .dow {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.grid-day .dom {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.02em;
    margin-top: 0.1rem;
}

.grid-day.rest .dow,
.grid-day.rest .dom {
    color: var(--muted);
}

th.grid-day.rest {
    background: var(--surface);
}

.grid-day.today .dow {
    color: var(--brand);
}

th.grid-day.today,
td.grid-cell.today {
    background: var(--brand-soft);
}

.grid-cell {
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.grid-cell.zero {
    color: color-mix(in srgb, var(--muted) 45%, transparent);
}

.grid-total {
    font-weight: 600;
}

/* ---------- forms ---------- */

.form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* The uppercase mono micro-label is the field's name, not every label inside
   it: a checkbox's own label is sentence-case body text sitting beside the box. */
.field > label:not(.check),
.field-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="month"],
input[type="number"],
input[type="search"],
select,
textarea {
    font: inherit;
    font-size: 0.92rem;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-s);
    padding: 0.6rem 0.75rem;
    width: 100%;
    transition: border-color 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: color-mix(in srgb, var(--ink) 28%, var(--rule));
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-color: transparent;
}

textarea {
    resize: vertical;
    min-height: 76px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b5f64' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a89aa0' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--brand);
    cursor: pointer;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.hint {
    font-size: 0.78rem;
    color: var(--muted);
}

.field-error {
    font-size: 0.8rem;
    color: var(--brand);
    font-weight: 500;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form .field {
    min-width: 150px;
}

.filters {
    display: flex;
    gap: 0.9rem;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 1rem 1.2rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-m);
    background: var(--card);
    margin-bottom: 1.6rem;
}

.filters .field {
    min-width: 148px;
}

/* Sits on the input row rather than under a label of its own. */
.filter-check {
    height: 38px;
    white-space: nowrap;
}

/* ---------- entry rows ---------- */

.entries {
    border-top: 1px solid var(--rule-strong);
}

.entry {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) 72px auto;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 0.6rem;
    border-bottom: 1px solid var(--rule);
    transition: background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: inset 2px 0 0 transparent;
}

.entry:hover {
    background: var(--surface);
    box-shadow: inset 2px 0 0 var(--brand);
}

.entry-date {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.entry-what {
    min-width: 0;
}

.entry-project {
    font-weight: 500;
    font-size: 0.92rem;
}

.entry-note {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.1rem;
    overflow-wrap: anywhere;
}

.entry-hours {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-size: 0.95rem;
}

.entry-actions {
    display: flex;
    gap: 0.35rem;
    opacity: 0.62;
    transition: opacity 0.15s ease;
}

.entry:hover .entry-actions,
.entry:focus-within .entry-actions {
    opacity: 1;
}

/* ---------- report bars ---------- */

.bar-track {
    height: 4px;
    background: var(--surface);
    border-radius: 2px;
    overflow: hidden;
    min-width: 90px;
}

.bar-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 2px;
}

.stat-rail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    border-top: 1px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule);
}

.stat {
    padding: 1.1rem 1.2rem 1.2rem;
}

.stat + .stat {
    border-left: 1px solid var(--rule);
}

.stat .value {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 500;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    margin-top: 0.3rem;
}

.stat .value.accent {
    color: var(--brand);
}

/* ---------- empty & notices ---------- */

.empty {
    border: 1px dashed var(--rule);
    border-radius: var(--radius-m);
    padding: 2.6rem 1.5rem;
    text-align: center;
    color: var(--muted);
    background: var(--card);
}

.empty h3 {
    font-size: 1.05rem;
    color: var(--ink);
    margin-bottom: 0.35rem;
    letter-spacing: -0.01em;
}

.empty p {
    font-size: 0.9rem;
    max-width: 44ch;
    margin: 0 auto;
}

.notice {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    border: 1px solid var(--rule);
    border-left: 3px solid var(--muted);
    border-radius: var(--radius-s);
    background: var(--surface);
    font-size: 0.88rem;
}

.notice.warn {
    border-left-color: var(--st-pending);
}

.notice.error {
    border-left-color: var(--st-down);
    color: var(--st-down);
}

.notice.accent {
    border-left-color: var(--brand);
    background: var(--brand-soft);
}

/* ---------- toasts ---------- */

.toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius-s);
    padding: 0.7rem 1rem;
    font-size: 0.87rem;
    box-shadow: var(--shadow);
    animation: toast-in 0.28s cubic-bezier(0.2, 0, 0, 1);
}

.toast.error {
    background: var(--st-down);
    color: #fff;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* ---------- dialog ---------- */

dialog {
    border: 1px solid var(--rule);
    border-radius: var(--radius-m);
    background: var(--card);
    color: var(--ink);
    padding: 0;
    max-width: 520px;
    width: calc(100% - 40px);
    box-shadow: var(--shadow);
}

dialog[open] {
    animation: dialog-in 0.18s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes dialog-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
}

dialog::backdrop {
    background: color-mix(in srgb, var(--ink) 45%, transparent);
    backdrop-filter: blur(2px);
}

.dialog-head {
    padding: 1.1rem 1.3rem 0.9rem;
    border-bottom: 1px solid var(--rule);
}

.dialog-head h2 {
    font-size: 1.1rem;
    letter-spacing: -0.015em;
}

.dialog-body {
    padding: 1.3rem;
}

.dialog-foot {
    padding: 0.9rem 1.3rem;
    border-top: 1px solid var(--rule);
    background: var(--surface);
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

/* ---------- tabs ---------- */

.tabs {
    display: flex;
    gap: 1.4rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 1.8rem;
    overflow-x: auto;
}

.tabs a {
    position: relative;
    padding: 0.55rem 0;
    font-size: 0.88rem;
    color: var(--muted);
    white-space: nowrap;
    transition: color 0.15s ease;
}

.tabs a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 1px;
    width: 100%;
    background: var(--brand);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.tabs a:hover {
    color: var(--ink);
}

.tabs a:hover::after,
.tabs a[aria-current="page"]::after {
    transform: scaleX(1);
}

.tabs a[aria-current="page"] {
    color: var(--ink);
}

/* ---------- login ---------- */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth .mark {
    margin-bottom: 1.6rem;
}

.auth h1 {
    font-size: 2rem;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.auth .lede {
    color: var(--muted);
    margin-top: 0.6rem;
    font-size: 0.95rem;
    max-width: 40ch;
}

.auth-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.auth-foot {
    margin-top: 2.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--rule);
}

/* ---------- htmx ---------- */

.htmx-request .btn,
.btn.htmx-request {
    opacity: 0.6;
    pointer-events: none;
}

[data-loading] {
    display: none;
}

.htmx-request [data-loading] {
    display: inline-flex;
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
    .split-2 {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 860px) {
    .shell {
        padding: 0 20px;
    }

    .nav-links {
        display: none;
    }

    .nav-links.open {
        display: flex;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: var(--paper);
        border-bottom: 1px solid var(--rule);
        padding: 0.5rem 20px 1rem;
    }

    .nav-links.open a {
        padding: 0.7rem 0;
        border-bottom: 1px solid var(--rule);
        font-size: 0.95rem;
    }

    .nav-links.open a::after {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .page {
        padding: 28px 0 72px;
    }

    .entry {
        grid-template-columns: 72px minmax(0, 1fr) 62px;
        row-gap: 0.4rem;
    }

    .entry-actions {
        grid-column: 1 / -1;
        opacity: 1;
        justify-content: flex-start;
    }

    .stat + .stat {
        border-left: 0;
        border-top: 1px solid var(--rule);
    }
}

@media (max-width: 560px) {
    .field-row {
        grid-template-columns: 1fr;
    }

    .page-head {
        align-items: flex-start;
    }

    .brand-name {
        display: none;
    }
}

@media print {
    .nav,
    .head-actions,
    .filters,
    .toasts,
    .row-actions,
    .entry-actions {
        display: none !important;
    }

    body::before {
        display: none;
    }

    body {
        background: #fff;
        color: #000;
    }
}

/* ---------- radio choice ---------- */

/* Used where a decision has consequences worth reading before clicking, so the
   options carry their explanation rather than hiding it in a tooltip. */
.choice {
    border: 1px solid var(--rule);
    border-radius: var(--radius-s);
    padding: 0.9rem 1rem 1rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.choice legend {
    padding: 0 0.4rem;
}

.choice-option {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
}

.choice-option input {
    margin-top: 0.2rem;
    accent-color: var(--brand);
    flex-shrink: 0;
}

.choice-option > span {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.choice-option strong {
    font-size: 0.9rem;
    font-weight: 500;
}

.choice-option:has(input:checked) strong {
    color: var(--brand);
}

/* A superseded rate stays visible but recedes: it is history, not a choice. */
.ledger tbody tr.is-superseded td {
    color: var(--muted);
}

.ledger tbody tr.is-superseded .num {
    text-decoration: line-through;
    text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent);
}

/* ---------- duration stepper ---------- */

/* A timesheet is kept to the quarter hour, so the primary interaction is
   pressing rather than typing. The field stays a real input underneath: the
   buttons are an enhancement, and an exact figure can still be typed. */
.stepper {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--rule);
    border-radius: var(--radius-s);
    background: var(--card);
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.stepper:hover {
    border-color: color-mix(in srgb, var(--ink) 28%, var(--rule));
}

.stepper:focus-within {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-color: transparent;
}

.stepper-btn {
    width: 38px;
    flex-shrink: 0;
    border: 0;
    background: var(--surface);
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.stepper-btn:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.stepper-btn:active {
    transform: scale(0.96);
}

.stepper-value {
    border: 0 !important;
    outline: none !important;
    text-align: center;
    font-size: 1.05rem !important;
    font-weight: 500;
    padding: 0.5rem 0 !important;
    background: transparent;
    min-width: 0;
}

/* The stepper draws the focus ring for the whole control. */
.stepper-value:focus-visible {
    outline: none !important;
}

/* A fixed grid rather than wrapping flex: six presets land as a tidy 3x2
   block instead of five across and one stranded on its own row. */
.presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
}

.preset {
    padding: 0.36rem 0.5rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-s);
    background: var(--card);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.preset:hover {
    color: var(--ink);
    border-color: var(--ink);
    background: var(--surface);
}

.preset.is-active {
    color: var(--brand);
    border-color: var(--brand-border);
    background: var(--brand-soft);
}

/* A negative margin is the one number on the reports page that should catch
   the eye before it is read. */
.ledger .num.is-negative {
    color: var(--st-down);
}

/* ---------- budget burn ---------- */

.budget-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.bar-fill.is-warning {
    background: var(--st-pending);
}

.bar-fill.is-over {
    background: var(--st-down);
}

/* ---------- calendar ---------- */

.shell.wide {
    max-width: 1400px;
}

.cal {
    overflow: hidden;
}

.cal-head {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    border-bottom: 1px solid var(--rule-strong);
}

.cal-day-head {
    padding: 0.6rem 0.5rem;
    text-align: center;
    border-left: 1px solid var(--rule);
}

.cal-day-head .dow {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.cal-day-head .dom {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.1rem;
}

.cal-day-head.today .dow {
    color: var(--brand);
}

.cal-body {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
}

.cal-axis {
    display: flex;
    flex-direction: column;
}

.cal-hour {
    height: 44px;
    position: relative;
}

.cal-hour span {
    position: absolute;
    top: -0.55em;
    right: 8px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--muted);
}

.cal-hour:first-child span {
    top: 2px;
}

.cal-col {
    position: relative;
    border-left: 1px solid var(--rule);
}

.cal-col.rest {
    background: var(--surface);
}

.cal-day-head.rest {
    background: var(--surface);
}

.cal-holiday {
    display: block;
    margin-top: 0.15rem;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Today keeps the brand wash even when it falls on a rest day. */
.cal-col.today,
.cal-col.today.rest {
    background: var(--brand-soft);
}

.cal-slot {
    height: 44px;
    border-bottom: 1px solid color-mix(in srgb, var(--rule) 50%, transparent);
}

.cal-block {
    position: absolute;
    left: 3px;
    right: 3px;
    background: var(--card);
    border: 1px solid var(--brand-border);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius-s);
    padding: 0.25rem 0.45rem;
    overflow: hidden;
    font-size: 0.72rem;
    line-height: 1.35;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.cal-block:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
}

/* Dragging is the primary way in, so the surfaces say so: a day column
   invites a press, a block invites a move, its grip a resize. */
[data-editable="1"] .cal-col {
    cursor: crosshair;
    touch-action: none;
}

[data-editable="1"] .cal-block {
    cursor: grab;
}

.cal-block:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.cal-block.is-dragging {
    cursor: grabbing;
    opacity: 0.85;
    border-color: var(--brand);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    transition: none;
    user-select: none;
}

.cal-block-grip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 7px;
    cursor: ns-resize;
}

.cal-block-grip::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 18px;
    height: 2px;
    margin-left: -9px;
    border-radius: 1px;
    background: var(--rule-strong);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.cal-block:hover .cal-block-grip::after {
    opacity: 1;
}

/* The drag preview is the block that is about to exist. */
.cal-block.is-ghost {
    background: var(--brand-soft);
    border-style: dashed;
    border-color: var(--brand);
    pointer-events: none;
}

.cal-dialog {
    padding: 0;
    max-width: 460px;
    width: calc(100% - 2rem);
}

.cal-dialog .panel {
    border: 0;
    margin: 0;
}

.cal-block-time {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--muted);
}

.cal-block-code {
    display: block;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cal-block-note {
    display: block;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-untimed {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    border-top: 1px solid var(--rule-strong);
    background: var(--surface);
}

.cal-untimed .cal-axis-head {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.cal-untimed-col {
    padding: 0.5rem 0.35rem;
    border-left: 1px solid var(--rule);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-height: 44px;
}

/* ---------- entry working times ---------- */

details.times {
    border: 1px dashed var(--rule);
    border-radius: var(--radius-s);
    padding: 0.6rem 0.8rem;
}

details.times summary {
    cursor: pointer;
    list-style: none;
}

details.times summary::-webkit-details-marker {
    display: none;
}

details.times[open] summary {
    margin-bottom: 0.7rem;
}

.times-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.7rem;
}

@media (max-width: 860px) {
    .cal-day-head .dom {
        display: none;
    }
}

/* ---------- segmented day picker ---------- */

/* The date field offers exactly the seven days on screen, so it is seven
   buttons rather than a calendar popup with 365 wrong answers. Real radio
   inputs underneath: keyboard, forms and no-JS all work for free. */
.seg-field {
    border: 0;
    padding: 0;
    margin: 0;
}

.seg-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.seg {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.45rem 0.1rem 0.4rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-s);
    background: var(--card);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.seg input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.seg:hover {
    border-color: var(--ink);
    background: var(--surface);
}

.seg-dow {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.seg-dom {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.seg.is-today .seg-dow {
    color: var(--brand);
}

.seg:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.seg:has(input:checked) .seg-dow,
.seg:has(input:checked) .seg-dom {
    color: var(--brand);
}

.seg:has(input:focus-visible) {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Break chips reuse the segments at chip size. */
.seg-breaks {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.25rem;
}

.seg-sm {
    padding: 0.35rem 0.2rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

/* The times summary gets a disclosure marker that rotates, replacing the
   browser triangle. */
.times-marker {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 0.45rem;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    vertical-align: 2px;
}

details.times[open] .times-marker {
    transform: rotate(45deg);
}
