/* ==========================================================================
   The Logger — "Workshop Ledger" design system.
   Source of truth: /DESIGN.md (tokens, rules). Every colour below is a named
   token there; define each token once, here, and use var(--token) elsewhere.

   Order: @font-face, tokens (light, dark, OS-dark fallback), base, focus,
   typography. Later phases add components below this block.

   Base and component rules are scoped to html[data-ledger], which every layout sets.
   (The attribute began as a migration gate; it is harmless to keep and costs nothing.)
   ========================================================================== */

/* ---------- Fonts (self-hosted; CSP allows font-src 'self') ---------- */
@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('/lib/fraunces/fraunces-latin-opsz-normal.woff2') format('woff2');
    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: 'Fraunces';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('/lib/fraunces/fraunces-latin-ext-opsz-normal.woff2') format('woff2');
    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: 'JetBrains Mono';
    font-style: normal;
    font-display: swap;
    font-weight: 100 800;
    src: url('/lib/jetbrains-mono/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
    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';
    font-style: normal;
    font-display: swap;
    font-weight: 100 800;
    src: url('/lib/jetbrains-mono/jetbrains-mono-latin-ext-wght-normal.woff2') format('woff2');
    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;
}
/* Inter (moved here from the retired site.css) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('/lib/inter/inter-latin-wght-normal.woff2') format('woff2');
    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: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('/lib/inter/inter-latin-ext-wght-normal.woff2') format('woff2');
    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;
}

/* ---------- Tokens: light (default) ---------- */
:root {
    /* paper and ink */
    --paper: #f3eee1;
    --surface: #fbf8ef;
    --surface-sunk: #ece5d3;
    --ink: #1c231e;
    --ink-2: #4f564d;          /* secondary text, 6.6:1 on paper */
    --ink-3: #5d6358;          /* tertiary, 5.2:1 on paper, 4.9:1 on sunk */
    --field: #857a5b;          /* input and control borders, 3.7:1 on paper (non-text 3:1) */
    --rule: #d6ccb2;
    --rule-strong: #b9ac8a;
    /* fescue (primary) */
    --fescue: #2c5b39;
    --fescue-hover: #234a2e;
    --fescue-wash: #dfe8d4;
    --on-fescue: #f7f3e6;
    /* status */
    --ochre: #7a500f;
    --ochre-wash: #f1e1bd;
    --brick: #9c3524;
    --brick-wash: #f0d9d1;
    --focus: #1f5fa8;
    /* depth */
    --shadow-page: 0 1px 0 var(--rule), 0 18px 32px -18px rgba(52, 38, 10, .38);
    --margin-rule: color-mix(in srgb, #9c3524 45%, transparent);
    /* closing band on the public pages */
    --final-bg: #2c5b39;
    --final-ink: #f7f3e6;
    --final-btn-bg: #f7f3e6;
    --final-btn-fg: #2c5b39;
    /* type */
    --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-data: 'JetBrains Mono', ui-monospace, Consolas, monospace;
    /* motion */
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    color-scheme: light;
}

/* ---------- Tokens: dark (explicit choice) ---------- */
:root[data-theme="dark"] {
    --paper: #121813;
    --surface: #1a221b;
    --surface-sunk: #0e130f;
    --ink: #ece6d4;
    --ink-2: #b5b9a8;
    --ink-3: #959a8a;
    --field: #657c69;
    --rule: #2b372d;
    --rule-strong: #3d4c3f;
    --fescue: #8cc79a;
    --fescue-hover: #a6d8b2;
    --fescue-wash: #223527;
    --on-fescue: #0f1a12;
    --ochre: #e2b25f;
    --ochre-wash: #3a2f15;
    --brick: #ec9a86;
    --brick-wash: #3b211b;
    --focus: #7db4f0;
    --shadow-page: 0 1px 0 var(--rule), 0 18px 32px -18px rgba(0, 0, 0, .7);
    --margin-rule: color-mix(in srgb, #ec9a86 40%, transparent);
    --final-bg: #1d3524;
    --final-ink: #ece6d4;
    --final-btn-bg: #8cc79a;
    --final-btn-fg: #0f1a12;
    color-scheme: dark;
}

/* ---------- Tokens: dark by OS preference, when no explicit choice is set ----------
   Must repeat every token the dark block changes (the mockup missed --field and the
   closing-band tokens here). Keep this list identical to the block above. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --paper: #121813;
        --surface: #1a221b;
        --surface-sunk: #0e130f;
        --ink: #ece6d4;
        --ink-2: #b5b9a8;
        --ink-3: #959a8a;
        --field: #657c69;
        --rule: #2b372d;
        --rule-strong: #3d4c3f;
        --fescue: #8cc79a;
        --fescue-hover: #a6d8b2;
        --fescue-wash: #223527;
        --on-fescue: #0f1a12;
        --ochre: #e2b25f;
        --ochre-wash: #3a2f15;
        --brick: #ec9a86;
        --brick-wash: #3b211b;
        --focus: #7db4f0;
        --shadow-page: 0 1px 0 var(--rule), 0 18px 32px -18px rgba(0, 0, 0, .7);
        --margin-rule: color-mix(in srgb, #ec9a86 40%, transparent);
        --final-bg: #1d3524;
        --final-ink: #ece6d4;
        --final-btn-bg: #8cc79a;
        --final-btn-fg: #0f1a12;
        color-scheme: dark;
    }
}

/* ---------- Base (gated) ---------- */
html[data-ledger] { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
html[data-ledger] body {
    background: var(--paper);
    color: var(--ink);
    font: 400 1rem/1.6 var(--font-ui);
    font-feature-settings: "cv11", "ss03";
}
html[data-ledger] ::selection { background: var(--fescue); color: var(--on-fescue); }
html[data-ledger] input,
html[data-ledger] select,
html[data-ledger] textarea { caret-color: var(--fescue); }
html[data-ledger] * { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
html[data-ledger] a { color: var(--fescue); text-underline-offset: .22em; text-decoration-thickness: 1px; }
html[data-ledger] a:hover { color: var(--fescue-hover); }

/* ---------- Focus (gated) ---------- */
html[data-ledger] :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

/* ---------- Typography (gated) ---------- */
html[data-ledger] h1,
html[data-ledger] h2,
html[data-ledger] h3,
html[data-ledger] .display-1,
html[data-ledger] .display-2,
html[data-ledger] .display-3,
html[data-ledger] .display-4,
html[data-ledger] .display-5,
html[data-ledger] .display-6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--ink);
}
html[data-ledger] h1 { font-variation-settings: "opsz" 144; line-height: 1.05; }
html[data-ledger] h2 { font-variation-settings: "opsz" 120; line-height: 1.1; }
html[data-ledger] h3 { font-variation-settings: "opsz" 48; line-height: 1.3; }
/* Data: dates, quantities, ids. Tabular so columns of numbers align. */
html[data-ledger] .num,
html[data-ledger] time,
html[data-ledger] td.mono,
html[data-ledger] .mono {
    font-family: var(--font-data);
    font-variant-numeric: tabular-nums;
    font-size: .875em;
    letter-spacing: -.01em;
}

/* ==========================================================================
   Form system (gated). Used by the field pilots; Phase 5 applies it everywhere.
   ========================================================================== */
html[data-ledger] .f-label { display: flex; align-items: baseline; gap: .5rem; font: 600 .8125rem/1.4 var(--font-ui); color: var(--ink); margin: 0 0 .35rem; }
html[data-ledger] .f-label .req,
html[data-ledger] .f-label .opt { font-weight: 500; font-size: .75rem; color: var(--ink-3); }
html[data-ledger] .f-label .req { color: var(--ink-2); }
html[data-ledger] .field-error-msg { display: flex; gap: .4rem; align-items: flex-start; margin: .4rem 0 0; color: var(--brick); font: 500 .875rem/1.4 var(--font-ui); }
html[data-ledger] .field-error-msg .ei { flex: none; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--brick); color: var(--paper); font: 700 .75rem/1.1rem var(--font-ui); text-align: center; margin-top: .1rem; }

/* ==========================================================================
   Syncfusion override layer (gated). The ej2 bootstrap5 / bootstrap5-dark theme
   is still loaded underneath; everything here restyles it from the tokens, so
   one rule set serves both themes. Selectors lead with html[data-ledger] to
   out-rank the theme file.
   ========================================================================== */

/* ---- inputs (textbox, textarea, dropdown, date/time, multiselect) ---- */
html[data-ledger] body .e-input-group,
html[data-ledger] body .e-input-group.e-control-wrapper,
html[data-ledger] body .e-float-input,
html[data-ledger] body .e-float-input.e-control-wrapper,
html[data-ledger] body .e-multi-select-wrapper {
    background: var(--paper) !important;
    color: var(--ink);
    border: 1px solid var(--field) !important;
    border-radius: 3px;
    box-shadow: none !important;
    font-family: var(--font-ui);
}
html[data-ledger] body .e-input-group input.e-input,
html[data-ledger] body .e-input-group.e-control-wrapper textarea.e-input,
html[data-ledger] body .e-input-group.e-control-wrapper.e-readonly input.e-input,
html[data-ledger] body .e-float-input.e-control-wrapper input[readonly],
html[data-ledger] body .e-input-group.e-control-wrapper input.e-input,
html[data-ledger] body .e-float-input input,
html[data-ledger] body .e-float-input textarea,
html[data-ledger] body .e-multi-select-wrapper input[type="text"] {
    background: transparent !important;
    color: var(--ink);
    border: 0 !important;
    box-shadow: none !important;
    font: 400 1rem/1.5 var(--font-ui);
}
html[data-ledger] body .e-input-group .e-input::placeholder,
html[data-ledger] body .e-float-input input::placeholder,
html[data-ledger] body .e-multi-select-wrapper input::placeholder { color: var(--ink-3); opacity: 1 !important; }
html[data-ledger] body .e-float-input label.e-float-text,
html[data-ledger] body .e-float-input.e-control-wrapper label.e-float-text { color: var(--ink-2); font: 600 .8125rem/1.4 var(--font-ui); }
html[data-ledger] body .e-input-group:hover:not(.e-disabled):not(.e-error):not(.e-input-focus),
html[data-ledger] body .e-input-group.e-control-wrapper:hover:not(.e-disabled):not(.e-error):not(.e-input-focus) { border-color: var(--ink-3) !important; }
html[data-ledger] body .e-input-group.e-input-focus,
html[data-ledger] body .e-input-group.e-control-wrapper.e-input-focus,
html[data-ledger] body .e-float-input.e-input-focus,
html[data-ledger] body .e-multi-select-wrapper.e-input-focus {
    border-color: var(--focus) !important;
    box-shadow: 0 0 0 1px var(--focus) !important;
}
html[data-ledger] body .e-float-input.e-input-focus label.e-float-text { color: var(--ink); }
html[data-ledger] body .e-input-group.e-error,
html[data-ledger] body .e-input-group.e-control-wrapper.e-error,
html[data-ledger] body .e-float-input.e-error,
html[data-ledger] body .e-multi-select-wrapper.e-error { border-color: var(--brick) !important; box-shadow: 0 0 0 1px var(--brick) !important; background: var(--paper) !important; }
html[data-ledger] body .e-float-input.e-error label.e-float-text { color: var(--brick); }
html[data-ledger] body .e-input-group.e-disabled,
html[data-ledger] body .e-input-group.e-control-wrapper.e-disabled,
html[data-ledger] body .e-float-input.e-disabled { background: var(--surface-sunk) !important; border-color: var(--rule-strong) !important; opacity: 1 !important; }
html[data-ledger] body .e-input-group.e-disabled input.e-input,
html[data-ledger] body .e-float-input.e-disabled input { color: var(--ink-3); -webkit-text-fill-color: var(--ink-3); }
/* read-only: sunk panel with a dashed edge, so it reads as a value rather than a control.
   Syncfusion marks only the <input readonly>, not the wrapper, hence :has(). Dropdown/date/time inputs are
   readonly by design (typing is blocked, the picker is the control), so they are excluded. */
html[data-ledger] body .e-input-group:not(.e-ddl):not(.e-date-wrapper):not(.e-time-wrapper):not(.e-datetime-wrapper):has(> input[readonly]),
html[data-ledger] body .e-input-group:not(.e-ddl):not(.e-date-wrapper):not(.e-time-wrapper):not(.e-datetime-wrapper):has(> textarea[readonly]),
html[data-ledger] body .e-input-group.e-readonly { background: var(--surface-sunk) !important; border: 1px dashed var(--field) !important; }
html[data-ledger] body .e-input-group .e-input-group-icon,
html[data-ledger] body .e-input-group .e-input-group-icon.e-ddl-icon { background: transparent !important; color: var(--ink-2); border: 0 !important; }
html[data-ledger] body .e-input-group .e-input-group-icon:hover { color: var(--ink); background: var(--surface-sunk) !important; }
html[data-ledger] body .e-input-group .e-clear-icon { color: var(--ink-3); }

/* multiselect: the control is an .e-input-group around an inner .e-multi-select-wrapper; draw the edge once, on the outer. */
html[data-ledger] body .e-multiselect.e-input-group > .e-multi-select-wrapper { border: 0 !important; background: transparent !important; box-shadow: none !important; }

/* multiselect chips */
html[data-ledger] body .e-multi-select-wrapper .e-chips { background: var(--fescue-wash); color: var(--fescue); border: 1px solid color-mix(in srgb, var(--fescue) 35%, transparent); border-radius: 2px; }
html[data-ledger] body .e-multi-select-wrapper .e-chips > .e-chipcontent { color: var(--fescue); font: 500 .875rem/1.4 var(--font-ui); }
html[data-ledger] body .e-multi-select-wrapper .e-chips .e-chips-close::before { color: var(--fescue); }
html[data-ledger] body .e-multi-select-wrapper .e-chips:hover { background: var(--fescue-wash); border-color: var(--fescue); }

/* popups: dropdown list, calendar, time list */
html[data-ledger] body .e-popup,
html[data-ledger] body .e-popup.e-popup-open,
html[data-ledger] body .e-ddl.e-popup,
html[data-ledger] body .e-calendar,
html[data-ledger] body .e-datepicker.e-popup-wrapper,
html[data-ledger] body .e-timepicker.e-popup-wrapper { background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 3px; box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .4); }
html[data-ledger] body .e-dropdownbase .e-list-item { color: var(--ink); font-family: var(--font-ui); }
html[data-ledger] body .e-dropdownbase .e-list-item.e-hover,
html[data-ledger] body .e-list-item.e-hover { background: var(--surface-sunk); color: var(--ink); }
html[data-ledger] body .e-dropdownbase .e-list-item.e-active,
html[data-ledger] body .e-dropdownbase .e-list-item.e-active.e-hover,
html[data-ledger] body .e-list-item.e-active { background: var(--fescue-wash); color: var(--fescue); font-weight: 600; }
html[data-ledger] body .e-calendar .e-header { background: transparent; }
html[data-ledger] body .e-calendar .e-header .e-title,
html[data-ledger] body .e-calendar .e-header .e-title:hover { color: var(--ink); font-family: var(--font-display); font-weight: 600; }
html[data-ledger] body .e-calendar .e-header .e-prev,
html[data-ledger] body .e-calendar .e-header .e-next { color: var(--ink-2); }
html[data-ledger] body .e-calendar th { color: var(--ink-3); font-weight: 600; }
html[data-ledger] body .e-calendar .e-content td .e-day { color: var(--ink); font-family: var(--font-data); font-variant-numeric: tabular-nums; }
html[data-ledger] body .e-calendar .e-content td.e-other-month .e-day { color: var(--ink-3); }
html[data-ledger] body .e-calendar .e-content td:hover .e-day { background: var(--surface-sunk); color: var(--ink); }
html[data-ledger] body .e-calendar .e-content td.e-selected .e-day,
html[data-ledger] body .e-calendar .e-content td.e-selected:hover .e-day { background: var(--fescue); color: var(--on-fescue); }
html[data-ledger] body .e-calendar .e-content td.e-today .e-day { border: 1px solid var(--fescue); color: var(--fescue); background: transparent; }
html[data-ledger] body .e-calendar .e-content td.e-today.e-selected .e-day { background: var(--fescue); color: var(--on-fescue); }
html[data-ledger] body .e-calendar .e-footer-container .e-btn { color: var(--fescue); }

