/* Fonts (SIL OFL — licenses alongside in ../fonts) */
@font-face {
    font-family: "Saira Condensed";
    src: url("../fonts/SairaCondensed-Regular.6f84d0203fea.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Saira Condensed";
    src: url("../fonts/SairaCondensed-Medium.ce0eb0e6fd35.ttf") format("truetype");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "Saira Condensed";
    src: url("../fonts/SairaCondensed-SemiBold.85e9cc387433.ttf") format("truetype");
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "Saira Condensed";
    src: url("../fonts/SairaCondensed-Bold.c019c2573e77.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Jaro";
    src: url("../fonts/Jaro-Regular-VariableFont_opsz.ff9669c8108c.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Economica";
    src: url("../fonts/Economica-Regular.cf6c76be23e4.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Economica";
    src: url("../fonts/Economica-Italic.8d40caedd6e5.ttf") format("truetype");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "Economica";
    src: url("../fonts/Economica-Bold.1d72c18e8a33.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Economica";
    src: url("../fonts/Economica-BoldItalic.55c9edb637d6.ttf") format("truetype");
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "Geo";
    src: url("../fonts/Geo-Regular.566960c80213.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Geo";
    src: url("../fonts/Geo-Italic.6fbe402dac4d.ttf") format("truetype");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "BenchNine";
    src: url("../fonts/BenchNine-Light.0fea981f5ba8.ttf") format("truetype");
    font-weight: 300;
    font-display: swap;
}
@font-face {
    font-family: "BenchNine";
    src: url("../fonts/BenchNine-Regular.28942f8e8e2d.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "BenchNine";
    src: url("../fonts/BenchNine-Bold.57293446c964.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Jockey One";
    src: url("../fonts/JockeyOne-Regular.d4c58485a8aa.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Aclonica";
    src: url("../fonts/Aclonica-Regular.543459e87802.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Englebert";
    src: url("../fonts/Englebert-Regular.f0340b336f8a.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}

/* Themes.
   Colors: role-based palette per theme (primary, secondary, accent, neutrals,
   status, focus) emitted by base.html as --color-<role>, from core/themes.py.
   Rules below never use --color-* directly: they use --use-* tokens, which
   base.html maps to a role (USES in core/themes.py; editable in the theme editor).
   Hover/pressed shades are derived here with color-mix. */
:root,
[data-theme="comic"] {
    --font-body: "BenchNine", system-ui, sans-serif;
    --font-heading: "Jockey One", "BenchNine", system-ui, sans-serif;
}

[data-theme="pastry"] {
    --font-body: "Saira Condensed", system-ui, sans-serif;
    --font-heading: "Jaro", "Saira Condensed", system-ui, sans-serif;
}

[data-theme="amsterdam"] {
    --font-body: "Economica", system-ui, sans-serif;
    --font-heading: "Geo", "Economica", system-ui, sans-serif;
}

[data-theme="coral"] {
    --font-body: "Englebert", system-ui, sans-serif;
    --font-heading: "Aclonica", "Englebert", system-ui, sans-serif;
}

:root {
    --sidenav-width: 240px;
    --hover-shade: 12%;
    --pressed-shade: 24%;
}

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

html, body { height: 100%; margin: 0; }
/* The dashboard's top menu stays on screen (sticky); anchors (#documents) land below it. */
html { scroll-padding-top: 4.5rem; }

body {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    color: var(--use-text);
    background: var(--use-page-bg);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--use-heading);
    font-weight: 400;
    margin: 0;
}

a { color: var(--use-link); }

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--use-focus-ring);
    outline-offset: 2px;
}

::placeholder { color: var(--use-placeholder); opacity: 1; }

.layout {
    display: flex;
    min-height: 100vh;
}

/* Side navigation */
/* Only the client area scrolls: the side nav stays put, the full viewport tall, with the theme picker at
   its foot (it scrolls within itself on a very short window). */
.sidenav {
    flex: 0 0 var(--sidenav-width);
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    align-self: flex-start;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--use-sidenav-bg);
    color: var(--use-sidenav-text);
    border-right: 1px solid var(--use-divider);
}

.sidenav__banner {
    padding: 1.25rem 1.5rem;
    border-bottom: 3px solid var(--use-sidenav-active);
}

.sidenav__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-heading);
    font-size: 2.5rem;
    line-height: 1;
    color: var(--use-brand);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.sidenav__logo {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
}

.sidenav__nav {
    flex: 1;
    padding: 1rem 0;
}

.sidenav__item {
    display: block;
    width: 100%;
    padding: 0.6rem 1.5rem;
    border: 0;
    border-left: 4px solid transparent;
    background: none;
    color: var(--use-sidenav-text);
    font: inherit;
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.sidenav__item:hover {
    background: color-mix(in oklch, var(--use-sidenav-active) 10%, transparent);
}

.sidenav__item:active {
    background: color-mix(in oklch, var(--use-sidenav-active) 20%, transparent);
}

.sidenav__item.is-active {
    border-left-color: var(--use-sidenav-active);
    background: color-mix(in oklch, var(--use-sidenav-active) 14%, transparent);
    color: var(--use-sidenav-active);
}

/* A submenu item (settings → accounts): indented and smaller under its parent. */
.sidenav__item--sub {
    padding: 0.4rem 1.5rem 0.4rem 2.75rem;
    font-size: 1rem;
}
.sidenav__item--subsub {
    padding: 0.3rem 1.5rem 0.3rem 4rem;
    font-size: 0.95rem;
}

.sidenav__theme {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid var(--use-divider);
}

.sidenav__theme-label {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--use-sidenav-muted);
}

.sidenav__theme-select,
.sidenav__theme-apply {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
    cursor: pointer;
}

/* Client area */
.client {
    flex: 1;
    min-width: 0;
    padding: 2rem;
}

/* Panels & forms */
.panel {
    max-width: 360px;
    padding: 2rem;
    background: var(--use-panel-bg);
    border-top: 4px solid var(--use-panel-accent);
    box-shadow: 0 2px 8px color-mix(in oklch, var(--use-text) 12%, transparent);
}

.panel__title {
    font-size: 2rem;
    margin-bottom: 1.25rem;
}

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

.form__field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form__label {
    font-weight: 600;
    letter-spacing: 0.03em;
}

.form input[type="text"],
.form input[type="password"],
.form input[type="email"],
.form input[type="url"],
.form textarea,
.toolbar input[type="search"] {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    font: inherit;
    color: var(--use-text);
    background: var(--use-input-bg);
}

.form textarea { resize: vertical; }

.form__error {
    padding: 0.5rem 0.75rem;
    background: color-mix(in oklch, var(--use-msg-error) 10%, var(--use-panel-bg));
    border-left: 4px solid var(--use-msg-error);
}

.button {
    align-self: flex-start;
    padding: 0.5rem 1.5rem;
    border: 0;
    border-radius: 3px;
    background: var(--use-button-bg);
    color: var(--use-button-text);
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
}

.button:hover {
    background: color-mix(in oklch, var(--use-button-bg), black var(--hover-shade));
}

.button:active {
    background: color-mix(in oklch, var(--use-button-bg), black var(--pressed-shade));
}

/* Dashboard top-level menu */
.topmenu {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.25rem;
    margin: -2rem -2rem 2rem;
    padding: 0 2rem;
    background: var(--use-topmenu-bg);
    border-bottom: 1px solid var(--use-topmenu-border);
}

.topmenu__item {
    padding: 0.85rem 1.25rem 0.7rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    color: var(--use-topmenu-text);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
    white-space: nowrap;
}

.topmenu__item:hover {
    color: var(--use-topmenu-active);
    background: color-mix(in oklch, var(--use-topmenu-active) 8%, transparent);
}

.topmenu__item:active {
    background: color-mix(in oklch, var(--use-topmenu-active) 16%, transparent);
}

.topmenu__item.is-active {
    color: var(--use-topmenu-active);
    border-bottom-color: var(--use-topmenu-active);
}

/* Secondary buttons */
.button--secondary {
    background: var(--use-button-secondary-bg);
    color: var(--use-button-secondary-text);
    box-shadow: inset 0 0 0 1px var(--use-button-secondary-text);
}

.button--secondary:hover {
    background: color-mix(in oklch, var(--use-button-secondary-text) 8%, var(--use-button-secondary-bg));
}

.button--secondary:active {
    background: color-mix(in oklch, var(--use-button-secondary-text) 16%, var(--use-button-secondary-bg));
}

.button--link,
.button--link:hover,
.button--link:active {
    background: none;
    color: var(--use-link);
    text-decoration: underline;
}

a.button { display: inline-block; text-decoration: none; }

/* Cancel links in a form's action row get an outline like the secondary button */
.form__actions a.button--link { box-shadow: inset 0 0 0 1px var(--use-link); }
.form__actions a.button--link:hover { background: color-mix(in oklch, var(--use-link) 8%, transparent); }
.form__actions a.button--link:active { background: color-mix(in oklch, var(--use-link) 16%, transparent); }

/* Flash messages: tinted surface with a status side bar */
.messages {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

.messages__item {
    --status: var(--use-msg-info);
    padding: 0.6rem 1rem;
    margin-bottom: 0.5rem;
    background: color-mix(in oklch, var(--status) 10%, var(--use-panel-bg));
    border-left: 4px solid var(--status);
}

.messages__item--success { --status: var(--use-msg-success); }
.messages__item--warning { --status: var(--use-msg-warning); }
.messages__item--error { --status: var(--use-msg-error); }

/* List toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.toolbar__search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 520px;
}

.toolbar__search input { flex: 1; }

.toolbar__search .button { align-self: auto; }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--use-panel-bg);
    box-shadow: 0 2px 8px color-mix(in oklch, var(--use-text) 8%, transparent);
}

.table th,
.table td {
    padding: 0.6rem 1rem;
    text-align: left;
    border-bottom: 1px solid color-mix(in oklch, var(--use-divider) 45%, transparent);
}

.table th {
    background: var(--use-table-header-bg);
    color: var(--use-table-header-text);
    font-weight: 600;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--use-divider);
}

.table tbody tr:hover { background: var(--use-row-hover); }

.empty {
    padding: 2rem;
    background: var(--use-panel-bg);
    color: var(--use-text-muted);
    text-align: center;
}

.empty strong { color: var(--use-text); }

/* Wide forms */
.panel--wide { max-width: 760px; }

.form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
}

.form__field--full { grid-column: 1 / -1; }

.form__crawl {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.form__field--grow { flex: 1; }

.form__crawl .button { align-self: flex-end; }

.form__hint {
    margin: -0.5rem 0 0;
    font-size: 0.9375rem;
    color: var(--use-text-muted);
}

.form__notice {
    padding: 0.5rem 0.75rem;
    background: color-mix(in oklch, var(--use-msg-info) 10%, var(--use-panel-bg));
    border-left: 4px solid var(--use-msg-info);
}

.form__field.is-filled input,
.form__field.is-filled textarea {
    background: color-mix(in oklch, var(--use-fill-highlight) 14%, var(--use-input-bg));
    border-color: var(--use-fill-highlight);
}

.form__field-error {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--use-msg-error);
}

.form__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid color-mix(in oklch, var(--use-divider) 45%, transparent);
}

/* Section sub-menu (e.g. Payments: Search / New) */
.submenu {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.25rem;
    margin: -1rem 0 1.5rem;
    border-bottom: 1px solid color-mix(in oklch, var(--use-divider) 45%, transparent);
}

.submenu__item {
    padding: 0.4rem 1rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    color: var(--use-text-muted);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
    white-space: nowrap;
}

.submenu__item:hover { color: var(--use-topmenu-active); }

.submenu__item.is-active {
    color: var(--use-topmenu-active);
    border-bottom-color: var(--use-topmenu-active);
}

.table tfoot th {
    background: var(--use-table-header-bg);
    color: var(--use-table-header-text);
    border-top: 1px solid var(--use-divider);
}

.apply-input {
    width: 8rem;
    padding: 0.3rem 0.45rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
    text-align: right;
}

.form select {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
}

.form input[type="date"],
.form input[type="number"]:not(.apply-input) {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
}

.filters__side {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filters__side .filters__count { padding-top: 0; }

.form__pair {
    display: flex;
    gap: 0.75rem;
}

.form__field--qty { flex: 0 0 6rem; }

.panel + .panel, .messages + .panel { margin-top: 1.25rem; }

.invoice-scope { margin-top: 0.5rem; }

/* a one-field form beside its button (Pricing: the base package's price) */
.form--inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.inline-amount {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.inline-amount input {
    width: 6rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
    text-align: right;
}

.charges .button--link { padding: 0.25rem 0.4rem; }

.charges + .form__hint,
.empty + .form__hint { margin: 0.6rem 0 0; }

.panel > .invoice__section:first-child { margin-top: 0; }

.is-inactive td { color: var(--use-text-muted); }

.toggle {
    min-width: 5.5rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--use-input-border);
    border-radius: 999px;
    background: var(--use-input-bg);
    color: var(--use-text-muted);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.toggle.is-on {
    border-color: var(--use-msg-success);
    background: color-mix(in oklch, var(--use-msg-success) 14%, var(--use-input-bg));
    color: var(--use-msg-success);
}

.row-actions { display: flex; gap: 0.5rem; align-items: center; white-space: nowrap; }

.form__check { flex-direction: row; align-items: center; gap: 0.5rem; }

.section-link { margin-left: 0.75rem; font-family: var(--font-body); font-size: 1rem; }

.standing-date { flex-direction: row; align-items: center; gap: 0.5rem; }

.standing-date input {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
}

.charge-total {
    padding: 0.5rem 0;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.button[disabled] { opacity: 0.5; cursor: not-allowed; }

.invoice__totals--form {
    align-self: flex-end;
    min-width: 260px;
    margin-left: auto;
}

/* Summary tiles */
.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    padding: 0.75rem 1rem;
    background: var(--use-panel-bg);
    border-top: 3px solid var(--use-panel-accent);
    box-shadow: 0 2px 8px color-mix(in oklch, var(--use-text) 8%, transparent);
}

.stat__label {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--use-text-muted);
}

.stat__value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-variant-numeric: tabular-nums;
}

/* Filters, badges, numbers, pagination */
.filters select {
    padding: 0.45rem 0.5rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
}

.filters { align-items: flex-start; }

.filters__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.filters__search { flex: 1 1 220px; min-width: 180px; }

.filters input[type="date"] {
    padding: 0.45rem 0.5rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
}

.filters .button { align-self: auto; }

.daterange {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.daterange__step {
    padding: 0.35rem 0.75rem;
    font-size: 1.25rem;
    line-height: 1;
}

.daterange__step--day { font-size: 0.95rem; }

.daterange__sep { color: var(--use-text-muted); }

.filters__count { padding-top: 0.5rem; white-space: nowrap; }

.filters__count { color: var(--use-text-muted); }

.badge {
    display: inline-block;
    padding: 0 0.4rem;
    border-radius: 2px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--use-badge);
    background: color-mix(in oklch, var(--use-badge) 14%, var(--use-panel-bg));
    vertical-align: 0.1em;
}

.badge--muted {
    color: var(--use-text-muted);
    background: color-mix(in oklch, var(--use-text-muted) 12%, var(--use-panel-bg));
}

.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

.is-voided td { color: var(--use-text-muted); text-decoration: line-through; }

.is-voided td .badge { text-decoration: none; }

.pagination {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem 0;
    color: var(--use-text-muted);
}

/* Invoice detail */
.invoice { max-width: 980px; }

.invoice__header {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.invoice__meta { margin: 0.25rem 0; color: var(--use-text-muted); }

.invoice__totals {
    display: grid;
    grid-template-columns: auto auto;
    gap: 0.2rem 1.5rem;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.invoice__totals dd { margin: 0; text-align: right; }

.invoice__totals .invoice__total {
    font-weight: 700;
    padding-top: 0.2rem;
    border-top: 1px solid color-mix(in oklch, var(--use-divider) 45%, transparent);
}

.invoice__section {
    margin: 1.5rem 0 0.6rem;
    font-size: 1.35rem;
}

/* RAD incidentals: the shared rate and markup above a rule, each kind (Claude calls, text messages) indented below. */
.rad-incidentals__rule {
    margin: 1rem 0 0;
    border: 0;
    border-top: 1px solid var(--use-divider);
}

.rad-incidentals__kind { margin-left: 1.75rem; }

.rad-incidentals__kind h3 {
    margin: 1rem 0 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--use-divider);  /* from the indent to the section's right edge, like the rule above */
}

.rad-incidentals__minimum { max-width: 16rem; }

/* Theme editor */
.editor { max-width: 1200px; }

.editor__header { margin-bottom: 1.25rem; }

.editor__header .form__hint { margin: 0; max-width: 75ch; }

.editor__group-title {
    margin: 1.5rem 0 0.75rem;
    font-size: 1.5rem;
}

.editor__colors {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    align-items: start;
}

.editor__color {
    background: var(--use-panel-bg);
    box-shadow: 0 2px 8px color-mix(in oklch, var(--use-text) 10%, transparent);
}

.editor__swatch {
    height: 64px;
    display: flex;
    align-items: flex-end;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid color-mix(in oklch, black 12%, transparent);
}

.editor__swatch-label {
    padding: 0.1rem 0.5rem;
    background: white;
    color: #222;
    font-weight: 600;
    letter-spacing: 0.05em;
    border-radius: 2px;
}

.editor__color-meta {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid color-mix(in oklch, var(--use-divider) 45%, transparent);
}

.editor__color-meta code { display: block; font-size: 0.9375rem; color: var(--use-text); }

.editor__color-meta p {
    margin: 0.2rem 0 0;
    font-size: 0.9375rem;
    color: var(--use-text-muted);
}

.editor__uses {
    list-style: none;
    margin: 0;
    padding: 0;
}

.editor__use {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.9rem;
    border-bottom: 1px solid color-mix(in oklch, var(--use-divider) 30%, transparent);
    line-height: 1.2;
}

.editor__use:last-child { border-bottom: 0; }

.editor__use--empty { color: var(--use-text-muted); font-style: italic; }

.editor__use-group {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--use-text-muted);
}

.editor__use select {
    flex: 0 0 auto;
    max-width: 11rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
}

.editor__changed {
    font-size: 0.8125rem;
    font-style: normal;
    font-weight: 600;
    padding: 0 0.35rem;
    border-radius: 2px;
    color: var(--use-badge);
    background: color-mix(in oklch, var(--use-badge) 14%, var(--use-panel-bg));
}

.editor__unsaved { font-weight: 600; color: var(--use-msg-warning); }

@media (max-width: 720px) {
    .form__grid { grid-template-columns: 1fr; }
    .form__crawl, .toolbar { flex-direction: column; align-items: stretch; }
}

.colligo-report__title { margin: 1rem 0 0.4rem; font-size: 1.05rem; }
.colligo-report__file { margin: 1rem 0; }
.colligo-report__file > summary { cursor: pointer; font-weight: 600; margin-bottom: 0.4rem; }
.colligo-report .table { margin-bottom: 0.5rem; }

.collapsible__summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 0.5rem; }
.collapsible__summary::-webkit-details-marker { display: none; }
.collapsible__summary::before {
    content: "▸"; display: inline-block; width: 1em; color: var(--use-text-muted);
    transition: transform 0.15s ease; transform-origin: 40% 50%;
}
.collapsible[open] > .collapsible__summary::before { transform: rotate(90deg); }
.collapsible__summary .invoice__section { margin: 0; }
.collapsible[open] > .collapsible__summary { margin-bottom: 0.6rem; }
.collapsible__summary:focus-visible { outline: 2px solid var(--use-focus-ring); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { .collapsible__summary::before { transition: none; } }

/* Wide panels never let a table bleed past their border: tighten charge tables, scroll as a last resort. */
.panel--wide { overflow-x: auto; }
.charges .num, .charges .nowrap { white-space: nowrap; }
.charges td:last-child { white-space: nowrap; }

/* Pages with wide tables (New invoice): the panel grows with the viewport instead of squeezing them. */
.panel--fluid { max-width: 1280px; }

.invoice-toolbar { max-width: 760px; }

.apply-search { margin-bottom: 0.5rem; }

/* Payables sub-navigation (Expenses · Payees · Types · Accounts · Cost units). */
.subnav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--use-divider); }
.subnav__item { padding: 0.35rem 0; color: var(--use-text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav__item:hover { color: var(--use-text); }
.subnav__item.is-active { color: var(--use-link); border-bottom-color: var(--use-link); font-weight: 600; }
.subnav[hidden] { display: none; }
button.subnav__item { background: none; border-top: 0; border-left: 0; border-right: 0; font: inherit; cursor: pointer; }
.filters__narrow { width: 9rem; }
.filters__tiny { width: 5.5rem; }
.expense-groups { margin: 0 0 1.25rem; }
.expense-groups__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; align-items: start; }
.expenses-table td { vertical-align: top; }
/* Created today: the id column a fifth wider than its content alone would make it. */
.created-today th:first-child { width: 9.5em; }
.form__field-inner { display: flex; flex-direction: column; gap: 0.35rem; }
.new-type-description { margin-top: 0.35rem; }
/* Amount and interest keep the form's columns; the USD -> CAD helper takes the next two
   (beside them when four columns fit, on its own row otherwise, full width in one column). */
#expense-form { container-type: inline-size; }
.amount-row { display: grid; grid-template-columns: subgrid; gap: inherit; align-items: start; }
.usd-helper { grid-column: span 2; min-width: 0; margin: 0; border: 1px dashed var(--use-divider); border-radius: 4px; padding: 0.35rem 0.8rem 0.6rem; }
@container (max-width: 31.24rem) { .usd-helper { grid-column: 1 / -1; } }
.usd-helper__row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; }
.usd-helper__row input { width: 7rem; margin-left: 0.35rem; }
.usd-helper__source { margin: 0.6rem 0 0; }  /* below the boxes, not pulled up like other hints */
.receipt-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1rem; }
.receipt-name input { flex: 1 1 22rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.reference-tables { margin-top: 1.5rem; }

/* "Create this payee/type" sits a little below its box. */
.form__field-inner + .form__check { margin-top: 0.5rem; }

/* CCA / T2125 reference tables: side by side when there's room, stacked otherwise. */
.reference-tables__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 1rem; align-items: start; }
.reference-tables__grid > *, .expense-groups__grid > * { min-width: 0; }
.reference-table th, .reference-table td { padding: 0.4rem 0.7rem; vertical-align: top; }
.reference-tables > .form__hint { margin: 0 0 0.6rem; }
.reference-table tr[data-pick-for] { cursor: pointer; }
.reference-table tr[data-pick-for]:hover td { background: color-mix(in oklch, var(--use-link) 8%, transparent); }

/* CCA class / T2125 line: a known code narrows the box, its description takes the rest of the width. */
.code-field__row { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.code-field__row input { flex: 1 1 auto; min-width: 0; width: 100%; }
.code-field.has-description .code-field__row input { flex: 0 0 5.5rem; width: 5.5rem; }
.code-field__description {
    flex: 1 1 0; min-width: 0; font-size: 0.875rem; line-height: 1.25; color: var(--use-text-muted);
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.code-field:not(.has-description) .code-field__description { display: none; }

/* Expense form fields flow into as many columns as the width allows. */
.expense-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }

/* Public promotional page at / (no sidenav): product cards with calls to action, Log in top right. */
.promo { display: flex; flex-direction: column; min-height: 100vh; }
.promo__bar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 3rem);
    background: var(--use-sidenav-bg);
    border-bottom: 3px solid var(--use-sidenav-active);
}
.promo__brand {
    display: flex; align-items: center; gap: 0.6rem;
    font-family: var(--font-heading); font-size: 2rem; line-height: 1;
    color: var(--use-brand); text-decoration: none;
}
.promo__logo { width: 2.5rem; height: 2.5rem; }
.promo__main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem); }
.promo__hero { max-width: 44rem; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.promo__title { font-size: clamp(2.25rem, 5vw, 3.5rem); line-height: 1.1; margin-bottom: 1rem; }
.promo__lead { margin: 0; font-size: 1.3rem; color: var(--use-text-muted); }
.promo__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1.25rem; }
.promo__card {
    display: flex; flex-direction: column; gap: 0.75rem;
    padding: 1.5rem;
    background: var(--use-panel-bg);
    border-top: 4px solid var(--use-panel-accent);
    box-shadow: 0 2px 8px color-mix(in oklch, var(--use-text) 12%, transparent);
}
.promo__card p { margin: 0; }
.promo__name { font-size: 2rem; text-align: center; }
.promo__tagline { font-weight: 700; color: var(--use-heading); }
.promo__cta { margin-top: auto; align-self: flex-start; }
.promo__footer { padding: 1.25rem clamp(1rem, 4vw, 3rem); color: var(--use-text-muted); border-top: 1px solid var(--use-divider); }

