/*
 * Alchamentary client platform.
 *
 * One stylesheet, custom properties for the palette, no build step. It is
 * deliberately small: the interface is documents and forms, and a design system
 * with forty components would be forty components nobody maintains.
 *
 * There are no inline styles anywhere in the templates, because the
 * Content-Security-Policy has no unsafe-inline and keeping it that way is worth
 * more than the convenience.
 */

/* ---------------------------------------------------------------------------
   Palette
   --------------------------------------------------------------------------- */

:root {
    /* Warm paper and near-black ink: calm, printed, not a dashboard. */
    --paper:        #faf9f6;
    --surface:      #ffffff;
    --surface-sunk: #f4f2ec;
    --ink:          #1b1a17;
    --ink-muted:    #6b6559;
    --ink-faint:    #8f897c;
    --line:         #e4e0d7;
    --line-strong:  #cec9bd;

    /* A single accent, used sparingly. */
    --accent:        #14625c;
    --accent-strong: #0e4a45;
    --accent-wash:   #e6efee;

    --positive:      #2f6b3f;
    --positive-wash: #e8f0e9;
    --caution:       #8a5a12;
    --caution-wash:  #f6efe2;
    --danger:        #a03028;
    --danger-wash:   #f7e9e7;

    --focus: #14625c;

    --radius:       6px;
    --radius-small: 4px;

    --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
                 "Liberation Mono", monospace;

    --shadow-panel: 0 1px 2px rgb(27 26 23 / 5%);
    --shadow-float: 0 4px 16px rgb(27 26 23 / 10%);

    --sidebar-width: 232px;
    --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper:        #141412;
        --surface:      #1c1b19;
        --surface-sunk: #232220;
        --ink:          #eceae4;
        --ink-muted:    #a8a296;
        --ink-faint:    #837d72;
        --line:         #302e2b;
        --line-strong:  #45423d;

        --accent:        #63b3aa;
        --accent-strong: #8bcdc4;
        --accent-wash:   #1a2b29;

        --positive:      #79b98a;
        --positive-wash: #1a2620;
        --caution:       #d3a55f;
        --caution-wash:  #2a2318;
        --danger:        #e08a80;
        --danger-wash:   #2c1c1a;

        --focus: #8bcdc4;

        --shadow-panel: none;
        --shadow-float: 0 4px 20px rgb(0 0 0 / 45%);
    }
}

/* ---------------------------------------------------------------------------
   Base
   --------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0 0 0.5rem;
    line-height: 1.25;
    font-weight: 600;
    letter-spacing: -0.011em;
}

h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.975rem; }

p { margin: 0 0 1rem; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
a:hover { color: var(--accent-strong); }

small { font-size: 0.8125rem; }

code, kbd, .mono {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.5rem 0;
}

/* Visible focus everywhere, without exception. Removing it is how a keyboard
   user loses their place on the page. */
:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: var(--radius-small);
}

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 0.5rem;
    top: -3rem;
    z-index: 100;
    padding: 0.5rem 0.875rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    transition: top 120ms ease;
}
.skip-link:focus { top: 0.5rem; }

/* ---------------------------------------------------------------------------
   Application shell
   --------------------------------------------------------------------------- */

.shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    grid-column: 1;
    border-right: 1px solid var(--line);
    background: var(--surface);
    padding: 1.25rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0 0.5rem;
    text-decoration: none;
    color: inherit;
}
.brand-mark {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--accent);
}
.brand-name {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.nav-group { display: flex; flex-direction: column; gap: 0.125rem; }
.nav-group + .nav-group { margin-top: 1.25rem; }
.nav-group-title {
    padding: 0 0.5rem;
    margin-bottom: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.nav-link {
    display: block;
    padding: 0.4375rem 0.5rem;
    border-radius: var(--radius-small);
    color: var(--ink-muted);
    text-decoration: none;
    font-size: 0.9375rem;
}
.nav-link:hover { background: var(--surface-sunk); color: var(--ink); }
.nav-link[aria-current="page"] {
    background: var(--accent-wash);
    color: var(--accent-strong);
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding-top: 0.875rem;
}

.identity {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0.5rem;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-small);
}
.identity:hover { background: var(--surface-sunk); }
.avatar {
    flex: 0 0 auto;
    width: 28px; height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-wash);
    color: var(--accent-strong);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.identity-text { min-width: 0; }
.identity-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.identity-role { display: block; font-size: 0.75rem; color: var(--ink-faint); }

.main {
    grid-column: 2;
    min-width: 0;
    padding: 1.75rem 2rem 4rem;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-header .lede { color: var(--ink-muted); margin: 0.25rem 0 0; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.breadcrumb {
    font-size: 0.8125rem;
    color: var(--ink-faint);
    margin-bottom: 0.375rem;
}
.breadcrumb a { color: inherit; }

/* ---------------------------------------------------------------------------
   Signed-out layout
   --------------------------------------------------------------------------- */

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
}
.auth-card {
    width: 100%;
    max-width: 26rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
    padding: 1.75rem;
}
.auth-brand {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.auth-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    font-size: 0.875rem;
    color: var(--ink-muted);
}

/* ---------------------------------------------------------------------------
   Panels and layout helpers
   --------------------------------------------------------------------------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
}
.panel + .panel { margin-top: 1.25rem; }
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid var(--line);
}
.panel-header h2 { margin: 0; font-size: 0.9375rem; }
.panel-body { padding: 1.125rem; }
.panel-body > :last-child { margin-bottom: 0; }
.panel-footer {
    padding: 0.875rem 1.125rem;
    border-top: 1px solid var(--line);
    background: var(--surface-sunk);
    border-radius: 0 0 var(--radius) var(--radius);
}

.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: 0.375rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

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

.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }

/* ---------------------------------------------------------------------------
   Definition lists — the standard way this application shows record detail
   --------------------------------------------------------------------------- */

.detail-list {
    display: grid;
    grid-template-columns: minmax(9rem, auto) minmax(0, 1fr);
    gap: 0.5rem 1.25rem;
    margin: 0;
}
.detail-list dt {
    color: var(--ink-muted);
    font-size: 0.875rem;
}
.detail-list dd { margin: 0; }

/* ---------------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------------- */

.field { margin-bottom: 1.125rem; }
.field:last-child { margin-bottom: 0; }

label, .label {
    display: block;
    margin-bottom: 0.3125rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.hint {
    margin: 0.3125rem 0 0;
    font-size: 0.8125rem;
    color: var(--ink-muted);
    max-width: var(--measure);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="date"], input[type="number"],
select, textarea {
    width: 100%;
    padding: 0.4375rem 0.625rem;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-faint); }
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--focus);
    outline-offset: -1px;
    border-color: var(--focus);
}
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }

input::placeholder, textarea::placeholder { color: var(--ink-faint); }

textarea { min-height: 7rem; resize: vertical; }

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}
.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
    flex: 0 0 auto;
    margin-top: 0.3125rem;
    width: 1rem; height: 1rem;
    accent-color: var(--accent);
}
.checkbox + .checkbox { margin-top: 0.625rem; }
.checkbox .hint { display: block; font-weight: 400; }
.checkbox label { margin: 0; }

.code-input {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    letter-spacing: 0.3em;
    text-align: center;
}

.form-actions {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

fieldset { border: 0; padding: 0; margin: 0 0 1.125rem; }
legend { padding: 0; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; }

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.4375rem 0.875rem;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    border-radius: var(--radius-small);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.button:disabled { opacity: 0.55; cursor: not-allowed; }

.button-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.button-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }

.button-secondary {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
}
.button-secondary:hover:not(:disabled) { background: var(--surface-sunk); color: var(--ink); }

.button-danger {
    background: var(--surface);
    border-color: var(--danger);
    color: var(--danger);
}
.button-danger:hover:not(:disabled) { background: var(--danger-wash); color: var(--danger); }

.button-subtle {
    background: transparent;
    color: var(--ink-muted);
    padding: 0.25rem 0.5rem;
}
.button-subtle:hover:not(:disabled) { background: var(--surface-sunk); color: var(--ink); }

.button-small { font-size: 0.875rem; padding: 0.25rem 0.625rem; }

/* ---------------------------------------------------------------------------
   Messages
   --------------------------------------------------------------------------- */