/* ---- switch ---- */
html[data-ledger] body .e-switch-wrapper .e-switch-inner { background: var(--ink-3); border-color: var(--ink-3); }
html[data-ledger] body .e-switch-wrapper .e-switch-handle { background: var(--paper); }
html[data-ledger] body .e-switch-wrapper .e-switch-inner.e-switch-active { background: var(--fescue); border-color: var(--fescue); }
html[data-ledger] body .e-switch-wrapper .e-switch-inner.e-switch-active .e-switch-handle { background: var(--on-fescue); }
html[data-ledger] body .e-switch-wrapper .e-label { color: var(--ink); font-family: var(--font-ui); }

/* ---- buttons ----
   Default = ghost (also what .e-flat means in this app: grid command links, dialog Cancel). Primary = fescue. Danger = brick outline.
   The theme gives .e-flat / .e-primary / .e-danger their own fills, so the colour properties are forced. */
html[data-ledger] body .e-btn,
html[data-ledger] body .e-css.e-btn,
html[data-ledger] body .e-btn.e-flat {
    font: 600 .9375rem/1 var(--font-ui); text-transform: none; letter-spacing: 0;
    padding: .8rem 1.2rem; border-radius: 3px; box-shadow: none !important;
    background: transparent !important; color: var(--ink) !important; border: 1px solid var(--rule-strong) !important;
}
html[data-ledger] body .e-btn:hover,
html[data-ledger] body .e-btn.e-flat:hover { background: var(--surface-sunk) !important; color: var(--ink) !important; border-color: var(--ink-3) !important; }
html[data-ledger] body .e-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
html[data-ledger] body .e-btn.e-primary,
html[data-ledger] body .e-css.e-btn.e-primary,
html[data-ledger] body .e-btn.e-flat.e-primary { background: var(--fescue) !important; border-color: var(--fescue) !important; color: var(--on-fescue) !important; }
html[data-ledger] body .e-btn.e-primary:hover,
html[data-ledger] body .e-btn.e-flat.e-primary:hover { background: var(--fescue-hover) !important; border-color: var(--fescue-hover) !important; color: var(--on-fescue) !important; }
html[data-ledger] body .e-btn.e-danger,
html[data-ledger] body .e-css.e-btn.e-danger,
html[data-ledger] body .e-btn.e-flat.e-danger { background: transparent !important; color: var(--brick) !important; border-color: var(--brick) !important; }
html[data-ledger] body .e-btn.e-danger:hover,
html[data-ledger] body .e-btn.e-flat.e-danger:hover { background: var(--brick-wash) !important; color: var(--brick) !important; border-color: var(--brick) !important; }
html[data-ledger] body .e-btn:disabled,
html[data-ledger] body .e-btn.e-disabled { opacity: .45; cursor: not-allowed; }
/* small command links inside grids (Edit, Download) read as links, not buttons */
html[data-ledger] body .e-grid .e-btn.e-flat.e-details { padding: .35rem .7rem; font-size: .875rem; }

/* ---- uploader ---- */
html[data-ledger] body .e-upload { background: var(--surface); border: 1px dashed var(--field); border-radius: 3px; color: var(--ink); font-family: var(--font-ui); }
html[data-ledger] body .e-upload .e-file-select-wrap .e-btn { background: var(--fescue); border-color: var(--fescue); color: var(--on-fescue); }
html[data-ledger] body .e-upload .e-upload-files .e-upload-file-list { border-color: var(--rule); color: var(--ink); }
html[data-ledger] body .e-upload .e-upload-files .e-file-name { color: var(--ink); }
html[data-ledger] body .e-upload .e-upload-files .e-file-size,
html[data-ledger] body .e-upload .e-file-drop { color: var(--ink-2); }

/* ---- grid ---- */
html[data-ledger] body .e-grid { background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 3px; font-family: var(--font-ui); color: var(--ink); }
html[data-ledger] body .e-grid .e-gridheader { background: var(--surface-sunk); border-top: 0; border-bottom: 3px double var(--rule-strong); }
html[data-ledger] body .e-grid .e-headercell { background: var(--surface-sunk); color: var(--ink-2); font: 600 .8125rem/1.4 var(--font-ui); letter-spacing: .02em; border-color: var(--rule); padding: .8rem 1rem; }
html[data-ledger] body .e-grid .e-headercell .e-headertext { color: var(--ink-2); font-weight: 600; white-space: nowrap; word-break: normal; overflow-wrap: normal; }   /* #209: a title is never broken; a narrow column is sized to fit it, and a wide grid scrolls inside its own card */
html[data-ledger] body .e-grid .e-sortfilterdiv,
html[data-ledger] body .e-grid .e-icon-ascending,
html[data-ledger] body .e-grid .e-icon-descending { color: var(--ink-2); }
html[data-ledger] body .e-grid .e-content,
html[data-ledger] body .e-grid .e-table { background: var(--surface); }
html[data-ledger] body .e-grid .e-rowcell { background: transparent; color: var(--ink); border-color: var(--rule); padding: .8rem 1rem; font-size: .9375rem; }
html[data-ledger] body .e-grid td.e-rowcell.mono { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-size: .875rem; letter-spacing: -.01em; }
html[data-ledger] body .e-grid .e-row:hover .e-rowcell,
html[data-ledger] body .e-grid.e-gridhover tr[role="row"]:not(.e-editedrow):hover .e-rowcell { background: var(--surface-sunk); color: var(--ink); }
html[data-ledger] body .e-grid .e-altrow { background: transparent; }
html[data-ledger] body .e-grid .e-row.e-active .e-rowcell,
html[data-ledger] body .e-grid .e-row .e-rowcell.e-active { background: var(--fescue-wash); color: var(--ink); }
html[data-ledger] body .e-grid .e-emptyrow td { color: var(--ink-2); padding: 2.5rem 1rem; text-align: center; font-style: italic; }
html[data-ledger] body .e-grid .e-gridpager,
html[data-ledger] body .e-grid .e-gridpager.e-control { background: var(--surface); border-top: 1px solid var(--rule); color: var(--ink-2); font-family: var(--font-ui); }
html[data-ledger] body .e-pager .e-numericitem,
html[data-ledger] body .e-pager .e-currentitem { color: var(--ink-2); background: transparent; font-family: var(--font-data); }
/* the arrows are glyphs from the e-icons font; a text font here turns them into empty boxes (#223) */
html[data-ledger] body .e-pager .e-pagercontainer .e-first,
html[data-ledger] body .e-pager .e-pagercontainer .e-prev,
html[data-ledger] body .e-pager .e-pagercontainer .e-next,
html[data-ledger] body .e-pager .e-pagercontainer .e-last { color: var(--ink-2); background: transparent; font-family: 'e-icons'; }
html[data-ledger] body .e-pager .e-currentitem,
html[data-ledger] body .e-pager .e-currentitem:hover { background: var(--fescue); color: var(--on-fescue); border-radius: 2px; }
html[data-ledger] body .e-pager .e-numericitem:hover { background: var(--surface-sunk); color: var(--ink); }
html[data-ledger] body .e-pager div.e-parentmsgbar { color: var(--ink-2); }
html[data-ledger] body .e-pager { background: var(--surface); }

/* ---- scheduler ---- */
html[data-ledger] body .e-schedule { background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 3px; font-family: var(--font-ui); color: var(--ink); }
html[data-ledger] body .e-schedule .e-schedule-toolbar,
html[data-ledger] body .e-schedule .e-schedule-toolbar .e-toolbar-items { background: var(--surface); border-color: var(--rule); }
html[data-ledger] body .e-schedule .e-schedule-toolbar .e-tbar-btn,
html[data-ledger] body .e-schedule .e-schedule-toolbar .e-tbar-btn-text,
html[data-ledger] body .e-schedule .e-schedule-toolbar .e-toolbar-item .e-tbar-btn .e-icons { color: var(--ink-2); background: transparent; }
html[data-ledger] body .e-schedule .e-schedule-toolbar .e-date-range .e-tbar-btn-text { color: var(--ink); font: 600 1.125rem/1.2 var(--font-display); }
html[data-ledger] body .e-schedule .e-schedule-toolbar .e-active-view .e-tbar-btn { background: var(--fescue-wash); }
html[data-ledger] body .e-schedule .e-schedule-toolbar .e-active-view .e-tbar-btn-text { color: var(--fescue); }
html[data-ledger] body .e-schedule .e-month-view .e-date-header-wrap table td,
html[data-ledger] body .e-schedule .e-month-view .e-header-cells { background: var(--surface-sunk); color: var(--ink-2); border-color: var(--rule); font-weight: 600; }
html[data-ledger] body .e-schedule .e-month-view .e-work-cells,
html[data-ledger] body .e-schedule .e-month-view .e-content-wrap table td { background: var(--surface); border-color: var(--rule); color: var(--ink); }
html[data-ledger] body .e-schedule .e-month-view .e-work-cells.e-other-month,
html[data-ledger] body .e-schedule .e-month-view .e-work-cells.e-other-month .e-date-header { background: var(--paper); color: var(--ink-3); }
html[data-ledger] body .e-schedule .e-month-view .e-work-cells:hover { background: var(--surface-sunk); }
html[data-ledger] body .e-schedule .e-month-view .e-date-header { color: var(--ink); font-family: var(--font-data); font-size: .875rem; }
html[data-ledger] body .e-schedule .e-month-view .e-current-date .e-date-header { background: var(--fescue); color: var(--on-fescue); border-radius: 2px; }
html[data-ledger] body .e-schedule .e-appointment { border-radius: 2px; border: 1px solid transparent; box-shadow: none; font-size: .8125rem; }
html[data-ledger] body .e-schedule .e-appointment .e-subject { font-weight: 600; }
/* Entry colour is the member's own (displayColor, set inline by each view's eventRendered). Ledger rules on top of that:
   ink is picked for contrast (view sets data-ink), and planned entries wear a dashed edge so state never rests on colour. */