/* Service type picker (search + dropdown + "new" dialog). */
.type-picker { display: flex; flex-direction: column; gap: 0.4rem; }
.type-picker__row { display: flex; gap: 0.5rem; align-items: stretch; }
.type-picker__search { flex: 1; min-width: 0; }
.type-picker__dialog, .note-dialog {
    width: min(32rem, calc(100vw - 2rem));
    padding: 1.5rem;
    color: var(--use-text);
    background: var(--use-panel-bg);
    border: 0;
    border-top: 4px solid var(--use-panel-accent);
    box-shadow: 0 4px 24px color-mix(in oklch, var(--use-text) 25%, transparent);
}
.type-picker__dialog::backdrop, .note-dialog::backdrop { background: color-mix(in oklch, var(--use-text) 35%, transparent); }
.type-picker__dialog .form__grid { margin-top: 1rem; }
@media (max-width: 600px) {
    .type-picker__row { flex-direction: column; }
}

/* Review scanned expenses: the email or attachment beside the proposed expense. */
.scan-review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.scan-review__source { position: sticky; top: 4.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.scan-review__frame {
    width: 100%;
    height: calc(100vh - 14rem);
    min-height: 420px;
    border: 1px solid var(--use-divider);
    background: #fff;
}
.scan-review__tabs { flex-wrap: wrap; }
.subnav__item.is-disabled { opacity: 0.5; cursor: default; }
.scan-review__notes {
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--use-sidenav-active);
    background: color-mix(in oklch, var(--use-sidenav-active) 8%, transparent);
}
@media (max-width: 1100px) {
    .scan-review { grid-template-columns: 1fr; }
    .scan-review__source { position: static; }
}
.inline-form { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0; }

