:root {
    font-family: "Instrument Sans", system-ui, sans-serif;
    color: #172522;
    background: #f5f7f3;
    --ink: #172522;
    --muted: #536560;
    --accent: #195847;
    --line: #dce5df;
    --white: #fff;
    --success-ink: #166534;
    --success-bg: #dcfce7;
    --pending-ink: #9a3412;
    --pending-bg: #ffedd5;
    --danger-ink: #b91c1c;
    --danger-bg: #fee2e2;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #bb7400; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.04; letter-spacing: -.055em; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; letter-spacing: -.025em; }
small { display: block; margin-top: .32rem; color: var(--muted); line-height: 1.35; }
.shell { width: min(100% - 2rem, 70rem); margin-inline: auto; }
html { scroll-padding-top: calc(4rem + env(safe-area-inset-top, 0px) + 1px); }
.top {
    position: sticky;
    z-index: 20;
    top: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
    border-bottom: 1px solid var(--line);
    background: var(--white);
}
.top-inner {
    min-height: 4rem;
    display: grid;
    grid-template-columns: minmax(2.75rem, 1fr) auto minmax(2.75rem, 1fr);
    align-items: center;
    gap: .5rem;
}
.brand { grid-area: 1 / 2; display: inline-flex; align-items: center; gap: .55rem; font-weight: 750; text-decoration: none; color: var(--ink); }
.brand-icon { display: grid; place-items: center; height: 2rem; width: 2rem; border-radius: .65rem; background: #195847; color: #fff; }
.actions { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.back-link, .account-link { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; }
.back-link { grid-area: 1 / 1; border: 1px solid var(--line); border-radius: 50%; }
.account-link { grid-area: 1 / 3; justify-self: end; border-radius: .65rem; }
.back-link:hover, .account-link:hover, .account-link[aria-current] { background: #e4eee7; }
.profile { max-width: 36rem; }
.quiet { border: 0; min-height: 2.7rem; padding: .3rem .45rem; background: transparent; color: var(--accent); font-weight: 650; }
.destructive { color: var(--danger-ink); }
.quiet.destructive { display: inline-flex; align-items: center; gap: .35rem; border-radius: .55rem; }
.quiet.destructive:hover:not(:disabled) { background: var(--danger-bg); }
.quiet.destructive:disabled { opacity: .5; cursor: default; }
.bottom-nav {
    position: fixed;
    z-index: 10;
    inset: auto 0 0;
    padding: .45rem env(safe-area-inset-right, 0px) calc(.45rem + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
    border-top: 1px solid var(--line);
    background: var(--white);
}
.nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) 2.75rem repeat(2, minmax(0, 1fr)); gap: .25rem; width: min(100% - .75rem, 70rem); }
.nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 2.75rem;
    border-radius: .65rem;
    color: var(--muted);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 650;
}
.nav svg { flex: none; }
.nav a[aria-current], .nav a:hover { color: var(--accent); background: #e4eee7; }
.nav a.nav-home { color: var(--white); background: var(--accent); }
.nav a.nav-home[aria-current], .nav a.nav-home:hover { background: #103f32; }
.content { padding-block: 1.3rem 3rem; }
.with-bottom-nav { padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)); }
html:has(.with-bottom-nav) { scroll-padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px)); }
.content > * + * { margin-top: 1.1rem; }
.card { padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--white); }
.button { min-height: 2.75rem; display: inline-flex; justify-content: center; align-items: center; gap: .5rem; padding: .65rem 1rem; border: 1px solid var(--accent); border-radius: .65rem; background: var(--accent); color: #fff; font-weight: 650; text-decoration: none; text-align: center; }
.button:hover { background: #103f32; }
.secondary { border-color: #cdded3; background: #edf5ee; color: var(--accent); }
.secondary:hover { background: #dcebe0; }
.fit { justify-self: start; }
.muted { color: var(--muted); line-height: 1.5; }
.page-heading { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: end; justify-content: space-between; }
.page-heading p { margin-top: .45rem; }
.create-button-short { display: none; }
.eyebrow { display: block; color: var(--accent); letter-spacing: .12em; font-size: .72rem; font-weight: 750; margin-bottom: .55rem; }
.notice { padding: .8rem 1rem; border-radius: .7rem; background: #e3efe6; color: #214c3a; line-height: 1.5; }
.error { background: #fae8e4; color: #812e23; }
.error ul { margin: 0; padding-left: 1.2rem; }
.auth-grid { display: grid; gap: .85rem; margin-inline: auto; max-width: 56rem; }
.auth-intro { position: relative; display: grid; align-content: center; gap: .65rem; overflow: hidden; padding: 1.25rem; border-radius: 1rem; color: #fff; background: radial-gradient(ellipse at 100% 100%, #2d6e59, transparent 62%), #153d32; }
.auth-intro .eyebrow { color: #b3dfc7; }
.auth-intro p { max-width: 31ch; color: #d6e8dd; line-height: 1.5; }
.auth-card { padding: 1.2rem; }
.auth-card > * + * { margin-top: 1rem; }
.auth-card h2 { font-size: 1.65rem; }
.stack { display: grid; gap: .85rem; }
label { display: grid; gap: .35rem; align-content: start; font-size: .88rem; font-weight: 650; min-width: 0; }
[data-customer-search][hidden], [data-customer-results]:empty { display: none; }
input, select, textarea { width: 100%; min-height: 2.75rem; padding: .55rem .65rem; border: 1px solid #cbd9d0; border-radius: .55rem; background: #fff; color: var(--ink); font-size: 1rem; font-weight: 400; }
input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 100%;
}
textarea { resize: vertical; }
.forgot-link, .auth-footer { font-size: .88rem; }
.demo-form { display: grid; padding-top: 1rem; border-top: 1px solid var(--line); }
.auth-footer { text-align: center; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.metric { display: grid; gap: .45rem; color: var(--muted); text-decoration: none; font-size: .86rem; }
.metric strong { font-size: 1.8rem; color: var(--ink); }
.filters { display: grid; gap: .65rem; align-items: end; }
.filter-toggle { display: none; }
.statistics-metrics { margin-bottom: 0; }
.statistics-metrics strong { font-size: clamp(1.15rem, 3vw, 1.8rem); }
.statistics-charts { display: grid; gap: .75rem; align-items: start; }
.statistics-bars { display: grid; gap: .85rem; margin: 0; padding: 0; list-style: none; }
.statistics-bars li { display: grid; gap: .35rem; }
.statistics-bars li > div:first-child { display: flex; justify-content: space-between; gap: .65rem; }
.statistics-track { display: flex; height: .55rem; overflow: hidden; border-radius: 1rem; background: #e4eee7; }
.statistics-track span { background: var(--accent); }
.statistics-status-track { height: 1rem; }
.statistics-status-track span, .statistics-swatch { background: var(--success-ink); }
.statistics-track .statistics-pending, .statistics-swatch.statistics-pending { background: var(--pending-ink); }
.statistics-swatch { display: inline-block; width: .65rem; height: .65rem; margin-right: .4rem; border-radius: 50%; }
.statistics-legend dd { text-align: right; }
@media (min-width: 44rem) {
    .metrics.statistics-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .statistics-charts { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
@media (width < 44rem) {
    .page-heading-with-create {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: .5rem;
    }
    .create-button { padding-inline: .75rem; }
    .create-button-full { display: none; }
    .create-button-short { display: inline; }
    .filter-toggle:not([hidden]) { display: inline-flex; }
    .filter-toggle:not([hidden])[aria-expanded="false"] + .filters { display: none; }
    .filter-toggle:not([hidden])[aria-expanded="true"] + .filters { margin-top: .65rem; }
}
.records { display: grid; gap: .55rem; }
.record, .detail-line { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.record { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.record:hover, .metric:hover { border-color: #7da693; }
.record-end { text-align: right; flex: none; }
.pill { display: inline-block; padding: .25rem .55rem; border-radius: 2rem; background: #eef2f6; color: #475569; font-size: .75rem; font-weight: 650; line-height: 1.2; }
.record-end .pill { display: table; margin: .28rem 0 0 auto; }
.pill:is([data-state="accepted"], [data-state="paid"], [data-state="active"], [data-state="completed"]) { background: var(--success-bg); color: var(--success-ink); }
.pill:is([data-state="issued"], [data-state="pending"]) { background: var(--pending-bg); color: var(--pending-ink); }
.pill[data-state="sent"] { background: #dbeafe; color: #1e40af; }
.pill[data-state="rejected"] { background: var(--danger-bg); color: var(--danger-ink); }
.pill[data-state="archived"] { background: #ede9fe; color: #5b21b6; }
.arrow { color: var(--accent); }
.scroll-status, .empty { color: var(--muted); }
.editor { max-width: 54rem; }
.field-grid, .line-fields { display: grid; gap: .7rem; }
.line-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); background: #f5f8f5; border-radius: .65rem; padding: .75rem; align-items: end; }
.line-fields label:first-child { grid-column: 1 / -1; }
.detail-line { padding-block: .55rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.totals, .facts { display: grid; gap: .55rem 1rem; grid-template-columns: auto 1fr; margin: .25rem 0; }
.totals { justify-self: end; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; font-weight: 650; }
.customer-summary { margin-bottom: 1rem; }
.customer-summary h3 { font-size: 1rem; margin: 0 0 .6rem; }
@media (width < 44rem) {
    .stacked-facts { grid-template-columns: minmax(0, 1fr); row-gap: .2rem; }
    .stacked-facts dd + dt { margin-top: .65rem; }
}
.totals dd { text-align: right; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (min-width: 44rem) {
    .content { padding-top: 2rem; }
    .guest-content { padding-top: clamp(2rem, 8vw, 6rem); }
    .auth-grid { grid-template-columns: 1.15fr 1fr; }
    .auth-card, .auth-intro { padding: 2rem; }
    .metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .filters { display: flex; }
    .filters label { flex: 1; }
    .filters label:first-child { flex: 1.5; }
    .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .line-fields { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; }
    .line-fields label:first-child { grid-column: auto; }
}

@media (max-width: 47.99rem) {
    .nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .nav a span { display: none; }
    .nav-home { width: 2.75rem; justify-self: center; }
}

.task-list { margin: 1rem 0 0; padding: 0; list-style: none; }
.task-record { flex-wrap: wrap; }
.task-title { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.task-description { margin: .4rem 0 0; white-space: pre-wrap; }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .85rem; margin-top: .4rem; font-size: .85rem; }
.task-sort { margin-top: 1rem; max-width: 25rem; }
.task-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

.check-field { display: flex; align-items: center; gap: .55rem; }
.check-field input { width: 1.1rem; min-height: auto; height: 1.1rem; accent-color: var(--accent); }
.check-field.destructive input { accent-color: var(--danger-ink); }
[data-series-presets][hidden] { display: none; }