html[data-ledger] body .e-schedule .e-appointment { color: #fff; }
html[data-ledger] body .e-schedule .e-appointment[data-ink="dark"] { color: #1c231e; }
html[data-ledger] body .e-schedule .e-more-indicator { color: var(--fescue); }

/* ---- dialog ---- */
html[data-ledger] body .e-dialog { background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 4px; box-shadow: var(--shadow-page); font-family: var(--font-ui); }
html[data-ledger] body .e-dialog .e-dlg-header-content,
html[data-ledger] body .e-dialog .e-footer-content { background: transparent; border-color: var(--rule); color: var(--ink); }
html[data-ledger] body .e-dialog .e-dlg-header { font: 600 1.25rem/1.3 var(--font-display); color: var(--ink); }
html[data-ledger] body .e-dialog .e-dlg-content { color: var(--ink-2); font-size: 1rem; }
html[data-ledger] body .e-dialog .e-dlg-closeicon-btn { background: transparent; border: 0; color: var(--ink-2); }
html[data-ledger] body .e-dialog .e-dlg-content { background: transparent !important; }
html[data-ledger] body .e-dlg-overlay { background: rgba(14, 19, 15, .55); opacity: 1; }

/* ---- toast: inverse ink on paper in both themes; status lives in the icon and the title, not a coloured slab ---- */
html[data-ledger] body .e-toast-container .e-toast,
html[data-ledger] body .e-toast-container .e-toast.e-toast-success,
html[data-ledger] body .e-toast-container .e-toast.e-toast-danger,
html[data-ledger] body .e-toast-container .e-toast.e-toast-warning,
html[data-ledger] body .e-toast-container .e-toast.e-toast-information { background: var(--ink) !important; color: var(--paper) !important; border: 0 !important; border-radius: 4px; box-shadow: var(--shadow-page); font-family: var(--font-ui); }
html[data-ledger] body .e-toast.e-toast-container .e-toast-title,
html[data-ledger] body .e-toast.e-toast-container .e-toast-message,
html[data-ledger] body .e-toast.e-toast-container .e-toast-close-icon,
html[data-ledger] body .e-toast-container .e-toast .e-toast-title,
html[data-ledger] body .e-toast-container .e-toast .e-toast-message,
html[data-ledger] body .e-toast-container .e-toast .e-toast-close-icon,
html[data-ledger] body .e-toast-container .e-toast.e-toast-success .e-toast-title,
html[data-ledger] body .e-toast-container .e-toast.e-toast-danger .e-toast-title { color: var(--paper) !important; }
html[data-ledger] body .e-toast-container .e-toast .e-toast-title { font-weight: 600; }
html[data-ledger] body .e-toast-container .e-toast .e-toast-message { opacity: .92; }
html[data-ledger] body .e-toast-container .e-toast .e-toast-progress { background: var(--paper); opacity: .25; }
html[data-ledger] body .e-toast.e-toast-success .e-toast-icon,
html[data-ledger] body .e-toast-container .e-toast.e-toast-success .e-toast-icon { color: var(--fescue-hover) !important; }
html[data-ledger] body .e-toast.e-toast-danger .e-toast-icon,
html[data-ledger] body .e-toast-container .e-toast.e-toast-danger .e-toast-icon { color: var(--brick) !important; }

html[data-ledger] body .e-toast-container .e-toast .e-toast-content,
html[data-ledger] body .e-toast-container .e-toast .e-toast-content *,
html[data-ledger] body .e-toast-container .e-toast .e-toast-message * { color: var(--paper) !important; }
html[data-ledger] body .e-toast-container .e-toast .e-toast-message { border: 0 !important; }
html[data-ledger] body .e-toast.e-toast-container { background: transparent !important; box-shadow: none !important; border: 0 !important; }
/* close icons are .e-btn too; keep them borderless */
html[data-ledger] body .e-dlg-closeicon-btn.e-btn,
html[data-ledger] body .e-toast-close-icon.e-btn { border: 0 !important; background: transparent !important; padding: .35rem; }

/* ---- tooltip ---- */
html[data-ledger] body .e-tooltip-wrap { background: var(--ink); border: 1px solid var(--ink); border-radius: 3px; box-shadow: none; }
html[data-ledger] body .e-tooltip-wrap .e-tip-content { color: var(--paper); font: 500 .8125rem/1.4 var(--font-ui); }
html[data-ledger] body .e-tooltip-wrap .e-arrow-tip-inner,
html[data-ledger] body .e-tooltip-wrap .e-arrow-tip-outer { color: var(--ink); }

/* ---- breadcrumb ---- */
html[data-ledger] body .e-breadcrumb { background: transparent; font-family: var(--font-ui); }
html[data-ledger] body .e-breadcrumb .e-breadcrumb-item .e-anchor-wrap,
html[data-ledger] body .e-breadcrumb .e-breadcrumb-item .e-breadcrumb-text { color: var(--fescue); font-size: .875rem; }
html[data-ledger] body .e-breadcrumb .e-breadcrumb-item.e-active-item .e-breadcrumb-text,
html[data-ledger] body .e-breadcrumb .e-breadcrumb-item.e-active-item .e-anchor-wrap { color: var(--ink); font-weight: 600; }
html[data-ledger] body .e-breadcrumb .e-breadcrumb-separator { color: var(--ink-3); }

/* ---- progress / charts: structure only; palette lives in theme-color.js ---- */
html[data-ledger] body .e-progressbar-container text { fill: var(--ink-2); font-family: var(--font-ui); }

/* ---- grid, phone: stacked entries (opt-in via cssClass="ledger-stack" on the six log books) ----
   Syncfusion's enableAdaptiveUI / rowRenderingMode="Vertical" was tried first (33.2.10) and still
   renders a squeezed table with ellipsised cells, so this is plain CSS. Each column supplies
   customAttributes = { "data-label": "<header text>" }; the header row is hidden on phones. */
@media (max-width: 640px) {
    html[data-ledger] body .e-grid.ledger-stack .e-gridheader { display: none; }
    html[data-ledger] body .e-grid.ledger-stack .e-gridcontent,
    html[data-ledger] body .e-grid.ledger-stack .e-content { overflow: visible; height: auto !important; }
    html[data-ledger] body .e-grid.ledger-stack .e-content table,
    html[data-ledger] body .e-grid.ledger-stack .e-content tbody { display: block; width: 100% !important; }
    html[data-ledger] body .e-grid.ledger-stack .e-content colgroup { display: none; }
    html[data-ledger] body .e-grid.ledger-stack .e-content tr.e-row { display: block; padding: .8rem 1rem; border-bottom: 1px solid var(--rule); }
    html[data-ledger] body .e-grid.ledger-stack .e-content td.e-rowcell {
        display: grid; grid-template-columns: minmax(5.5rem, 7.5rem) 1fr; column-gap: 1rem; border: 0; padding: .15rem 0; background: transparent !important;
    }
    html[data-ledger] body .e-grid.ledger-stack .e-content td.e-rowcell:empty { display: none; }
    html[data-ledger] body .e-grid.ledger-stack .e-content td.e-rowcell.e-hide { display: none !important; }   /* hidden columns (ID) stay hidden in the stack */   /* blank values are left out, not shown as gaps */
    html[data-ledger] body .e-grid.ledger-stack .e-content td.e-rowcell::before {
        content: attr(data-label); color: var(--ink-3); font: 600 .75rem/1.9 var(--font-ui); letter-spacing: .02em;
    }
    html[data-ledger] body .e-grid.ledger-stack .e-content td.e-rowcell { text-align: left !important; }
}
html[data-ledger] body .e-pager .e-pagercontainer .e-first,
html[data-ledger] body .e-pager .e-pagercontainer .e-prev,
html[data-ledger] body .e-pager .e-pagercontainer .e-next,
html[data-ledger] body .e-pager .e-pagercontainer .e-last,
html[data-ledger] body .e-pager .e-numericitem { background: transparent !important; border: 0; }
html[data-ledger] body .e-pager .e-currentitem { background: var(--fescue) !important; color: var(--on-fescue) !important; }
html[data-ledger] body .e-pager .e-focused,
html[data-ledger] body .e-pager .e-numericitem:focus-visible { box-shadow: none; outline: 2px solid var(--focus); outline-offset: -2px; }

/* ==========================================================================
   App chrome (Phase 3): header, sidebar/drawer, user menu, footer, brand lockup.
   Only _AppLayout uses the .lg-* classes, so these are not gated.
   ========================================================================== */
.lg-app { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.6 var(--font-ui); }
.lg-skip { position: absolute; left: .75rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 3px; font-weight: 600; text-decoration: none; }
.lg-skip:focus { top: .75rem; color: var(--paper); }

/* brand lockup: serif name, small "by Seven Fescue" */
.lg-brand { display: inline-flex; align-items: baseline; gap: .55rem; line-height: 1; white-space: nowrap; }
.lg-brand-name { font: 600 1.375rem/1 var(--font-display); font-variation-settings: "opsz" 72; letter-spacing: -.01em; color: var(--ink); }
.lg-brand-by { font: 500 .75rem/1 var(--font-ui); color: var(--ink-3); letter-spacing: .01em; }
.lg-brand-link { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; min-height: 44px; }
.lg-brand-link:hover { color: var(--ink); }
@media (max-width: 420px) { .lg-brand { flex-direction: column; gap: .2rem; align-items: flex-start; } .lg-brand-name { font-size: 1.2rem; } }

/* header */
.lg-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; min-height: 4rem; padding: .35rem 1.25rem; background: var(--paper); border-bottom: 1px solid var(--rule); }
.lg-header-spacer { flex: 1; }
.lg-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: none; border: 1px solid var(--field); border-radius: 3px; color: var(--ink); cursor: pointer; padding: 0; }
.lg-iconbtn:hover { background: var(--surface-sunk); }
.lg-iconbtn svg { width: 1.35rem; height: 1.35rem; }
.lg-drawer-open { display: none; }
/* desktop sidebar toggle: hidden on phone/tablet, where the drawer button does the job */
.lg-sidebar-toggle { display: none; }
@media (min-width: 992px) {
    .lg-sidebar-toggle { display: inline-flex; }
    html[data-sidebar-collapsed] .lg-shell { grid-template-columns: minmax(0, 1fr); }
    html[data-sidebar-collapsed] .lg-drawer { display: none; }
}

/* user menu (Bootstrap dropdown behaviour, ledger look) */
.lg-usermenu-btn { display: inline-flex; align-items: center; gap: .55rem; min-height: 44px; padding: 0 .85rem; background: none; border: 1px solid var(--rule-strong); border-radius: 3px; color: var(--ink); font: 600 .9375rem var(--font-ui); cursor: pointer; max-width: 16rem; }
.lg-usermenu-btn:hover { background: var(--surface-sunk); border-color: var(--ink-3); }
.lg-usermenu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-chev { width: .85rem; height: .85rem; flex: none; color: var(--ink-3); }
.lg-menu.dropdown-menu { min-width: 15rem; padding: .4rem; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 3px; box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .4); font-family: var(--font-ui); --bs-dropdown-link-color: var(--ink); --bs-dropdown-link-hover-bg: var(--surface-sunk); --bs-dropdown-link-hover-color: var(--ink); --bs-dropdown-link-active-bg: var(--fescue-wash); --bs-dropdown-link-active-color: var(--fescue); }
.lg-menu .dropdown-item { padding: .55rem .7rem; border-radius: 3px; color: var(--ink); font-size: .9375rem; }
.lg-menu .dropdown-item:hover, .lg-menu .dropdown-item:focus { background: var(--surface-sunk); color: var(--ink); }
.lg-menu .dropdown-divider { border-top-color: var(--rule); margin: .35rem 0; opacity: 1; }
.lg-menu-theme { display: flex; align-items: center; justify-content: space-between; padding: .5rem .7rem; font-size: .9375rem; }
.lg-menu-theme label { margin: 0; color: var(--ink); }
.lg-switch { appearance: none; -webkit-appearance: none; width: 2.5rem; height: 1.4rem; border-radius: 999px; background: var(--ink-3); border: 0; position: relative; cursor: pointer; flex: none; margin: 0; }
.lg-switch::before { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--paper); transition: transform .15s var(--ease-out); }
.lg-switch:checked { background: var(--fescue); }
.lg-switch:checked::before { transform: translateX(1.1rem); background: var(--on-fescue); }
.lg-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* shell: sidebar rail + main */
.lg-shell { display: grid; grid-template-columns: 17rem minmax(0, 1fr); align-items: start; min-height: calc(100vh - 4rem); }
.lg-drawer { position: sticky; top: 4rem; align-self: start; max-height: calc(100vh - 4rem); overflow-y: auto; background: var(--surface); border-right: 1px solid var(--rule); }
.lg-scrim { display: none; }
.lg-sidebar { display: flex; flex-direction: column; gap: .15rem; padding: 1.1rem .85rem 2rem; }
.lg-drawer-close { display: none; margin: 0 0 .5rem auto; }
.lg-nav-top { display: flex; align-items: center; padding: .6rem .7rem; border-radius: 3px; color: var(--ink-2); text-decoration: none; font: 500 .9375rem var(--font-ui); }
.lg-nav-top:hover { background: var(--surface-sunk); color: var(--ink); }
.lg-nav-sub { padding-left: 1.4rem; font-size: .875rem; }
.lg-nav-label { margin: 1.1rem 0 .3rem; padding: 0 .7rem; font: 600 .6875rem var(--font-ui); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.lg-nav-group > summary { display: flex; align-items: center; padding: .6rem .7rem; border-radius: 3px; color: var(--ink-2); font: 500 .9375rem var(--font-ui); cursor: pointer; list-style: none; }
.lg-nav-group > summary::-webkit-details-marker { display: none; }
.lg-nav-group > summary::after { content: ""; margin-left: auto; width: .5rem; height: .5rem; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-45deg); transition: transform .2s var(--ease-out); }
.lg-nav-group[open] > summary::after { transform: rotate(45deg); }
.lg-nav-group > summary:hover { background: var(--surface-sunk); color: var(--ink); }
.lg-nav-group[open] > summary { color: var(--ink); }
.lg-nav-group > ul { list-style: none; margin: .1rem 0 .5rem 1.15rem; padding: 0 0 0 .55rem; border-left: 1px solid var(--rule); display: flex; flex-direction: column; }
.lg-nav-group > ul a { display: block; padding: .42rem .7rem; color: var(--ink-2); text-decoration: none; font-size: .875rem; border-radius: 3px; }
.lg-nav-group > ul a:hover { background: var(--surface-sunk); color: var(--ink); }
.lg-nav-add a { color: var(--ink-3); font-size: .8125rem; }
.lg-sidebar a[aria-current="page"] { background: var(--fescue-wash); color: var(--fescue); font-weight: 600; }