/* Possible duplicates on the scanned-expense review page. */
.duplicates { margin: 0.75rem 0; }
.duplicates--exact, .duplicates:not(.duplicates--none) {
    padding: 0.6rem 0.75rem;
    border-left: 3px solid var(--use-msg-error);
    background: color-mix(in oklch, var(--use-msg-error) 8%, transparent);
}
.duplicates:not(.duplicates--exact):not(.duplicates--none) { border-left-color: var(--use-sidenav-active); background: color-mix(in oklch, var(--use-sidenav-active) 8%, transparent); }
.duplicates__title { margin: 0 0 0.4rem; font-size: 1.05rem; }
.duplicates__table { font-size: 0.85rem; display: block; overflow-x: auto; }

/* Documents kept with an expense (Edit expense). */
.expense-documents { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.expense-documents__frame { height: 70vh; }
.expense-documents__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.expense-documents__list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.expense-documents__list .form__hint { margin: 0; }
.doc-mark { font-size: 0.85em; }

/* Expense type chart (cumulative spending) and its launcher beside each type in the list. */
.chart-link { margin-left: 0.35rem; text-decoration: none; font-size: 0.9em; opacity: 0.55; }
.chart-link:hover, .chart-link:focus-visible { opacity: 1; }
.type-chart__title { margin: 0 0 1rem; }
.type-chart { position: relative; margin: 0 0 1.5rem; padding: 0.75rem; background: var(--use-panel-bg); }
.type-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.type-chart [hidden] { display: none; }
.type-chart__grid { stroke: var(--use-divider); stroke-width: 1; }
.type-chart__axis { stroke: var(--use-text-muted); stroke-width: 1; }
.type-chart__tick { fill: var(--use-text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.type-chart__line { fill: none; stroke: var(--use-link); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.type-chart__bar { fill: var(--use-link); }
.type-chart__crosshair { stroke: var(--use-text-muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.type-chart__dot { fill: var(--use-link); stroke: var(--use-panel-bg); stroke-width: 2; pointer-events: none; }
.type-chart__hit { fill: transparent; cursor: crosshair; }
.type-chart__tooltip {
    position: absolute;
    margin: 0.75rem;
    padding: 0.4rem 0.6rem;
    pointer-events: none;
    white-space: nowrap;
    font-size: 0.9rem;
    color: var(--use-text);
    background: var(--use-page-bg);
    border: 1px solid var(--use-divider);
    box-shadow: 0 2px 8px color-mix(in oklch, var(--use-text) 12%, transparent);
}
.type-chart__tooltip-label { color: var(--use-text-muted); }
.type-chart__tooltip-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Highlighter marks, as if drawn on a paper statement: amber = suggested or not reconciled, green = matched */
:root { --highlight-amber: rgb(255 191 0 / 0.32); --highlight-green: rgb(70 200 90 / 0.28); }
.hl-amber, tr.hl-amber > td { background-color: var(--highlight-amber); }
.hl-green, tr.hl-green > td { background-color: var(--highlight-green); }
span.hl-amber, span.hl-green { padding: 0 0.25rem; border-radius: 2px; }
tr.is-target > td { box-shadow: inset 0 2px 0 var(--use-link), inset 0 -2px 0 var(--use-link); }

.button--small { padding: 0.2rem 0.75rem; font-size: 0.9rem; }
.button--green, .button--green:hover { background: rgb(46 160 67); color: #fff; }
.button--green:hover { background: rgb(36 135 55); }
.button--amber { background: rgb(240 170 0); color: #2a1d00; }
.button--amber:hover { background: rgb(215 150 0); }
.button--danger { background: rgb(190 40 40); color: #fff; }
.button--danger:hover { background: rgb(160 30 30); }

.stat__value--small { font-size: 1.1rem; }
.statement__title { margin-bottom: 0.5rem; }
.statement__status { margin: 0.5rem 0 1rem; }
.statement-unread { margin-bottom: 1.5rem; }
.statement-replacement { margin: 0 0 1.5rem; padding: 0.75rem 1rem; background: var(--highlight-amber); border-radius: 3px; }
.statement-lines td { vertical-align: top; }
.statement-lines form { margin: 0; }
.statement-manage { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-top: 2rem; }
.statement-manage__replace { display: flex; align-items: flex-end; gap: 1rem; max-width: 46rem; }
.statement-manage__delete summary { list-style: none; cursor: pointer; }
.statement-manage__delete summary::-webkit-details-marker { display: none; }
.statement-opener { margin-left: 0.25rem; text-decoration: none; }

/* gibbs: follow-ups and the activity timeline */
.follow-ups { list-style: none; margin: 0 0 1rem; padding: 0; }
.follow-up { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
    padding: 0.5rem 0.75rem; border-left: 3px solid var(--use-divider); border-bottom: 1px solid var(--use-divider); }
.follow-up.is-today { border-left-color: var(--use-msg-warning); }
.follow-up.is-overdue { border-left-color: var(--use-msg-error); }
.follow-up.is-done { color: var(--use-text-muted); }
.follow-up__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.follow-up__done { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.follow-up__done input[type="text"] { min-width: 12rem; }
td.is-overdue { color: var(--use-msg-error); font-weight: 600; }
.timeline { list-style: none; margin: 1rem 0 0; padding: 0; }
.timeline__item { padding: 0.75rem 0 0.75rem 1rem; border-left: 2px solid var(--use-divider); }
.timeline__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin-bottom: 0.25rem; }
.timeline__delete { margin-left: auto; }
.timeline__body { overflow-wrap: anywhere; }
.email-entry__text { max-height: 24rem; overflow: auto; margin-top: 0.5rem; padding: 0.5rem 0.75rem;
    background: var(--use-input-bg); border: 1px solid var(--use-divider); overflow-wrap: anywhere; }

/* projects: status colours (from the theme's message colours), progress bars */
.badge.tone-info { --use-badge: var(--use-msg-info); }
.badge.tone-success { --use-badge: var(--use-msg-success); }
.badge.tone-warning { --use-badge: var(--use-msg-warning); }
.badge.tone-error { --use-badge: var(--use-msg-error); }
.badge.tone-neutral { --use-badge: var(--use-text-muted); }
.progress { display: inline-block; width: 6rem; height: 0.5rem; vertical-align: middle; border-radius: 2px;
    background: color-mix(in oklch, var(--use-divider) 60%, transparent); overflow: hidden; }
.progress__bar { display: block; height: 100%; background: var(--use-msg-success); }
.tasks tr.is-done td { color: var(--use-text-muted); }
.project__description { margin: 0 0 1rem; max-width: 60rem; }
.statuses td { vertical-align: top; }
.task__delete { margin-left: auto; color: var(--use-msg-error); }
span.is-overdue { color: var(--use-msg-error); font-weight: 600; }

/* projects: the kanban board (kanban.js). Only the board scrolls sideways, never the page. */
.project__views { margin: 0 0 1rem; }
.board { display: flex; gap: 0.75rem; align-items: flex-start; overflow-x: auto; padding-bottom: 0.75rem; margin-bottom: 0.5rem; }
.board__column { flex: 0 0 17rem; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.6rem;
    background: color-mix(in oklch, var(--use-divider) 22%, var(--use-page-bg)); border-radius: 4px; }
.board__head { display: flex; align-items: center; justify-content: space-between; font-size: 1.05rem; }
.board__count { color: var(--use-text-muted); font-family: var(--font-body); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.board__earlier { font-size: 0.875rem; }
.board__cards { list-style: none; margin: 0; padding: 0; min-height: 2.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.card { padding: 0.5rem 0.6rem; background: var(--use-panel-bg); border-left: 3px solid var(--use-divider); border-radius: 3px;
    box-shadow: 0 1px 3px color-mix(in oklch, var(--use-text) 10%, transparent); cursor: grab; }
.card.is-today { border-left-color: var(--use-msg-warning); }
.card.is-overdue { border-left-color: var(--use-msg-error); }
.card.is-overdue .card__due { color: var(--use-msg-error); font-weight: 600; }
.card.is-done { border-left-color: var(--use-msg-success); }
.card.is-done .card__title { color: var(--use-text-muted); }
.card.is-dragging { opacity: 0.4; }
.card.is-saving { opacity: 0.7; }
.card.is-failed { outline: 2px solid var(--use-msg-error); }
.card__title { display: block; overflow-wrap: anywhere; text-decoration: none; color: var(--use-text); }
.card__title:hover { text-decoration: underline; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.6rem; margin-top: 0.25rem; font-size: 0.875rem; }
.card__meta:empty { display: none; }
.card__move { margin-top: 0.35rem; }
.card__move select { max-width: 100%; padding: 0.15rem 0.3rem; font: inherit; font-size: 0.8125rem; color: var(--use-text-muted);
    background: var(--use-input-bg); border: 1px solid var(--use-input-border); border-radius: 3px; }
.board__add input { width: 100%; padding: 0.4rem 0.5rem; font: inherit; color: var(--use-text); background: transparent;
    border: 1px dashed var(--use-input-border); border-radius: 3px; }
.board__add input:focus { background: var(--use-input-bg); border-style: solid; }
.project__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* projects: subtasks and the task timeline */
.task__parent { font-size: 0.875rem; }
.card .task__parent { display: block; }
.subtask-add { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
.subtask-add input[type="text"] { flex: 1 1 14rem; padding: 0.45rem 0.5rem; font: inherit; color: var(--use-text);
    background: var(--use-input-bg); border: 1px solid var(--use-input-border); border-radius: 3px; }
.timeline__item.is-change .timeline__body { color: var(--use-text-muted); font-size: 0.9375rem; }

/* projects: labels, the timeline (gantt) view */
.chip { display: inline-block; padding: 0 0.45rem; border: 1px solid var(--chip, var(--use-text-muted)); border-radius: 999px;
    color: var(--use-text); font-size: 0.8125rem; line-height: 1.5; white-space: nowrap;
    background: color-mix(in oklch, var(--chip, var(--use-text-muted)) 14%, transparent); }
.chip.tone-info { --chip: var(--use-msg-info); }
.chip.tone-success { --chip: var(--use-msg-success); }
.chip.tone-warning { --chip: var(--use-msg-warning); }
.chip.tone-error { --chip: var(--use-msg-error); }
.task__labels { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; border: 0; margin: 0; padding: 0; }
.task__labels legend { width: 100%; padding: 0; margin-bottom: 0.25rem; }
.task__labels .form__check { display: inline-flex; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gantt { overflow-x: auto; margin-bottom: 0.5rem; }
.gantt__row { display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(32rem, 1fr); align-items: center;
    border-bottom: 1px solid color-mix(in oklch, var(--use-divider) 50%, transparent); }
.gantt__row--head { font-size: 0.8125rem; color: var(--use-text-muted); border-bottom-color: var(--use-divider); }
.gantt__name { padding: 0.35rem 0.75rem 0.35rem 0; overflow-wrap: anywhere; }
.gantt__row.is-done .gantt__name a { color: var(--use-text-muted); }
.gantt__row.is-overdue .gantt__name a { color: var(--use-msg-error); }
.gantt__track { position: relative; align-self: stretch; min-height: 2rem; }
.gantt__tick { position: absolute; bottom: 0.25rem; padding-left: 0.25rem; white-space: nowrap; border-left: 1px solid var(--use-divider); }
.gantt__line { position: absolute; top: 0; bottom: 0; border-left: 1px solid color-mix(in oklch, var(--use-divider) 45%, transparent); }
.gantt__today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--use-msg-error); z-index: 1; }
.gantt__bar { position: absolute; top: 50%; height: 0.9rem; min-width: 4px; transform: translateY(-50%); border-radius: 3px;
    background: var(--bar, var(--use-text-muted)); z-index: 2; }
.gantt__bar.tone-info { --bar: var(--use-msg-info); }
.gantt__bar.tone-success { --bar: var(--use-msg-success); }
.gantt__bar.tone-warning { --bar: var(--use-msg-warning); }
.gantt__bar.tone-error { --bar: var(--use-msg-error); }
.gantt__row.is-done .gantt__bar { opacity: 0.5; }
.subtask-add select { flex: 1 1 14rem; max-width: 100%; padding: 0.45rem 0.5rem; font: inherit; color: var(--use-text);
    background: var(--use-input-bg); border: 1px solid var(--use-input-border); border-radius: 3px; }
.is-unviewed td { font-weight: 600; }
.message__body { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; margin: 0; }
.message__meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0 0 1rem; }
.message__meta dt { color: var(--use-text-muted); }
.message__meta dd { margin: 0; overflow-wrap: anywhere; }

/* File drop zones (dropzone.js): the file input's label, outlined while files are dragged over the page. */
.dropzone { border: 2px dashed var(--use-divider); border-radius: 6px; padding: 1rem; transition: border-color 0.15s, background-color 0.15s; }
.dropzone.is-dragover { border-color: var(--use-link); background: color-mix(in srgb, var(--use-link) 8%, transparent); }
.dropzone__hint { color: var(--use-text-muted); }
.dropzone__files { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.dropzone__files:empty { display: none; }

/* Copy buttons (copy_text.js), e.g. the expense list's id: a small icon, a tick once copied. */
.copy-id { background: none; border: 0; padding: 0 0.3rem 0 0; color: var(--use-text-muted); cursor: pointer; vertical-align: -0.1em; }
.copy-id:hover { color: var(--use-link); }
.copy-id.is-copied { color: var(--use-msg-success); }
.copy-id.is-copied svg { display: none; }
.copy-id.is-copied::before { content: '✓'; }

/* Notes on a project's messages (note_dialog.js): the first line in the list, the whole note in a dialog. */
.message-note { min-width: 10rem; }
.message-note__text { background: none; border: 0; padding: 0; font: inherit; color: var(--use-link); text-align: left; cursor: pointer; text-decoration: underline dotted; }
.note-dialog textarea { width: 100%; font: inherit; }

/* Receivables list: an invoice's outstanding amount opens the New payment dialog. */
.link-button {
    padding: 0;
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    text-decoration: underline dotted;
    text-underline-offset: 0.2em;
    cursor: pointer;
}
.link-button:hover, .link-button:focus-visible { color: var(--use-link, inherit); text-decoration-style: solid; }
.pay-dialog__invoice { color: var(--use-text-muted); font-weight: normal; }
.pay-dialog input[readonly] { color: var(--use-text-muted); background: transparent; }
/* The issue-date button sits in its own row, centred over the date input (the third column). */
.pay-dialog__date { display: grid; grid-template-columns: repeat(5, auto); justify-content: start; align-items: center; row-gap: 0.5rem; }
.pay-dialog__date > * { grid-row: 2; }
.pay-dialog__date > .pay-dialog__issued { grid-row: 1; grid-column: 3; justify-self: center; }
.pay-dialog__date > .pay-dialog__issued[hidden] { display: none; }

/* Date boxes (core/js/date_input.js): a text box you can type into, a calendar button inside its right edge,
   and the browser's date picker, invisible, anchored under it. */
.date-text { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.form__field > .date-text, .standing-date > .date-text { display: flex; }
.standing-date > .date-text { flex: 1; }
.date-text input.date-text__input {
    flex: 1;
    width: 10.5em;
    min-width: 0;
    padding: 0.5rem 2.2rem 0.5rem 0.65rem;
    border: 1px solid var(--use-input-border);
    border-radius: 3px;
    background: var(--use-input-bg);
    color: var(--use-text);
    font: inherit;
    font-variant-numeric: tabular-nums;
}
.date-text input.date-text__input:invalid { border-color: var(--use-msg-error); }
.date-text__button {
    position: absolute;
    right: 0.35rem;
    display: inline-flex;
    padding: 0.2rem;
    color: var(--use-text);
    background: none;
    border: 0;
    cursor: pointer;
}
.date-text__button:disabled { opacity: 0.4; cursor: default; }
.date-text__picker {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* Receivables list: Edit payments dialog (an invoice's paid amount opens it). */
.payments-dialog { width: min(40rem, calc(100vw - 2rem)); }
.payments-dialog__table { margin: 0.75rem 0; }
.payments-dialog__table td, .payments-dialog__table th { vertical-align: middle; }
.payments-dialog .payments-dialog__amount { width: 8em; text-align: right; }
.payments-dialog__new-total th { border-top: 2px solid var(--use-divider); }
.payments-dialog input.is-invalid { border-color: var(--use-msg-error); }
.payments-dialog .is-over { color: var(--use-msg-error); }
.payment-delete { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--use-divider); }

/* Rental: new propane reading (form beside the phone QR code), reading photo, and the phone page. */
.reading-new { display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-start; }
.reading-new__form { flex: 1 1 22rem; }
.reading-new__qr { flex: 0 0 16rem; padding: 1rem; border: 1px solid var(--use-divider); border-radius: 8px; }
.reading-new__code svg { display: block; width: 100%; height: auto; background: #fff; padding: 8px; border-radius: 4px; }
.reading-new__status { font-weight: 600; }
.reading-photo { display: block; max-width: min(100%, 28rem); max-height: 24rem; margin: 0.5rem 0 1rem; border-radius: 6px; }
.phone { max-width: 32rem; margin: 0 auto; padding: 1.25rem; }
.phone__where { opacity: 0.75; margin-top: -0.25rem; }
.phone__percent { font-size: 2.5rem; font-weight: 700; margin: 0.5rem 0; }
.phone .form__field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.phone input[type=file], .phone input[type=number] { font-size: 1.1rem; width: 100%; }
.phone__send { width: 100%; font-size: 1.15rem; padding: 0.9rem; }

/* Rental inventory: thumbnails, photos on an item, the phone page's last-added card and list. */
.inventory-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; display: block; }
.inventory-photos { display: flex; flex-wrap: wrap; gap: 1rem; }
.inventory-photos figure { margin: 0; }
.scan__video { display: block; width: 100%; max-width: 480px; aspect-ratio: 4 / 3; object-fit: cover; background: #000; border-radius: 6px; margin-bottom: .75rem; }
/* A package's photo button and its 6-digit ID, sized for writing it on the box from a phone. */
.package-photo { border: 1px solid var(--use-divider); border-radius: 8px; padding: 1rem; margin-bottom: 1.25rem; }
.package-photo.is-new { border-width: 3px; border-color: var(--use-panel-accent); }
.package-photo__label { margin: 0; font-weight: 600; }
.package-photo__code { margin: .25rem 0 1rem; font-size: clamp(2.5rem, 14vw, 4.5rem); font-weight: 700; letter-spacing: .18em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.package-photo__take { display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; padding: .75rem 1.5rem; font-size: 1.1rem; cursor: pointer; }
.package-photo__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.package-photo .inventory-photos { margin-top: 1rem; }
.package-find { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin: 0 0 .25rem; }
.package-find__field { display: flex; flex-direction: column; gap: .3rem; flex: 0 1 16rem; min-width: 0; }
.package-find__id { width: 100%; box-sizing: border-box; padding: .5rem .75rem; font-size: 1.6rem; letter-spacing: .15em; font-variant-numeric: tabular-nums; }
.package-find .button { min-height: 3rem; }
/* A box found by its ID: the latest photo across the whole width (edge to edge on a phone). */
.package-box__photo-link { display: block; margin: 0 0 1.25rem; }
.package-box__photo { display: block; width: 100%; height: auto; max-height: 85vh; object-fit: contain; background: #000; }
@media (max-width: 900px) {
    .package-box__photo-link { margin: -0.5rem -1rem 1rem; }
    .package-box__photo { max-height: none; }
}
.phone__added { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.75rem; margin-bottom: 1rem; border: 1px solid var(--use-divider); border-radius: 8px; }
.phone__list { padding-left: 1.1rem; }
.phone__list li { margin-bottom: 0.4rem; }
.phone select, .phone input[type=text] { font-size: 1.1rem; width: 100%; }
.reading-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 4px; display: block; }

/* Rental maintenance: tick-to-complete checkboxes on the schedule and the tenants' page. */
.maint-done input[type=checkbox] { width: 1.2rem; height: 1.2rem; }
.tasklist { list-style: none; padding: 0; }
.tasklist__item { padding: 0.75rem 0; border-bottom: 1px solid var(--use-divider); }
.tasklist__check { display: flex; gap: 0.75rem; align-items: flex-start; cursor: pointer; }
.tasklist__check input[type=checkbox] { width: 1.6rem; height: 1.6rem; flex: none; margin-top: 0.1rem; }
.badge--danger { background: var(--use-msg-error); color: #fff; }
tr.is-muted td { opacity: 0.55; }

/* The maintenance confirm page (link in a reminder): the "done" message. */
.phone__ok { padding: 0.75rem 1rem; border-radius: 6px; background: var(--use-row-hover); }

/* Receivables: the send form's list of addresses. */
.bill-to { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.2rem 0; }

/* Rental property images: a grid of thumbnails. */
.image-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.image-grid__img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.image-grid__caption { display: flex; flex-direction: column; gap: 0.15rem; padding-top: 0.4rem; }

/* Narrow screens: menus wrap onto more rows, with tighter spacing. */
@media (max-width: 900px) {
    .topmenu__item { padding: 0.6rem 0.75rem 0.5rem; font-size: 1rem; }
    .submenu__item { padding: 0.35rem 0.6rem; }
}

/* Narrow screens: the side nav becomes a drawer, opened from the menu button in a bar across the top. */
.mobilebar, .drawer__backdrop { display: none; }
@media (max-width: 900px) {
    .layout { display: block; }
    .mobilebar {
        position: sticky; top: 0; z-index: 20;
        display: flex; align-items: center; gap: 0.75rem;
        height: 3.25rem; padding: 0 1rem;
        background: var(--use-sidenav-bg); color: var(--use-brand);
        border-bottom: 3px solid var(--use-sidenav-active);
    }
    .mobilebar__menu {
        display: flex; flex-direction: column; justify-content: center; gap: 5px;
        width: 2.5rem; height: 2.5rem; padding: 0 0.45rem; cursor: pointer; border-radius: 3px;
    }
    .mobilebar__menu span { display: block; height: 3px; border-radius: 2px; background: var(--use-sidenav-text); }
    .mobilebar__menu:hover { background: color-mix(in oklch, var(--use-sidenav-active) 10%, transparent); }
    .mobilebar__menu:focus-visible { outline: 2px solid var(--use-focus-ring); }
    .mobilebar__brand {
        display: flex; align-items: center; gap: 0.5rem;
        font-family: var(--font-heading); font-size: 1.6rem; line-height: 1; letter-spacing: 0.02em;
    }
    .sidenav {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
        width: min(var(--sidenav-width), 85vw);
        transform: translateX(-100%); transition: transform 0.2s ease, visibility 0s 0.2s;
        box-shadow: 0 0 24px rgb(0 0 0 / 0.25);
        visibility: hidden;
    }
    .drawer__toggle:checked ~ .sidenav { transform: none; visibility: visible; transition: transform 0.2s ease; }
    .drawer__backdrop {
        position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.35);
    }
    .drawer__toggle:checked ~ .drawer__backdrop { display: block; }
    .client { padding: 1rem; }
    .topmenu { top: 3.25rem; margin: -1rem -1rem 1.5rem; padding: 0 1rem; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) { .sidenav { transition: none; } }

/* Quotes */
.quote-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0 0 1.25rem; }
.quote-facts dt { font-weight: 600; color: var(--use-text-muted); }
.quote-facts dd { margin: 0; }
.quote-lines input[name$="-description"] { width: 100%; min-width: 16rem; }
.quote-notes { white-space: normal; }
tr.is-selected td { background: color-mix(in oklch, var(--use-link) 8%, transparent); }

/* A hint right after a table gets breathing room. */
.table + .form__hint { margin-top: 0.85rem; }
tr.is-removed td { opacity: 0.45; }
.quote-lines tfoot th { text-align: right; }
.quote-lines tfoot th.num { white-space: nowrap; }
/* Steady column widths while amounts change as you type (see the totals script). */
.quote-lines [data-amount], .quote-lines tfoot th.num { font-variant-numeric: tabular-nums; min-width: 7.5rem; }
.quote-lines input[name$="-unit_price"] { width: 7.5rem; }

/* Invoice detail (user, 2026-11-17): the buttons and the header panel (number, customer, dates, totals) stick below the
   top menu; the lines, payments and the rest scroll under them in a panel joined to the header's. Not sticky on short
   or narrow screens, where it would cover most of the page. */
.invoice-sticky {
    max-width: 980px;
    margin-top: -1rem;
    padding-top: 1rem;               /* a little space below the top menu once stuck */
    background: var(--use-page-bg);  /* hides what scrolls underneath */
}
.invoice__head { padding-bottom: 1rem; border-bottom: 1px solid color-mix(in oklch, var(--use-divider) 45%, transparent); }
.invoice__head .invoice__header { margin-bottom: 0; }
.invoice__body { border-top: 0; padding-top: 0.5rem; }
@media (min-width: 901px) and (min-height: 700px) {
    .invoice-sticky { position: sticky; top: var(--topmenu-h, 0px); z-index: 5; }
    html:has(.invoice-sticky) { scroll-padding-top: calc(var(--topmenu-h, 0px) + var(--invoice-sticky-h, 0px) + 0.5rem); }
    /* The column titles of the lines, the payments applied, the payments to apply, the write-offs and the interest stick below the header too, each until its table ends; a scrolling panel would hold them, so this one doesn't
       scroll sideways (its tables fit at these widths). The rule under the titles is a shadow: a collapsed border
       stays behind when a cell sticks. */
    .invoice__body { overflow: visible; }
    .invoice__pinned-titles thead th {
        position: sticky;
        top: calc(var(--topmenu-h, 0px) + var(--invoice-sticky-h, 0px));
        z-index: 4;
        box-shadow: inset 0 -1px 0 var(--use-divider);
    }
}

.date-shift { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.date-shift .button { padding-left: 0.6rem; padding-right: 0.6rem; }