.notice {
    display: flex;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line-strong);
    border-left-width: 3px;
    border-radius: var(--radius-small);
    background: var(--surface);
    margin-bottom: 1.25rem;
}
.notice p { margin: 0; }
.notice-success { border-left-color: var(--positive); background: var(--positive-wash); }
.notice-error   { border-left-color: var(--danger);   background: var(--danger-wash); }
.notice-caution { border-left-color: var(--caution);  background: var(--caution-wash); }
.notice-info    { border-left-color: var(--accent);   background: var(--accent-wash); }

.field-error {
    margin: 0.3125rem 0 0;
    font-size: 0.875rem;
    color: var(--danger);
}

/* ---------------------------------------------------------------------------
   Status pills
   --------------------------------------------------------------------------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.0625rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    border: 1px solid var(--line-strong);
    background: var(--surface-sunk);
    color: var(--ink-muted);
    white-space: nowrap;
}
.pill-active   { background: var(--positive-wash); border-color: transparent; color: var(--positive); }
.pill-pending  { background: var(--caution-wash);  border-color: transparent; color: var(--caution); }
.pill-disabled { background: var(--surface-sunk);  border-color: transparent; color: var(--ink-faint); }
.pill-danger   { background: var(--danger-wash);   border-color: transparent; color: var(--danger); }
.pill-accent   { background: var(--accent-wash);   border-color: transparent; color: var(--accent-strong); }

/* ---------------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}
table.data caption {
    text-align: left;
    padding: 0 0 0.625rem;
    color: var(--ink-muted);
    font-size: 0.875rem;
}
table.data th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}
table.data td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-sunk); }
table.data th:first-child, table.data td:first-child { padding-left: 1.125rem; }
table.data th:last-child,  table.data td:last-child  { padding-right: 1.125rem; }

.cell-primary { font-weight: 500; }
.cell-secondary { color: var(--ink-muted); font-size: 0.875rem; }

/* ---------------------------------------------------------------------------
   Filters, pagination, empty states
   --------------------------------------------------------------------------- */

.filters {
    display: flex;
    gap: 0.625rem;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid var(--line);
}
.filters .field { margin: 0; }
.filters label { font-size: 0.75rem; color: var(--ink-muted); }
.filters input, .filters select { min-width: 9rem; }
.filters .grow { flex: 1 1 14rem; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--ink-muted);
}

.empty {
    padding: 2.5rem 1.125rem;
    text-align: center;
    color: var(--ink-muted);
}
.empty h3 { color: var(--ink); }

/* ---------------------------------------------------------------------------
   Prompts on the dashboard
   --------------------------------------------------------------------------- */

.prompt {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid var(--line);
}
.prompt:last-child { border-bottom: 0; }
.prompt-title { font-weight: 500; }
.prompt-detail { color: var(--ink-muted); font-size: 0.875rem; margin: 0.125rem 0 0; }
.prompt-urgent .prompt-title { color: var(--caution); }

.figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}
.figure {
    padding: 1rem 1.125rem;
    border-right: 1px solid var(--line);
}
.figure:last-child { border-right: 0; }
.figure-value {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.figure-label { font-size: 0.8125rem; color: var(--ink-muted); }

/* ---------------------------------------------------------------------------
   Codes: recovery codes and the two-factor secret
   --------------------------------------------------------------------------- */

.secret-block {
    padding: 0.875rem 1rem;
    background: var(--surface-sunk);
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    font-family: var(--font-mono);
    font-size: 1rem;
    letter-spacing: 0.08em;
    word-break: break-all;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}
.recovery-codes li {
    padding: 0.4375rem 0.625rem;
    background: var(--surface-sunk);
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    text-align: center;
}

.metadata {
    margin: 0;
    padding: 0.625rem 0.75rem;
    background: var(--surface-sunk);
    border-radius: var(--radius-small);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

/* ---------------------------------------------------------------------------
   Error page
   --------------------------------------------------------------------------- */

.error-status {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    margin-bottom: 0.375rem;
}
.error-reference {
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: var(--ink-faint);
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

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

@media (max-width: 720px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        grid-column: 1;
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    .sidebar nav { width: 100%; }
    .nav-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    .nav-group-title { display: none; }
    .sidebar-footer {
        margin: 0 0 0 auto;
        border-top: 0;
        padding-top: 0;
    }
    .main { grid-column: 1; padding: 1.25rem 1rem 3rem; }
    .figure { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .sidebar, .page-actions, .form-actions, .skip-link { display: none; }
    .shell { grid-template-columns: 1fr; }
    body { background: #fff; }
}

/* ---------------------------------------------------------------------------
   Record tabs — the universal entity header (§75)
   --------------------------------------------------------------------------- */

.tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.5rem;
}
.tab {
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    color: var(--ink-muted);
    text-decoration: none;
    font-size: 0.9375rem;
}
.tab:hover { color: var(--ink); }
.tab-current {
    color: var(--ink);
    border-bottom-color: var(--accent);
    font-weight: 500;
}
.tab-count {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    background: var(--surface-sunk);
    font-size: 0.75rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

.tag-row { margin-top: 0.375rem; }
.text-caution { color: var(--caution); }

/* ---------------------------------------------------------------------------
   Pipeline board
   --------------------------------------------------------------------------- */

.board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(15rem, 1fr);
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    align-items: start;
}

.board-column {
    background: var(--surface-sunk);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-width: 0;
}
.board-column-header {
    padding: 0.75rem 0.875rem 0.5rem;
    border-bottom: 1px solid var(--line);
}
.board-column-header h2 { margin: 0; font-size: 0.875rem; }
.board-column-figure {
    margin: 0.125rem 0 0;
    font-size: 0.8125rem;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
}
.board-cards { padding: 0.625rem; display: flex; flex-direction: column; gap: 0.625rem; }
.board-empty { margin: 0; padding: 0.75rem 0.25rem; color: var(--ink-faint); font-size: 0.875rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-small);
    padding: 0.625rem 0.75rem;
}
.card-stale { border-left-color: var(--caution); }
.card-title {
    display: block;
    font-weight: 500;
    color: inherit;
    text-decoration: none;
    line-height: 1.35;
}
.card-title:hover { color: var(--accent); }
.card-org { margin: 0.125rem 0 0; font-size: 0.8125rem; color: var(--ink-muted); }
.card-figures { margin: 0.375rem 0 0; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.card-next {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--ink-muted);
    padding-top: 0.375rem;
    border-top: 1px solid var(--line);
}
.card-next-date { display: block; color: var(--ink-faint); }
.card-next-overdue, .card-next-missing { color: var(--caution); }
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--ink-faint);
}

/* ---------------------------------------------------------------------------
   Notes
   --------------------------------------------------------------------------- */

.note-list { border-top: 1px solid var(--line); }
.note {
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid var(--line);
}
.note:last-child { border-bottom: 0; }
.note-shared { background: var(--accent-wash); }
.note-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}
.note-author { font-weight: 500; font-size: 0.875rem; }
.note-when { font-size: 0.8125rem; color: var(--ink-faint); }
.note-delete { margin-left: auto; }
.note-body { margin: 0; white-space: pre-wrap; }

/* ---------------------------------------------------------------------------
   Activity timeline
   --------------------------------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-entry {
    display: grid;
    grid-template-columns: 1rem minmax(0, 1fr);
    gap: 0.75rem;
    padding-bottom: 1rem;
    position: relative;
}
.timeline-entry:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 0.4375rem;
    top: 1rem;
    bottom: 0;
    width: 1px;
    background: var(--line);
}
.timeline-marker {
    width: 0.5rem; height: 0.5rem;
    margin-top: 0.4375rem;
    border-radius: 50%;
    background: var(--accent);
    flex: 0 0 auto;
}
.timeline-content { min-width: 0; }
.timeline-action { margin: 0; font-size: 0.9375rem; }
.timeline-meta { margin: 0.125rem 0 0; font-size: 0.8125rem; color: var(--ink-faint); }
.timeline-content .metadata { margin-top: 0.375rem; }

/* ---------------------------------------------------------------------------
   Search
   --------------------------------------------------------------------------- */

.search-group + .search-group { margin-top: 1.5rem; }
.search-group-title {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 0.375rem;
}
.search-list { list-style: none; margin: 0; padding: 0; }
.search-hit {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-small);
    text-decoration: none;
    color: inherit;
}
.search-hit:hover { background: var(--surface-sunk); }
.search-hit-title { font-weight: 500; }
.search-hit-context { color: var(--ink-faint); font-size: 0.875rem; text-align: right; }

@media (max-width: 720px) {
    .board { grid-auto-flow: row; grid-auto-columns: auto; }
}