/* main */
.lg-main { min-width: 0; padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 0; outline: none; }
.lg-main > * { max-width: 1400px; }
/* long forms with the "On this page" list may grow past the page cap on wide monitors (#208); the list stays docked to the right of the form */
@media (min-width: 1200px) { .lg-main > form.lg-has-toc { max-width: 1700px; } }
.lg-footer { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: baseline; justify-content: space-between; margin-top: 3rem; padding: 1.25rem 0 1.75rem; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: .8125rem; }
.lg-footer .lg-brand-name { font-size: 1rem; }
.lg-footer-links { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.lg-footer a { color: var(--ink-2); }

/* phone and tablet: sidebar becomes a drawer */
@media (max-width: 991.98px) {
    .lg-shell { display: block; min-height: 0; }
    .lg-drawer-open { display: inline-flex; }
    .lg-drawer-close { display: inline-flex; }
    .lg-drawer { position: fixed; inset: 0; z-index: 50; max-height: none; overflow: visible; background: transparent; border: 0; visibility: hidden; }
    .lg-drawer[data-open] { visibility: visible; }
    .lg-scrim { display: block; position: absolute; inset: 0; background: rgba(14, 19, 15, .55); opacity: 0; transition: opacity .25s; }
    .lg-drawer[data-open] .lg-scrim { opacity: 1; }
    .lg-sidebar { position: absolute; inset: 0 auto 0 0; width: min(18rem, 86vw); overflow-y: auto; background: var(--surface); border-right: 1px solid var(--rule); transform: translateX(-102%); transition: transform .3s var(--ease-out); padding-top: .75rem; }
    .lg-drawer[data-open] .lg-sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
    .lg-header { padding-inline: .75rem; gap: .6rem; }
    .lg-usermenu-btn { max-width: 9rem; padding: 0 .65rem; }
}
html[data-drawer-open] body { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
    .lg-sidebar, .lg-scrim, .lg-nav-group > summary::after, .lg-switch::before { transition: none; }
}

/* chrome link colours must out-rank the gated base `a` rule */
.lg-app a.lg-nav-top, .lg-app .lg-nav-group > ul a { color: var(--ink-2); }
.lg-app a.lg-nav-top:hover, .lg-app .lg-nav-group > ul a:hover { color: var(--ink); }
.lg-app .lg-nav-add a { color: var(--ink-3); }
.lg-app .lg-sidebar a[aria-current="page"] { color: var(--fescue); }
.lg-app a.lg-brand-link, .lg-app a.lg-brand-link:hover { color: var(--ink); text-decoration: none; }
.lg-app .lg-footer a { color: var(--ink-2); }
.lg-app .lg-menu a.dropdown-item { color: var(--ink); text-decoration: none; }
.lg-drawer { height: calc(100vh - 4rem); }
@media (max-width: 991.98px) { .lg-drawer { height: 100vh; height: 100dvh; } }

/* ==========================================================================
   Public pages (Phase 4): public header/footer, homepage, prose pages.
   Classes are .pub-* / .lg-btn so they cannot collide with Bootstrap.
   ========================================================================== */
.lg-public { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.6 var(--font-ui); }
.pub-wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
svg.i { width: 1.25em; height: 1.25em; stroke: currentColor; fill: none; flex: none; }

/* buttons (public) */
.lg-btn { display: inline-flex; align-items: center; gap: .55rem; font: 600 .9375rem/1 var(--font-ui); padding: .85rem 1.25rem; border-radius: 3px; border: 1px solid var(--fescue); background: var(--fescue); color: var(--on-fescue); text-decoration: none; cursor: pointer; transition: background .15s, transform .15s var(--ease-out); }
.lg-btn:hover { background: var(--fescue-hover); border-color: var(--fescue-hover); color: var(--on-fescue); }
.lg-btn:active { transform: translateY(1px); }
.lg-btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.lg-btn--ghost:hover { background: var(--surface-sunk); color: var(--ink); border-color: var(--ink-3); }
.lg-btn--sm { padding: .55rem .9rem; font-size: .875rem; }
.lg-public a.lg-btn, .lg-public a.lg-btn:hover { text-decoration: none; }
.lg-public a.lg-btn { color: var(--on-fescue); }
.lg-public a.lg-btn--ghost, .lg-public a.lg-btn--ghost:hover { color: var(--ink); }

/* header and footer */
.pub-header { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--rule); }
.pub-header .pub-wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 4.25rem; }
.pub-nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.pub-nav-link { color: var(--ink-2); text-decoration: none; padding: .5rem .8rem; font-weight: 500; font-size: .9375rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.lg-public a.pub-nav-link { color: var(--ink-2); text-decoration: none; }
.lg-public a.pub-nav-link:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.lg-public a.pub-nav-link[aria-current="page"] { color: var(--ink); border-bottom-color: var(--fescue); }
.pub-cta { }
.pub-nav .lg-btn { margin-left: .5rem; white-space: nowrap; }
.pub-theme { display: inline-flex; align-items: center; gap: .5rem; background: none; border: 1px solid var(--rule-strong); color: var(--ink-2); border-radius: 999px; padding: .4rem .75rem; font: 500 .8125rem var(--font-ui); cursor: pointer; margin-left: .5rem; white-space: nowrap; }
.pub-theme:hover { color: var(--ink); border-color: var(--ink-3); }
.pub-footer { border-top: 1px solid var(--rule); padding-block: 2rem; color: var(--ink-3); font-size: .875rem; margin-top: 0; }
.pub-footer .pub-wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.pub-footer .lg-brand-name { font-size: 1rem; }
.pub-footer-links { display: flex; gap: .25rem 1rem; flex-wrap: wrap; }
.lg-public .pub-footer a { color: var(--ink-2); }
@media (max-width: 760px) {
    .pub-nav-link:not(.pub-keep) { display: none; }
    .pub-nav .lg-btn { display: none; }
    .pub-header .pub-wrap { gap: .75rem; }
    .pub-theme { padding: .45rem .55rem; margin-left: .25rem; }
    .pub-theme-label { display: none; }
}

/* prose pages: privacy, support, error, access denied */
.pub-page { width: min(52rem, 100% - 2.5rem); padding-block: 2.5rem 4rem; }
.pub-page h1 { margin-bottom: 1rem; }
.pub-page h2 { font-size: 1.5rem; margin: 2rem 0 .6rem; font-variation-settings: "opsz" 48; }
.pub-page ul { padding-left: 1.2rem; }
.pub-page li { margin-bottom: .3rem; }
.pub-banner { padding-top: 1rem; }

/* hero */
.pub-hero { padding-block: clamp(3rem, 7vw, 6rem) clamp(3rem, 6vw, 5rem); }
.pub-hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.pub-hero h1 { font-size: clamp(2.75rem, 6.4vw, 5.25rem); line-height: 1; text-wrap: balance; margin: 0; }
.pub-hero h1 em { font-style: italic; font-weight: 500; color: var(--fescue); }
.pub-lede { font-size: 1.1875rem; max-width: 34em; color: var(--ink-2); margin: 1.5rem 0 2rem; }
.pub-cta { display: flex; gap: .75rem; flex-wrap: wrap; }
.pub-assure { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1.75rem 0 0; padding: 0; list-style: none; color: var(--ink-2); font-size: .875rem; }
.pub-assure li { display: flex; align-items: center; gap: .45rem; margin: 0; }
.pub-assure svg { color: var(--fescue); width: 1.1em; }

/* the ledger page */
.pub-ledger { position: relative; background: var(--surface); box-shadow: var(--shadow-page); border: 1px solid var(--rule); border-radius: 3px; padding: 0 0 1.25rem; transform: rotate(.6deg); }
.pub-ledger::before, .pub-ledger::after { content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--margin-rule); left: 4.9rem; }
.pub-ledger::after { left: calc(4.9rem + 4px); }
.pub-ledger-head { display: flex; justify-content: space-between; align-items: baseline; padding: 1.1rem 1.25rem .8rem; border-bottom: 2px solid var(--ink); }
.pub-ledger-head b { font: 600 1.125rem var(--font-display); }
.pub-ledger-head span { color: var(--ink-3); font-size: .8125rem; }
.pub-entry { display: grid; grid-template-columns: 4.9rem 1fr auto; align-items: baseline; border-bottom: 1px solid var(--rule); padding: .8rem 1.25rem .8rem 0; }
.pub-entry time { white-space: nowrap; padding-left: 1.1rem; color: var(--ink-3); font-size: .75rem; line-height: 1.3; }
.pub-what { padding-left: 1.2rem; }
.pub-what strong { display: block; font-weight: 600; font-size: .9375rem; line-height: 1.35; }
.pub-what small { color: var(--ink-2); font-size: .8125rem; }
.pub-amt { color: var(--ink-2); font-size: .8125rem; text-align: right; }
.pub-tag { display: inline-block; font: 600 .6875rem/1 var(--font-ui); text-transform: uppercase; letter-spacing: .06em; padding: .22rem .4rem; border-radius: 2px; margin-right: .45rem; vertical-align: .08em; }
.pub-tag--home { background: var(--fescue-wash); color: var(--fescue); }
.pub-tag--lawn { background: var(--ochre-wash); color: var(--ochre); }
.pub-tag--gen { background: var(--surface-sunk); color: var(--ink-2); }
.pub-entry--planned { border-bottom: 1px dashed var(--rule-strong); background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--rule) 45%, transparent) 8px 9px); }
.pub-entry--planned time { color: var(--ochre); }
.pub-stamp { position: absolute; right: 1.1rem; bottom: 1.6rem; transform: rotate(-9deg); border: 2px solid var(--fescue); color: var(--fescue); font: 600 .8125rem/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; padding: .45rem .7rem; border-radius: 3px; opacity: .85; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.pub-ledger-foot { padding: .9rem 1.25rem 0 1.2rem; margin-left: 4.9rem; color: var(--ink-3); font-size: .8125rem; display: flex; gap: .5rem; align-items: center; }
/* the one authored motion: entries are written onto the page (skipped for reduced motion) */
@media (prefers-reduced-motion: no-preference) {
    .pub-entry { clip-path: inset(0 100% 0 0); animation: pub-write .9s var(--ease-out) forwards; }
    .pub-entry:nth-of-type(1) { animation-delay: .25s; } .pub-entry:nth-of-type(2) { animation-delay: .5s; }
    .pub-entry:nth-of-type(3) { animation-delay: .75s; } .pub-entry:nth-of-type(4) { animation-delay: 1s; }
    .pub-entry:nth-of-type(5) { animation-delay: 1.25s; }
    .pub-stamp { opacity: 0; animation: pub-stamp .5s var(--ease-out) 1.9s forwards; }
}
@keyframes pub-write { to { clip-path: inset(0 0 0 0); } }
@keyframes pub-stamp { from { opacity: 0; transform: rotate(-9deg) scale(1.35); } to { opacity: .85; transform: rotate(-9deg) scale(1); } }

/* sections */
.pub-section { padding-block: clamp(3.5rem, 7vw, 6rem); border-top: 1px solid var(--rule); }
.pub-section h2 { font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.05; margin: 0; text-wrap: balance; }
.pub-sub { color: var(--ink-2); font-size: 1.0625rem; max-width: 36em; margin: 1rem 0 0; }
.pub-questions { margin: 2.5rem 0 0; padding: 0; list-style: none; border-top: 2px solid var(--ink); }
.pub-questions li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 2rem; padding-block: 1.6rem; border-bottom: 1px solid var(--rule); align-items: baseline; margin: 0; }
.pub-questions q { quotes: none; font: 500 clamp(1.4rem, 2.6vw, 2rem)/1.2 var(--font-display); letter-spacing: -.01em; }
.pub-questions p { margin: 0; color: var(--ink-2); max-width: 32em; }
.pub-resolve { margin: 2.5rem 0 0; font: 500 clamp(1.25rem, 2.2vw, 1.75rem)/1.3 var(--font-display); max-width: 30em; }
.pub-resolve b { color: var(--fescue); font-weight: 600; }

.pub-how { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); gap: clamp(2rem, 6vw, 6rem); }
.pub-how-lead { position: sticky; top: 6rem; align-self: start; }
.pub-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.pub-steps li { counter-increment: s; display: grid; grid-template-columns: 4rem 1fr; gap: 1rem; padding-block: 1.8rem; border-bottom: 1px solid var(--rule); margin: 0; }
.pub-steps li:first-child { padding-top: 0; }
.pub-steps li::before { content: counter(s); font: 500 3.25rem/1 var(--font-display); color: var(--fescue); opacity: .75; font-variation-settings: "opsz" 144; font-variant-numeric: lining-nums; }
.pub-steps h3 { font-size: 1.5rem; margin: 0 0 .4rem; }
.pub-steps p { margin: 0; color: var(--ink-2); max-width: 34em; }
@media (max-width: 860px) { .pub-hero-grid, .pub-how, .pub-questions li, .pub-faq { grid-template-columns: 1fr; } .pub-how-lead { position: static; } .pub-ledger { transform: none; } }

/* the three books */
.pub-books { display: grid; grid-template-columns: 15rem minmax(0, 1fr); margin-top: 2.5rem; box-shadow: var(--shadow-page); border: 1px solid var(--rule); border-radius: 3px; background: var(--surface); overflow: hidden; }
.pub-spines { display: flex; flex-direction: column; background: var(--surface-sunk); border-right: 1px solid var(--rule); }
.pub-spines button { text-align: left; font: 600 1.125rem var(--font-display); color: var(--ink-2); background: none; border: 0; border-bottom: 1px solid var(--rule); padding: 1.4rem 1.25rem; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; }
.pub-spines button small { font: 400 .8125rem var(--font-ui); color: var(--ink-3); display: block; }
.pub-spines button:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.pub-spines button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 4px 0 0 var(--tab, var(--fescue)); margin-right: -1px; }
.pub-spines button:nth-child(1) { --tab: var(--fescue); } .pub-spines button:nth-child(2) { --tab: var(--ochre); } .pub-spines button:nth-child(3) { --tab: var(--ink-3); }
.pub-books .pub-leaf { width: auto; padding: 1.75rem 2rem 2rem; min-height: 22rem; }
.pub-books .pub-leaf[hidden] { display: none; }
.pub-books .pub-leaf h3 { font-size: 1.5rem; margin: 0; }
.pub-books .pub-leaf ul { list-style: none; margin: 1rem 0 0; padding: 0; columns: 2; column-gap: 2.5rem; }
.pub-books .pub-leaf li { break-inside: avoid; display: flex; gap: .7rem; padding-block: .75rem; border-bottom: 1px solid var(--rule); color: var(--ink); margin: 0; }
.pub-books .pub-leaf li svg { color: var(--fescue); margin-top: .2em; width: 1.1em; }
.pub-more { color: var(--ink-2); margin: 1.5rem 0 0; max-width: 40em; font-size: .9375rem; }
@media (max-width: 760px) {
    .pub-books { grid-template-columns: 1fr; }
    .pub-spines { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--rule); overflow-x: auto; }
    .pub-spines button { border-bottom: 0; border-right: 1px solid var(--rule); white-space: nowrap; }
    .pub-spines button small { display: none; }
    .pub-spines button[aria-selected="true"] { box-shadow: inset 0 -4px 0 var(--tab); margin: 0; }
    .pub-books .pub-leaf ul { columns: 1; }
    .pub-books .pub-leaf { padding: 1.25rem; }
}

/* benefits: a plain definition list, not cards */
.pub-benefits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(2rem, 6vw, 6rem); margin: 2.5rem 0 0; }
.pub-benefits div { padding-block: 1.5rem; border-top: 1px solid var(--rule); }
.pub-benefits dt { font: 600 1.375rem/1.25 var(--font-display); margin-bottom: .4rem; }
.pub-benefits dd { margin: 0; color: var(--ink-2); max-width: 30em; }
@media (max-width: 760px) { .pub-benefits { grid-template-columns: 1fr; } }

/* pricing slip (no price figure: the plan catalog is shown on the next page) */
.pub-slip { margin-top: 2.5rem; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow-page); border-radius: 3px; }
.pub-slip-left { padding: 2.25rem; }
.pub-slip-left h3 { font-size: 1.5rem; margin: 0; }
.pub-slip-right { padding: 2.25rem; border-left: 2px dashed var(--rule-strong); background: var(--surface-sunk); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1rem; }
.pub-slip-title { font: 600 1.75rem/1.15 var(--font-display); margin: 0; }
.pub-slip ul { list-style: none; margin: 1.25rem 0 0; padding: 0; }
.pub-slip li { display: flex; gap: .7rem; padding-block: .6rem; border-bottom: 1px solid var(--rule); margin: 0; }
.pub-slip li svg { color: var(--fescue); margin-top: .2em; width: 1.1em; }
.pub-note { color: var(--ink-3); font-size: .8125rem; margin: 0; }
@media (max-width: 760px) { .pub-slip { grid-template-columns: 1fr; } .pub-slip-right { border-left: 0; border-top: 2px dashed var(--rule-strong); } }

/* FAQ */
.pub-faq { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); gap: clamp(2rem, 6vw, 6rem); }
.pub-faq details { border-bottom: 1px solid var(--rule); }
.pub-faq details:first-child { border-top: 2px solid var(--ink); }
.pub-faq summary { list-style: none; cursor: pointer; padding: 1.2rem 0; font: 600 1.1875rem/1.35 var(--font-display); display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.pub-faq summary::-webkit-details-marker { display: none; }
.pub-faq summary svg { transition: transform .25s var(--ease-out); color: var(--ink-3); }
.pub-faq details[open] summary svg { transform: rotate(45deg); color: var(--fescue); }
.pub-faq details p { margin: 0 0 1.4rem; color: var(--ink-2); max-width: 38em; }

/* closing band */
.pub-final { background: var(--final-bg); color: var(--final-ink); border-top: 0; }
.pub-final h2 { color: var(--final-ink); max-width: 14em; }
.pub-final p { color: color-mix(in srgb, var(--final-ink) 85%, transparent); font-size: 1.125rem; max-width: 34em; margin: 1rem 0 2rem; }
.lg-public .pub-final a.lg-btn { background: var(--final-btn-bg); color: var(--final-btn-fg); border-color: var(--final-btn-bg); }
.lg-public .pub-final a.lg-btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* alerts (banner, error summary base): ledger colours, text carries the meaning */
html[data-ledger] .alert { border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--surface-sunk); color: var(--ink); font-size: .9375rem; }
html[data-ledger] .alert-primary, html[data-ledger] .alert-success, html[data-ledger] .alert-info { background: var(--fescue-wash); border-color: color-mix(in srgb, var(--fescue) 45%, transparent); color: var(--ink); }
html[data-ledger] .alert-warning { background: var(--ochre-wash); border-color: color-mix(in srgb, var(--ochre) 55%, transparent); color: var(--ink); }
html[data-ledger] .alert-danger { background: var(--brick-wash); border-color: color-mix(in srgb, var(--brick) 55%, transparent); color: var(--ink); }
html[data-ledger] .btn-close { filter: none; opacity: .7; }
:root[data-theme="dark"] .btn-close { filter: invert(1); }

/* Bootstrap buttons, re-skinned so existing views (Access Denied, Support, Error, forms) match without markup changes */
html[data-ledger] .btn { font: 600 .9375rem/1.2 var(--font-ui); padding: .8rem 1.2rem; border-radius: 3px; box-shadow: none; text-decoration: none; }
html[data-ledger] .btn-lg { font-size: 1rem; padding: .9rem 1.4rem; }
html[data-ledger] .btn-sm { padding: .5rem .8rem; font-size: .875rem; }
html[data-ledger] .btn-primary { --bs-btn-bg: var(--fescue); --bs-btn-border-color: var(--fescue); --bs-btn-color: var(--on-fescue); --bs-btn-hover-bg: var(--fescue-hover); --bs-btn-hover-border-color: var(--fescue-hover); --bs-btn-hover-color: var(--on-fescue); --bs-btn-active-bg: var(--fescue-hover); --bs-btn-active-border-color: var(--fescue-hover); --bs-btn-active-color: var(--on-fescue); --bs-btn-disabled-bg: var(--fescue); --bs-btn-disabled-border-color: var(--fescue); --bs-btn-disabled-color: var(--on-fescue); }
html[data-ledger] .btn-outline-primary,
html[data-ledger] .btn-secondary,
html[data-ledger] .btn-outline-secondary,
html[data-ledger] .btn-light { --bs-btn-bg: transparent; --bs-btn-border-color: var(--rule-strong); --bs-btn-color: var(--ink); --bs-btn-hover-bg: var(--surface-sunk); --bs-btn-hover-border-color: var(--ink-3); --bs-btn-hover-color: var(--ink); --bs-btn-active-bg: var(--surface-sunk); --bs-btn-active-border-color: var(--ink-3); --bs-btn-active-color: var(--ink); --bs-btn-disabled-bg: transparent; --bs-btn-disabled-border-color: var(--rule-strong); --bs-btn-disabled-color: var(--ink); }
html[data-ledger] .btn-danger,
html[data-ledger] .btn-outline-danger { --bs-btn-bg: transparent; --bs-btn-border-color: var(--brick); --bs-btn-color: var(--brick); --bs-btn-hover-bg: var(--brick-wash); --bs-btn-hover-border-color: var(--brick); --bs-btn-hover-color: var(--brick); --bs-btn-active-bg: var(--brick-wash); --bs-btn-active-border-color: var(--brick); --bs-btn-active-color: var(--brick); }
html[data-ledger] .btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: none; }

/* ==========================================================================
   Forms (Phase 5): legend, labels and tags, error pattern, sticky action bar,
   delete section, collapsible groups. Applied by markup from the form transform;
   field widgets themselves are skinned in the Syncfusion layer above.
   ========================================================================== */
html[data-ledger] .control-section { margin-bottom: 1.15rem; }
html[data-ledger] .lg-legend { margin: 0 0 1.25rem; color: var(--ink-2); font-size: .875rem; }
html[data-ledger] .f-label .tag { font-weight: 500; font-size: .75rem; color: var(--ink-3); }
html[data-ledger] .f-label .tag--req { color: var(--ink-2); border: 1px solid var(--rule-strong); border-radius: 2px; padding: .05rem .35rem; line-height: 1.3; }
html[data-ledger] .control-section .f-label { margin-bottom: .35rem; }

/* errors: icon + text + what to do; never colour alone */
html[data-ledger] body label.e-error,
html[data-ledger] body .e-error-msg {
    display: flex !important; gap: .4rem; align-items: flex-start; margin: .4rem 0 0 !important; padding: 0;
    color: var(--brick) !important; font: 500 .875rem/1.4 var(--font-ui) !important; background: none; border: 0;
}
html[data-ledger] body label.e-error::before {
    content: "!"; flex: none; width: 1.05rem; height: 1.05rem; margin-top: .1rem; border-radius: 50%;
    background: var(--brick); color: var(--paper); font: 700 .7rem/1.05rem var(--font-ui); text-align: center;
}
html[data-ledger] .lg-errsummary { display: block; margin-bottom: 1.25rem; padding: .9rem 1rem; border-left-width: 1px; }
html[data-ledger] .lg-errsummary ul { margin: .5rem 0 0; padding-left: 1.2rem; }
html[data-ledger] .lg-errsummary a { color: var(--brick); text-decoration: underline; }
html[data-ledger] .lg-errsummary:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
html[data-ledger] .lg-errsummary strong::before {
    content: "!"; display: inline-block; width: 1.05rem; height: 1.05rem; margin-right: .45rem; border-radius: 50%;
    background: var(--brick); color: var(--paper); font: 700 .7rem/1.05rem var(--font-ui); text-align: center; vertical-align: .05em;
}

/* sticky save bar */
html[data-ledger] .lg-actions {
    position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    margin: 2rem 0 0; padding: .85rem 0; background: var(--paper); border-top: 1px solid var(--rule);
}
html[data-ledger] .lg-dirty { margin-left: auto; color: var(--ink-2); font-size: .8125rem; }
html[data-ledger] .lg-dirty:empty { display: none; }

/* delete section */
html[data-ledger] .lg-danger-zone { margin: 2rem 0 0; padding: 1.1rem 1.25rem 1.25rem; border: 1px solid color-mix(in srgb, var(--brick) 45%, transparent); border-radius: 3px; background: color-mix(in srgb, var(--brick-wash) 45%, transparent); max-width: 40rem; }
html[data-ledger] .lg-danger-zone h2 { margin: 0 0 .25rem; font: 600 1.125rem var(--font-display); color: var(--brick); font-variation-settings: "opsz" 24; }
html[data-ledger] .lg-danger-zone p { margin: 0 0 .9rem; color: var(--ink-2); font-size: .875rem; }

/* collapsible groups (Bootstrap accordion, ledger look) */
html[data-ledger] .accordion { --bs-accordion-bg: var(--surface); --bs-accordion-color: var(--ink); --bs-accordion-border-color: var(--rule); --bs-accordion-border-radius: 3px; --bs-accordion-inner-border-radius: 3px; --bs-accordion-btn-bg: var(--surface-sunk); --bs-accordion-active-bg: var(--surface-sunk); --bs-accordion-active-color: var(--ink); --bs-accordion-btn-color: var(--ink); --bs-accordion-btn-focus-box-shadow: none; --bs-accordion-btn-focus-border-color: var(--focus); }
html[data-ledger] .accordion-button { font: 600 1rem var(--font-ui); box-shadow: none; }
html[data-ledger] .accordion-button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
html[data-ledger] .accordion-button:not(.collapsed) { box-shadow: inset 0 -1px 0 var(--rule); }
html[data-ledger] .accordion-button .lg-count { margin-left: auto; margin-right: 1rem; order: 2; color: var(--ink-3); font: 500 .8125rem var(--font-ui); }
html[data-ledger] :root[data-theme="dark"] .accordion-button::after, :root[data-theme="dark"] .accordion-button::after { filter: invert(1) grayscale(1); }
html[data-ledger] .btn-outline-info { --bs-btn-bg: transparent; --bs-btn-border-color: var(--rule-strong); --bs-btn-color: var(--ink-2); --bs-btn-hover-bg: var(--surface-sunk); --bs-btn-hover-border-color: var(--ink-3); --bs-btn-hover-color: var(--ink); padding: .3rem .7rem; font-size: .8125rem; vertical-align: middle; margin-left: .5rem; }
html[data-ledger] .accordion-button::after { margin-left: 0; order: 3; }

/* Bootstrap form controls (Circle, sign-up, anywhere a plain <input class="form-control"> is used) */
html[data-ledger] .form-label { display: block; margin: 0 0 .35rem; font: 600 .8125rem/1.4 var(--font-ui); color: var(--ink); }
html[data-ledger] .form-control, html[data-ledger] .form-select { background-color: var(--paper); color: var(--ink); border: 1px solid var(--field); border-radius: 3px; font: 400 1rem/1.5 var(--font-ui); padding: .55rem .7rem; box-shadow: none; }
html[data-ledger] .form-control::placeholder { color: var(--ink-3); opacity: 1; }
html[data-ledger] .form-control:focus, html[data-ledger] .form-select:focus { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); background-color: var(--paper); color: var(--ink); }
html[data-ledger] .form-control:disabled, html[data-ledger] .form-select:disabled { background-color: var(--surface-sunk); color: var(--ink-3); }
html[data-ledger] .form-control.is-invalid, html[data-ledger] .form-select.is-invalid { border-color: var(--brick); box-shadow: 0 0 0 1px var(--brick); background-image: none; }
html[data-ledger] .invalid-feedback, html[data-ledger] .text-danger, html[data-ledger] .field-validation-error { color: var(--brick) !important; font-weight: 500; font-size: .875rem; }
html[data-ledger] .form-check-input { border-color: var(--field); background-color: var(--paper); }
html[data-ledger] .form-check-input:checked { background-color: var(--fescue); border-color: var(--fescue); }
html[data-ledger] .form-check-input:focus { box-shadow: none; outline: 2px solid var(--focus); outline-offset: 2px; }
html[data-ledger] .card { --bs-card-bg: var(--surface); --bs-card-border-color: var(--rule); --bs-card-border-radius: 3px; --bs-card-cap-bg: var(--surface-sunk); color: var(--ink); box-shadow: none; }
html[data-ledger] .text-muted { color: var(--ink-2) !important; }

/* "On this page" (long forms): side rail on wide screens, wrapped jump links on narrow ones */
html[data-ledger] .lg-section-title { margin: 2.25rem 0 1rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font: 600 1.375rem/1.2 var(--font-display); font-variation-settings: "opsz" 48; scroll-margin-top: 5rem; }
html[data-ledger] .lg-toc { margin: 0 0 1.5rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 3px; }
html[data-ledger] .lg-toc-title { margin: 0 0 .4rem; font: 600 .6875rem var(--font-ui); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
html[data-ledger] .lg-toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem .5rem; }
html[data-ledger] .lg-toc a { display: inline-block; padding: .4rem .7rem; border-radius: 3px; color: var(--ink-2); text-decoration: none; font-size: .875rem; }
html[data-ledger] .lg-toc a:hover { background: var(--surface-sunk); color: var(--ink); }
html[data-ledger] .lg-toc a[aria-current="true"] { background: var(--fescue-wash); color: var(--fescue); font-weight: 600; }
html[data-ledger] .lg-has-toc [data-sec] { scroll-margin-top: 5rem; }
@media (min-width: 1200px) {
    html[data-ledger] form.lg-has-toc { display: grid; grid-template-columns: minmax(0, 1fr) 13.5rem; column-gap: 2.5rem; align-items: start; }
    html[data-ledger] form.lg-has-toc > * { grid-column: 1; }
    html[data-ledger] form.lg-has-toc > .lg-toc { grid-column: 2; grid-row: 1 / span 40; position: sticky; top: 5rem; margin: 0; }
    html[data-ledger] form.lg-has-toc > .lg-section-title:first-of-type { margin-top: 0; border-top: 0; padding-top: 0; }
    html[data-ledger] .lg-toc ul { flex-direction: column; gap: .1rem; }
    html[data-ledger] .lg-toc a { display: block; }
}

/* ==========================================================================
   Lists and grids (Phase 6). The grid itself is skinned in the Syncfusion layer; this is the page around it.
   ========================================================================== */
html[data-ledger] .card.shadow-sm { box-shadow: none !important; }
html[data-ledger] .card-body.p-0 .e-grid { border: 0; border-radius: 0; }
html[data-ledger] .time-column, html[data-ledger] td.time-column { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-size: .875rem; letter-spacing: -.01em; }
html[data-ledger] .customspan { display: block; margin-bottom: .35rem; font: 600 .8125rem/1.4 var(--font-ui); color: var(--ink); }
html[data-ledger] .customspanValue { font: 400 .9375rem/1.5 var(--font-ui); color: var(--ink-2); }

/* grid toolbar (Create, Delete) */
html[data-ledger] body .e-grid .e-toolbar, html[data-ledger] body .e-grid .e-toolbar .e-toolbar-items { background: var(--surface); border-color: var(--rule); }
html[data-ledger] body .e-grid .e-toolbar .e-toolbar-item .e-tbar-btn { background: transparent; border-radius: 3px; color: var(--ink); }
html[data-ledger] body .e-grid .e-toolbar .e-toolbar-item .e-tbar-btn:hover { background: var(--surface-sunk); }
html[data-ledger] body .e-grid .e-toolbar .e-tbar-btn-text, html[data-ledger] body .e-grid .e-toolbar .e-icons { color: var(--ink); font-family: inherit; }
html[data-ledger] body .e-grid .e-toolbar .e-icons { font-family: 'e-icons'; }
html[data-ledger] body .e-grid .e-emptyrow td { font-style: normal; }

/* the search panel above a log book */
html[data-ledger] #searchAccordion { margin-bottom: 1rem; }
html[data-ledger] #searchAccordion .accordion-body { background: var(--surface); }
html[data-ledger] #searchAccordion .f-label { margin-bottom: .35rem; }

/* phone: the stacked-entry rows get a little more room, and a visible edit affordance */
@media (max-width: 640px) {
    html[data-ledger] body .e-grid.ledger-stack .e-content td.e-rowcell[data-label=""]::before { display: none; }
    html[data-ledger] body .e-grid.ledger-stack .e-content td.e-rowcell[data-label=""] { display: block; padding-top: .5rem; }
    html[data-ledger] body .e-grid.ledger-stack .e-content tr.e-row { padding: .9rem 1rem; }
    html[data-ledger] body .e-grid.ledger-stack .e-toolbar { padding: .25rem .5rem; }
}
html[data-ledger] body .e-pager .e-mfirst, html[data-ledger] body .e-pager .e-mprev, html[data-ledger] body .e-pager .e-mnext, html[data-ledger] body .e-pager .e-mlast,
html[data-ledger] body .e-pager .e-first, html[data-ledger] body .e-pager .e-prev, html[data-ledger] body .e-pager .e-next, html[data-ledger] body .e-pager .e-last { background: transparent !important; color: var(--ink-2); }

/* Dashboard and overview pages (Phase 7) */
html[data-ledger] .lg-dash-title { font: 600 1.375rem/1.2 var(--font-display); font-variation-settings: "opsz" 48; margin: 0 0 .75rem; }
html[data-ledger] .e-accumulationchart svg text, html[data-ledger] .e-chart svg text { font-family: var(--font-ui) !important; }
html[data-ledger] #eventGrid .e-btn.e-flat.e-details { margin: .1rem 0; }
html[data-ledger] #schedule { margin-top: .5rem; }

/* ==========================================================================
   Sign-up, help and member pages (Phase 8)
   ========================================================================== */
.pub-signup { width: min(60rem, 100% - 2.5rem); }
.pub-help { width: min(48rem, 100% - 2.5rem); }

/* stepper (sign-up flow): fescue for the current and finished steps, ink for the rest */
html[data-ledger] body .e-stepper .e-step .e-step-indicator, html[data-ledger] body .e-stepper .e-step .e-indicator { border-color: var(--field); color: var(--ink-2); background: var(--paper); }
html[data-ledger] body .e-stepper .e-step.e-step-selected .e-indicator, html[data-ledger] body .e-stepper .e-step.e-step-completed .e-indicator,
html[data-ledger] body .e-stepper .e-step.e-step-selected .e-step-indicator, html[data-ledger] body .e-stepper .e-step.e-step-completed .e-step-indicator { background: var(--fescue); border-color: var(--fescue); color: var(--on-fescue); }
html[data-ledger] body .e-stepper .e-step-text, html[data-ledger] body .e-stepper .e-step-label { color: var(--ink-2); font-family: var(--font-ui); }
html[data-ledger] body .e-stepper .e-step.e-step-selected .e-step-text, html[data-ledger] body .e-stepper .e-step.e-step-selected .e-step-label { color: var(--ink); font-weight: 600; }
html[data-ledger] body .e-stepper .e-step-progress, html[data-ledger] body .e-stepper .e-stepper-progressbar > .e-progressbar-fill { background: var(--fescue); }

/* help guides: a reading column. Markdown output uses plain elements, so style the elements. */
.help-guide { font-size: 1.0625rem; line-height: 1.7; color: var(--ink); }
.help-guide h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin: 0 0 1rem; }
.help-guide h2 { font-size: 1.625rem; margin: 2.25rem 0 .6rem; font-variation-settings: "opsz" 72; }
.help-guide h3 { font-size: 1.25rem; margin: 1.75rem 0 .5rem; }
.help-guide p, .help-guide li { max-width: 66ch; }
.help-guide li { margin-bottom: .3rem; }
.help-guide code { font-family: var(--font-data); font-size: .875em; background: var(--surface-sunk); border-radius: 2px; padding: .1em .35em; color: var(--ink); }
.help-guide pre { background: var(--surface-sunk); border: 1px solid var(--rule); border-radius: 3px; padding: 1rem; overflow-x: auto; }
.help-guide pre code { background: none; padding: 0; }
.help-guide blockquote { margin: 1.25rem 0; padding: .1rem 1rem; border: 1px solid var(--rule); border-radius: 3px; background: var(--surface); color: var(--ink-2); }
.help-guide table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: .9375rem; }
.help-guide th { text-align: left; background: var(--surface-sunk); border-bottom: 2px solid var(--rule-strong); padding: .6rem .8rem; font-weight: 600; }
.help-guide td { padding: .6rem .8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.help-guide img { max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 3px; }

/* ==========================================================================
   Ported from the retired site.css (Phase 9): the small set of classes the views still use.
   ========================================================================== */
.control-wrapper, .TextArea-control-section { width: 100%; }
.command-center { text-align: center; }

/* sign-up plan choice */
.radio-container { cursor: pointer; margin: .5rem 0; padding: 1rem; border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--surface); transition: background .15s, border-color .15s; }
.radio-container:hover { background: var(--surface-sunk); border-color: var(--ink-3); }
.radio-container input[type="radio"] { display: none; }
.radio-container.selected { border: 2px solid var(--fescue); background: var(--fescue-wash); }
.radio-container:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.productHeader { background: var(--fescue-wash); color: var(--fescue); padding: .5rem 1rem; border-radius: 3px; font-weight: 600; }

/* scheduler tooltip content */
.e-schedule-event-tooltip .tooltip-wrap { display: flex; }
.e-schedule-event-tooltip .tooltip-wrap .content-area { padding-left: 6px; font-size: .75rem; }
.e-schedule-event-tooltip .tooltip-wrap .name { font-weight: 600; font-size: .75rem; }

/* help panel (Syncfusion sidebar opened from any page) */
.help-sidebar-inner { font: 400 .9375rem/1.6 var(--font-ui); color: var(--ink); background: var(--surface); }
.help-sidebar-header { background: var(--surface); border-bottom-color: var(--rule) !important; }
.help-sidebar-header h5 { font: 600 1rem var(--font-display); color: var(--ink); }
.help-sidebar-body { font-size: .9375rem; line-height: 1.6; color: var(--ink); }
.help-sidebar-body h1, .help-sidebar-body h2, .help-sidebar-body h3, .help-sidebar-body h4, .help-sidebar-body h5, .help-sidebar-body h6 { font-family: var(--font-display); font-weight: 600; color: var(--ink); margin: 1rem 0 .5rem; }
.help-sidebar-footer { background: var(--surface); border-top-color: var(--rule) !important; }
html[data-ledger] body .e-sidebar { background: var(--surface); border-color: var(--rule-strong); color: var(--ink); }

/* touch targets: Syncfusion inputs keep the 44px minimum the old stylesheet enforced */
html[data-ledger] body .e-input-group, html[data-ledger] body .e-input-group.e-control-wrapper, html[data-ledger] body .e-float-input { min-height: 44px; }

/* motion: one authored animation (the homepage ledger); everything else respects reduced motion */
@media (prefers-reduced-motion: reduce) {
    html[data-ledger] *, html[data-ledger] *::before, html[data-ledger] *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Link-styled Bootstrap buttons: the base `a` colour must not win over the button's own text colour
   (it made <a class="btn btn-primary"> green text on a green fill). */
html[data-ledger] a.btn { color: var(--bs-btn-color); text-decoration: none; }
html[data-ledger] a.btn:hover, html[data-ledger] a.btn:focus-visible { color: var(--bs-btn-hover-color); }
html[data-ledger] a.btn:active, html[data-ledger] a.btn.active { color: var(--bs-btn-active-color); }
html[data-ledger] a.btn.disabled, html[data-ledger] fieldset:disabled a.btn { color: var(--bs-btn-disabled-color); }

/* Tooltips are .e-popup too, and the generic popup rule (paper surface) was out-ranking the ink tooltip, leaving
   paper text on a paper background. Tooltip = inverse ink block in both themes; the scheduler's template inherits. */
html[data-ledger] body .e-tooltip-wrap.e-popup,
html[data-ledger] body .e-tooltip-wrap.e-popup.e-popup-open { background: var(--ink) !important; border: 1px solid var(--ink) !important; color: var(--paper) !important; box-shadow: none !important; }
html[data-ledger] body .e-tooltip-wrap .e-tip-content,
html[data-ledger] body .e-tooltip-wrap .e-tip-content * { color: var(--paper) !important; }
html[data-ledger] body .e-tooltip-wrap .e-arrow-tip-inner, html[data-ledger] body .e-tooltip-wrap .e-arrow-tip-outer { color: var(--ink) !important; }

/* label inside a log group: its own reference-data pages */
.lg-nav-sep { margin: .55rem 0 .15rem; padding: 0 .7rem; font: 600 .6875rem var(--font-ui); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }

/* ==========================================================================
   Plain Bootstrap tables, badges, list groups (Circle, Usage, Billing, Devices...). Found unstyled in review.
   Same look as the grid: Blotting Paper header with a double rule, hairline rows, mono for dates and numbers.
   ========================================================================== */
html[data-ledger] .table {
    --bs-table-color: var(--ink); --bs-table-bg: transparent; --bs-table-border-color: var(--rule);
    --bs-table-striped-bg: color-mix(in srgb, var(--surface-sunk) 38%, transparent); --bs-table-striped-color: var(--ink);
    --bs-table-hover-bg: var(--surface-sunk); --bs-table-hover-color: var(--ink); --bs-table-active-bg: var(--fescue-wash);
    color: var(--ink); font-size: .9375rem; margin-bottom: 0;
}
html[data-ledger] .table > :not(caption) > * > * { background-color: var(--bs-table-bg); color: var(--bs-table-color); border-bottom-color: var(--rule); padding: .8rem 1rem; box-shadow: none; }
html[data-ledger] .table > thead > tr > th, html[data-ledger] .table th { background: var(--surface-sunk); color: var(--ink-2); font: 600 .8125rem/1.4 var(--font-ui); letter-spacing: .02em; border-bottom: 3px double var(--rule-strong); text-align: left; }
html[data-ledger] .table > thead > tr > th:last-child.text-end, html[data-ledger] .table th.text-end { text-align: right; }
html[data-ledger] .table-hover > tbody > tr:hover > * { background: var(--surface-sunk); color: var(--ink); }
html[data-ledger] .table-striped > tbody > tr:nth-of-type(odd) > * { background: var(--bs-table-striped-bg); color: var(--ink); }
html[data-ledger] .card .table, html[data-ledger] .table-responsive { border: 1px solid var(--rule-strong); border-radius: 3px; }
html[data-ledger] .table td .text-muted, html[data-ledger] .table small { color: var(--ink-2) !important; }

/* badges: text carries the meaning; fills are the ledger washes */
html[data-ledger] .badge { font: 600 .75rem/1 var(--font-ui); letter-spacing: .02em; padding: .32rem .5rem; border-radius: 2px; border: 1px solid transparent; }
html[data-ledger] .text-bg-primary, html[data-ledger] .bg-primary { background: var(--fescue) !important; color: var(--on-fescue) !important; }
html[data-ledger] .text-bg-success, html[data-ledger] .bg-success { background: var(--fescue-wash) !important; color: var(--fescue) !important; border-color: color-mix(in srgb, var(--fescue) 40%, transparent); }
html[data-ledger] .text-bg-warning, html[data-ledger] .bg-warning { background: var(--ochre-wash) !important; color: var(--ochre) !important; border-color: color-mix(in srgb, var(--ochre) 45%, transparent); }
html[data-ledger] .text-bg-danger, html[data-ledger] .bg-danger { background: var(--brick-wash) !important; color: var(--brick) !important; border-color: color-mix(in srgb, var(--brick) 45%, transparent); }
html[data-ledger] .text-bg-info, html[data-ledger] .bg-info { background: var(--surface-sunk) !important; color: var(--ink) !important; border-color: var(--rule-strong); }
html[data-ledger] .text-bg-secondary, html[data-ledger] .bg-secondary, html[data-ledger] .text-bg-light, html[data-ledger] .bg-light, html[data-ledger] .text-bg-dark, html[data-ledger] .bg-dark { background: var(--surface-sunk) !important; color: var(--ink-2) !important; border-color: var(--rule-strong); }

/* list groups, nav pills, progress, pagination */
html[data-ledger] .list-group { --bs-list-group-bg: var(--surface); --bs-list-group-color: var(--ink); --bs-list-group-border-color: var(--rule); --bs-list-group-action-hover-bg: var(--surface-sunk); --bs-list-group-action-hover-color: var(--ink); --bs-list-group-action-active-bg: var(--fescue-wash); --bs-list-group-action-active-color: var(--fescue); --bs-list-group-active-bg: var(--fescue); --bs-list-group-active-border-color: var(--fescue); --bs-list-group-border-radius: 3px; }
html[data-ledger] .nav-pills { --bs-nav-pills-link-active-bg: var(--fescue); --bs-nav-pills-link-active-color: var(--on-fescue); --bs-nav-link-color: var(--ink-2); --bs-nav-link-hover-color: var(--ink); --bs-nav-pills-border-radius: 3px; }
html[data-ledger] .progress { --bs-progress-bg: var(--surface-sunk); --bs-progress-bar-bg: var(--fescue); --bs-progress-border-radius: 2px; }
html[data-ledger] .pagination { --bs-pagination-color: var(--ink-2); --bs-pagination-bg: transparent; --bs-pagination-border-color: var(--rule-strong); --bs-pagination-hover-bg: var(--surface-sunk); --bs-pagination-hover-color: var(--ink); --bs-pagination-active-bg: var(--fescue); --bs-pagination-active-border-color: var(--fescue); --bs-pagination-active-color: var(--on-fescue); --bs-pagination-focus-box-shadow: none; }
html[data-ledger] .btn-info, html[data-ledger] .btn-warning, html[data-ledger] .btn-success { --bs-btn-bg: transparent; --bs-btn-color: var(--ink); --bs-btn-border-color: var(--rule-strong); --bs-btn-hover-bg: var(--surface-sunk); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--ink-3); }
html[data-ledger] .btn-link { --bs-btn-color: var(--fescue); --bs-btn-hover-color: var(--fescue-hover); }

/* Bootstrap's own colour variables, mapped to the ledger tokens, so its utilities (.text-body, .text-muted,
   .text-secondary, .border, .bg-white ...) follow the theme instead of Bootstrap's light defaults.
   The rgb triplets are the same colours as --ink / --ink-2 (Bootstrap utilities need them split). */
html[data-ledger] {
    --bs-body-color: var(--ink); --bs-body-color-rgb: 28, 35, 30;
    --bs-body-bg: var(--paper); --bs-body-bg-rgb: 243, 238, 225;
    --bs-emphasis-color: var(--ink); --bs-emphasis-color-rgb: 28, 35, 30;
    --bs-secondary-color: var(--ink-2); --bs-secondary-color-rgb: 79, 86, 77;
    --bs-tertiary-color: var(--ink-3); --bs-secondary-bg: var(--surface-sunk); --bs-tertiary-bg: var(--surface);
    --bs-border-color: var(--rule); --bs-link-color: var(--fescue); --bs-link-hover-color: var(--fescue-hover);
    --bs-heading-color: var(--ink); --bs-code-color: var(--ink);
}
html[data-theme="dark"][data-ledger] {
    --bs-body-color-rgb: 236, 230, 212; --bs-body-bg-rgb: 18, 24, 19;
    --bs-emphasis-color-rgb: 236, 230, 212; --bs-secondary-color-rgb: 181, 185, 168;
}
@media (prefers-color-scheme: dark) {
    html[data-ledger]:not([data-theme="light"]):not([data-theme="dark"]) {
        --bs-body-color-rgb: 236, 230, 212; --bs-body-bg-rgb: 18, 24, 19;
        --bs-emphasis-color-rgb: 236, 230, 212; --bs-secondary-color-rgb: 181, 185, 168;
    }
}
html[data-ledger] .text-body, html[data-ledger] .text-dark, html[data-ledger] .text-black { color: var(--ink) !important; }
html[data-ledger] .text-secondary, html[data-ledger] .text-body-secondary { color: var(--ink-2) !important; }
html[data-ledger] .bg-white, html[data-ledger] .bg-body { background-color: var(--surface) !important; }
html[data-ledger] .table-responsive .table { border: 0; }
html[data-ledger] .card .table:not(.table-responsive .table) { border: 1px solid var(--rule-strong); border-radius: 3px; }
html[data-ledger] a.lg-skip, html[data-ledger] a.lg-skip:hover, html[data-ledger] a.lg-skip:focus { color: var(--paper); text-decoration: none; }
/* closing band: the global heading colour must not win over the band's own ink */
html[data-ledger] .pub-final h2, html[data-ledger] .pub-final h3 { color: var(--final-ink); }
/* scheduler: the dark ink is near-black so bright member colours (e.g. #007fff) still reach 4.5:1 */
html[data-ledger] body .e-schedule .e-appointment[data-ink="dark"] { color: #0a0d0b; }

/* ==========================================================================
   Calendar agenda (overview pages): Month / Agenda switch, "show logged" toggle, agenda list.
   Built from DESIGN.md "Calendar". Same state language as the month grid: colour edge = member,
   dashed = planned, brick edge + icon + words = overdue, check = logged. Never colour alone.
   ========================================================================== */
html[data-ledger] .cal-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; margin: 0 0 .9rem; }
html[data-ledger] .cal-seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 3px; overflow: hidden; background: var(--surface); }
html[data-ledger] .cal-seg button { min-height: 44px; padding: 0 1.1rem; background: none; border: 0; color: var(--ink-2); font: 500 .9375rem var(--font-ui); cursor: pointer; }
html[data-ledger] .cal-seg button + button { border-left: 1px solid var(--rule-strong); }
html[data-ledger] .cal-seg button:hover { background: var(--surface-sunk); color: var(--ink); }
html[data-ledger] .cal-seg button[aria-pressed="true"] { background: var(--fescue-wash); color: var(--fescue); font-weight: 600; }
html[data-ledger] .cal-seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
html[data-ledger] .lg-check { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; margin: 0; color: var(--ink); font-size: .9375rem; cursor: pointer; }
html[data-ledger] .lg-check .form-check-input { width: 1.2rem; height: 1.2rem; margin: 0; flex: none; }

html[data-ledger] .lg-agenda { max-width: 44rem; }
html[data-ledger] .lg-agenda[hidden], html[data-ledger] #ledger-schedule-wrap[hidden] { display: none; }
html[data-ledger] .ag-day { display: flex; align-items: baseline; gap: .5rem; margin: 1.5rem 0 .55rem; font: 600 .75rem var(--font-ui); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
html[data-ledger] .lg-agenda section:first-child .ag-day { margin-top: .25rem; }
html[data-ledger] .ag-day .n { font: 500 .8125rem var(--font-data); letter-spacing: 0; }
html[data-ledger] .ag-day.over { color: var(--brick); }
html[data-ledger] .ag-item { display: grid; grid-template-columns: .35rem 1fr; gap: .85rem; margin: 0 0 .55rem; padding: .85rem .9rem .85rem 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
html[data-ledger] .ag-item::before { content: ""; background: var(--c, var(--fescue)); margin: -.85rem 0; }
html[data-ledger] .ag-item.plan::before { background: repeating-linear-gradient(180deg, var(--c, var(--fescue)) 0 6px, transparent 6px 10px); }
html[data-ledger] .ag-item.logged { background: transparent; }
html[data-ledger] .ag-item.logged::before { background: var(--c, var(--fescue)); opacity: .55; }
html[data-ledger] .ag-item.over { border-color: color-mix(in srgb, var(--brick) 55%, transparent); background: color-mix(in srgb, var(--brick-wash) 50%, var(--surface)); }
html[data-ledger] .ag-item.over::before { background: var(--brick); }
html[data-ledger] .ag-item .ag-title { margin: 0; font: 600 1rem/1.3 var(--font-ui); letter-spacing: 0; color: var(--ink); }
html[data-ledger] .ag-meta { margin: .2rem 0 0; font-size: .8125rem; color: var(--ink-2); overflow-wrap: anywhere; }
html[data-ledger] .ag-meta .mono { color: var(--ink); }
html[data-ledger] .ag-flag { display: inline-flex; align-items: center; gap: .4rem; margin: .4rem 0 0; font: 600 .8125rem var(--font-ui); color: var(--brick); }
html[data-ledger] .ag-flag::before { content: "!"; flex: none; width: 1rem; height: 1rem; border-radius: 50%; background: var(--brick); color: var(--paper); font: 700 .7rem/1rem var(--font-ui); text-align: center; }
html[data-ledger] .ag-done { margin: .4rem 0 0; font: 600 .8125rem var(--font-ui); color: var(--fescue); }
html[data-ledger] .ag-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
html[data-ledger] .ag-actions .btn { display: inline-flex; align-items: center; min-height: 44px; padding: .55rem .95rem; font-size: .875rem; }
html[data-ledger] .ag-actions .btn[aria-disabled="true"] { opacity: .65; pointer-events: none; }
html[data-ledger] .ag-empty { padding: 1.5rem 0; color: var(--ink-2); }
html[data-ledger] .ag-empty p { margin: 0 0 .75rem; }
@media (max-width: 575.98px) { html[data-ledger] .ag-actions .btn { flex: 1 1 auto; justify-content: center; } html[data-ledger] .lg-agenda { max-width: none; } }

/* month calendar: a plan that already has a log, shown only when the toggle is on. Solid edge (not dashed) and a check icon; no opacity, so text contrast holds. */

/* ==========================================================================
   Month grid states (Calendar). The member's own colours are never replaced; they pick one for logs and one for plans
   per area in Settings. State is drawn on top: planned = tint + dashed edge in their colour, overdue = brick "!" and edge,
   logged plan = check icon. ledger-grids.js (LedgerSchedule.paint) sets --ev (their colour) and the state classes.
   ========================================================================== */
html[data-ledger] body .e-schedule .e-appointment.e-planned {
    background: color-mix(in srgb, var(--ev, var(--fescue)) 20%, var(--surface)) !important;
    color: var(--ink) !important;
    border: 2px dashed color-mix(in srgb, var(--ev, var(--fescue)) 70%, var(--ink)) !important;
}
html[data-ledger] body .e-schedule .e-appointment.e-planned .e-subject,
html[data-ledger] body .e-schedule .e-appointment.e-planned span,
html[data-ledger] body .e-schedule .e-appointment.e-planned i { color: var(--ink) !important; }
html[data-ledger] body .e-schedule .e-appointment.e-planned.e-logged { border-style: solid !important; }
html[data-ledger] body .e-schedule .e-appointment.e-overdue { box-shadow: inset 4px 0 0 var(--brick); }
html[data-ledger] body .e-schedule .e-appointment.e-overdue::before {
    content: "!"; display: inline-block; width: 1rem; height: 1rem; margin-right: .3rem; border-radius: 50%; vertical-align: middle;
    background: var(--brick); color: var(--paper); font: 700 .7rem/1rem var(--font-ui); text-align: center;
}

/* legend: shapes in neutral ink, because the colours belong to the member */
html[data-ledger] .cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.25rem; margin: 0 0 .75rem; font-size: .8125rem; color: var(--ink-2); }
html[data-ledger] .cal-legend[hidden] { display: none; }
html[data-ledger] .cal-legend span { display: inline-flex; align-items: center; gap: .45rem; }
html[data-ledger] .cal-legend .sw { width: 1.6rem; height: .9rem; border-radius: 2px; border: 2px solid transparent; background: var(--ink-3); }
html[data-ledger] .cal-legend .sw.plan { background: color-mix(in srgb, var(--ink-3) 20%, var(--surface)); border: 2px dashed var(--ink-3); }
html[data-ledger] .cal-legend .sw.over { background: color-mix(in srgb, var(--ink-3) 20%, var(--surface)); border: 2px dashed var(--ink-3); box-shadow: inset 4px 0 0 var(--brick); }
html[data-ledger] .cal-legend .sw.done { background: color-mix(in srgb, var(--ink-3) 20%, var(--surface)); border: 2px solid var(--ink-3); }
html[data-ledger] .cal-legend .ic { display: inline-grid; place-items: center; width: 1rem; height: 1rem; border-radius: 50%; background: var(--brick); color: var(--paper); font: 700 .7rem/1 var(--font-ui); }
html[data-ledger] .cal-legend .ck { color: var(--fescue); font-weight: 700; }

/* phone month view: a dot per entry, tap a day to open it in the agenda */
@media (max-width: 640px) {
    html[data-ledger] body .e-schedule.ledger-dots-on .e-appointment,
    html[data-ledger] body .e-schedule.ledger-dots-on .e-more-indicator,
    html[data-ledger] body .e-schedule.ledger-dots-on .e-appointment-wrapper { display: none !important; }
    html[data-ledger] body .e-schedule.ledger-dots-on .e-month-view .e-work-cells { min-height: 3.4rem; cursor: pointer; vertical-align: top; }
}
html[data-ledger] .ledger-dots { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: .1rem .3rem .3rem; }
html[data-ledger] .ledger-dot { display: block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--ev, var(--fescue)); box-shadow: 0 0 0 1px var(--rule-strong); }
html[data-ledger] .ledger-dot.planned { background: transparent; border: 2px solid var(--ev, var(--fescue)); }
html[data-ledger] .ledger-dot.logged-plan { background: color-mix(in srgb, var(--ev, var(--fescue)) 40%, var(--surface)); }
html[data-ledger] .ledger-dot.overdue { background: transparent; border: 2px solid var(--ev, var(--fescue)); box-shadow: 0 0 0 2px var(--brick); margin: 0 2px; }
html[data-ledger] .ledger-dots-more { font: 500 .6875rem var(--font-data); color: var(--ink-2); }
html[data-ledger] .ag-item:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
html[data-ledger] .cal-legend .lg-legend-dots { display: none; }
@media (max-width: 640px) {
    html[data-ledger] .cal-legend .lg-legend-note { display: none; }
    html[data-ledger] .cal-legend .lg-legend-dots { display: inline-flex; flex-basis: 100%; }
}

/* ==========================================================================
   Log entry forms (Lawn log first; Home, General and the plan logs follow). Sections with titles, fields sized to their
   content on a 12-column grid, "Logged from your plan" banner, quick date chips, notes counter. DESIGN.md, "Forms".
   ========================================================================== */
html[data-ledger] .lf-sub { margin: .1rem 0 0; color: var(--ink-2); font-size: .9375rem; }
html[data-ledger] .lf-sub .mono, html[data-ledger] .lf-attr .mono { color: var(--ink-2); }
html[data-ledger] .lf-attr { margin: .3rem 0 1.1rem; color: var(--ink-3); font-size: .8125rem; }
html[data-ledger] .lf-req { border: 1px solid var(--rule-strong); border-radius: 2px; padding: .05rem .35rem; font-size: .75rem; color: var(--ink-2); }

html[data-ledger] .lf-banner { display: flex; gap: .75rem; align-items: flex-start; margin: 0 0 1.5rem; padding: .85rem 1rem; max-width: 46rem; background: var(--fescue-wash); border: 1px solid color-mix(in srgb, var(--fescue) 40%, transparent); border-radius: 3px; color: var(--ink); font-size: .9375rem; }
html[data-ledger] .lf-banner-ic { flex: none; display: grid; place-items: center; width: 1.25rem; height: 1.25rem; margin-top: .1rem; border-radius: 50%; background: var(--fescue); color: var(--on-fescue); font: 700 .75rem/1 var(--font-ui); }
html[data-ledger] .lf-banner a { margin-left: .35rem; white-space: nowrap; }

/* 12-column field grid: widths follow the content, not "everything half width" */
html[data-ledger] .lf-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 1.25rem; max-width: 46rem; }
html[data-ledger] .lf-field { grid-column: span 12; min-width: 0; margin-bottom: 1.1rem; }
html[data-ledger] .lf-field.s3 { grid-column: span 3; }
html[data-ledger] .lf-field.s4 { grid-column: span 4; }
html[data-ledger] .lf-field.s6 { grid-column: span 6; }
html[data-ledger] .lf-field.s8 { grid-column: span 8; }

/* Measured field (#204): a number box with its unit select beside it (_MeasurementInput). A validator error label
   appended into the wrapper spans the whole row. A rate of application carries a second select for its per-area basis. */
html[data-ledger] .lg-measure { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem; gap: .5rem; align-items: start; }
html[data-ledger] .lg-measure--rate { grid-template-columns: minmax(0, 1fr) 6rem 9.5rem; }
html[data-ledger] .lg-measure > label.e-error { grid-column: 1 / -1; }
html[data-ledger] .lg-measure .lg-measure-unit { min-width: 0; padding-left: .5rem; padding-right: 1.6rem; }
@media (max-width: 420px) {
    html[data-ledger] .lg-measure--rate { grid-template-columns: minmax(0, 1fr) 6.5rem; }
    html[data-ledger] .lg-measure--rate > .lg-measure-unit:last-of-type { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    html[data-ledger] .lf-field.s3, html[data-ledger] .lf-field.s4, html[data-ledger] .lf-field.s6, html[data-ledger] .lf-field.s8 { grid-column: span 12; }
    html[data-ledger] .lf-field.keep { grid-column: span 6; }
}

/* Wide screens (#208). From 1200px the grid and accordion fill the form column instead of stopping at 46rem; the base spans simply stretch.
   From 1600px a field may take a different span (xl-sN), because only then is the column wide enough to give long-valued fields more
   room without squeezing the short ones. Below 1200px none of this applies: the 46rem cap and the base spans are as they were. */
@media (min-width: 1200px) {
    html[data-ledger] .lf-grid, html[data-ledger] .lf-acc, html[data-ledger] .lf-banner { max-width: none; }
}
@media (min-width: 1600px) {
    html[data-ledger] .lf-field.xl-s2 { grid-column: span 2; }
    html[data-ledger] .lf-field.xl-s3 { grid-column: span 3; }
    html[data-ledger] .lf-field.xl-s4 { grid-column: span 4; }
    html[data-ledger] .lf-field.xl-s5 { grid-column: span 5; }
    html[data-ledger] .lf-field.xl-s6 { grid-column: span 6; }
    html[data-ledger] .lf-field.xl-s7 { grid-column: span 7; }
    html[data-ledger] .lf-field.xl-s8 { grid-column: span 8; }
    html[data-ledger] .lf-field.xl-s9 { grid-column: span 9; }
    html[data-ledger] .lf-field.xl-s12 { grid-column: span 12; }
}

html[data-ledger] .lf-chips { display: flex; gap: .4rem; margin-top: .45rem; }
html[data-ledger] .lf-chip { min-height: 2.25rem; padding: 0 .75rem; background: none; border: 1px solid var(--rule-strong); border-radius: 3px; color: var(--ink-2); font: 500 .8125rem var(--font-ui); cursor: pointer; }
html[data-ledger] .lf-chip:hover { background: var(--surface-sunk); color: var(--ink); }
html[data-ledger] .lf-chip[aria-pressed="true"] { background: var(--fescue-wash); color: var(--fescue); border-color: color-mix(in srgb, var(--fescue) 45%, transparent); font-weight: 600; }
html[data-ledger] .lf-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
html[data-ledger] .lf-count { margin: .3rem 0 0; text-align: right; font-size: .75rem; color: var(--ink-3); }
html[data-ledger] .lf-count:empty { display: none; }
html[data-ledger] .lf-hint-block { margin: -.5rem 0 1rem; max-width: 40rem; color: var(--ink-2); font-size: .875rem; }
html[data-ledger] .lf-acc { max-width: 46rem; }
html[data-ledger] .lf-acc .accordion-body { padding-bottom: 0; }
html[data-ledger] .lg-toc a .lf-toc-n { margin-left: .35rem; padding: 0 .4rem; background: var(--surface-sunk); border-radius: 999px; font: 500 .75rem var(--font-data); color: var(--ink-2); }
@media (max-width: 1199.98px) { html[data-ledger] form.lg-has-toc > .lg-toc { margin-top: 1rem; } }
