:root {
    color-scheme: light;
    --navy: #142634;
    --text: #243742;
    --muted: #566c76;
    --line: #d8e3e5;
    --bg: #f1f6f6;
    --teal: #12665e;
    --soft-teal: #e6f2ef;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1,h2,p { margin-top: 0; }
h1 { color: var(--navy); font-size: clamp(1.85rem,5vw,2.7rem); line-height: 1.08; margin-bottom: 0; letter-spacing: -.04em; }
h2 { color: var(--navy); font-size: 1.2rem; margin-bottom: .85rem; }
a { color: var(--teal); }
button,input,select,textarea { font: inherit; }
button,.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .55rem .9rem; border: 1px solid var(--line); border-radius: 8px; color: var(--navy); background: white; font-weight: 650; text-decoration: none; cursor: pointer; }
button:hover,.button:hover { background: var(--soft-teal); }
.primary { color: white; background: var(--teal); border-color: var(--teal); }
.primary:hover { background: #0e524b; color: white; }
button:disabled { opacity: .52; cursor: default; }
:focus-visible { outline: 3px solid #5aa79d; outline-offset: 3px; }
.site-header { background: var(--navy); color: white; }
.header-inner { max-width: 1260px; margin: auto; padding: .8rem 1.35rem; display: flex; align-items: center; justify-content: space-between; gap: .6rem 1.5rem; flex-wrap: wrap; }
.brand { color: white; text-decoration: none; display: inline-flex; align-items: center; gap: .65rem; font-weight: 750; }
.brand-icon { width: 31px; height: 31px; display: inline-grid; place-items: center; border-radius: 9px; background: #b1e1d7; color: var(--navy); font-size: .7rem; }
.brand-icon.large { width: 54px; height: 54px; font-size: 1rem; margin-bottom: 1rem; border-radius: 15px; }
nav,.actions,.search-row,.search-form { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
nav { gap: .9rem; }
nav a,nav button.quiet { color: #eef8f6; }
.nav-link,.text-link { font-weight: 650; text-decoration: none; }
.nav-link:hover,.text-link:hover { text-decoration: underline; }
.shell { max-width: 1260px; padding: 2rem 1.35rem; margin: auto; }
.heading { margin: 0 0 1.5rem; }
.eyebrow { color: var(--teal); font-weight: 700; font-size: .88rem; margin-bottom: .4rem; }
.panel { background: white; padding: clamp(1rem,3vw,1.5rem); border: 1px solid var(--line); border-radius: 13px; margin-bottom: 1rem; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .8rem; }
.stat { display: grid; gap: .2rem; background: #fbfefe; }
.stat span,.muted { color: var(--muted); }
.stat strong { font-size: clamp(1.25rem,4vw,2rem); color: var(--navy); }
.search-form { flex: 1; }
.search-form input,.search-form select { flex: 1; min-width: 160px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(180px,100%),1fr)); gap: 1rem; margin-bottom: .95rem; }
label { font-size: .87rem; font-weight: 650; display: grid; gap: .3rem; }
input:not([type=checkbox]),select,textarea,output { border: 1px solid var(--line); border-radius: 7px; padding: .54rem .63rem; width: 100%; min-height: 40px; color: var(--navy); background: white; }
input:disabled { background: var(--bg); }
output { display: block; background: var(--bg); }
output small { color: var(--muted); }
.wide { grid-column: 1/-1; }
.checkbox { display: flex; align-items: center; align-self: end; min-height: 40px; }
.actions { margin-top: .9rem; }
.actions.top { margin: 0 0 .95rem; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; min-width: 100%; text-align: left; font-size: .92rem; }
th,td { padding: .68rem .55rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); background: var(--bg); white-space: nowrap; }
td { overflow-wrap: anywhere; }
td label { min-width: 128px; }
.expired { background: #edf0f2; color: #53636c; }
.pill { display: inline-block; padding: .2rem .55rem; border-radius: 99px; background: var(--soft-teal); color: var(--teal); font-size: .82rem; font-weight: 650; }
.customer-meta p { margin: .6rem 0 0; }
.record-notes { white-space: pre-wrap; }
.quiet { border: 0; background: transparent; padding: .25rem .35rem; min-height: 30px; color: var(--teal); }
nav .quiet:hover { color: var(--navy); }
.secret { white-space: nowrap; }
.secret span { white-space: normal; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: .65rem 0; margin: 0; }
.alert { padding: .85rem 1rem; border-radius: 8px; }
.error { background: #fbece6; color: #812a1a; }
.success { background: var(--soft-teal); color: #15574d; }
.auth-shell { width: min(100% - 2rem, 440px); margin: clamp(2rem,13vh,8rem) auto; }
.auth { padding: clamp(1.2rem,5vw,2rem); }
.auth h1 { font-size: 2rem; margin-bottom: 1.4rem; }
.auth label { margin-bottom: .85rem; }
.auth form button { width: 100%; margin-bottom: .5rem; }
.setup-key { overflow-wrap: anywhere; padding: .65rem; background: var(--bg); }
.draft-line { margin: .7rem 0; border: 1px solid var(--line); border-radius: 8px; }
.draft-line summary { cursor: pointer; font-weight: 700; padding: .8rem; background: var(--bg); border-radius: 7px; }
.draft-content { padding: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media(max-width: 650px) {
    .search-form { flex-basis: 100%; }
    .search-form input { flex-basis: 100%; }
    .shell { padding: 1.25rem .8rem; }
    .stats { gap: .35rem; }
    .stat { padding: .6rem; }
}
.record-history tr { height: 3.5rem; }
.record-history th,.record-history td { padding: .45rem .65rem; white-space: nowrap; }
.record-history { max-height: 21rem; }
.record-history thead { position: sticky; top: 0; }
.cartoon-tv { display: flex; align-items: center; gap: .35rem; width: 83px; padding: .45rem; margin: 1.1rem 0; position: relative; background: #12665e; border: 3px solid #142634; border-radius: 13px; }
.cartoon-tv::before { content: ''; position: absolute; width: 16px; height: 16px; border-left: 3px solid #142634; border-top: 3px solid #142634; transform: rotate(45deg); top: -12px; left: 28px; }
.cartoon-tv span { display: grid; place-items: center; width: 47px; height: 32px; background: #b1e1d7; border-radius: 7px; }
.cartoon-tv i { width: 6px; height: 6px; border-radius: 50%; background: white; }
.draft-price { float: right; }
.printable-invoice .table-wrap { margin-bottom: 1rem; }
.print-total { text-align: right; margin: 1rem 0 0; }
@media print {
    @page { size: letter; margin: 0.5in; }
    :root { background: white; }
    body { min-height: 0; }
    .site-header, .no-print { display: none !important; }
    .shell { padding: 0; margin: 0; max-width: none; }
    .printable-invoice { border: 0; padding: 0; margin: 0; }
    .printable-invoice .table-wrap { overflow: visible; }
    .printable-invoice tr { break-inside: avoid; }
}

.draft-meta { margin-inline: .6rem; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.invoice-items { width: 100%; table-layout: fixed; }
.invoice-service { width: 30%; }
.invoice-price { width: 20%; }
.invoice-items th,.invoice-items td { overflow-wrap: anywhere; }
.invoice-items th:last-child,.invoice-items td:last-child { text-align: right; }
.invoice-items .invoice-group th { text-align: left; color: var(--text); }
@media print {
    .invoice-items thead { display: table-header-group; }
    .invoice-items .invoice-group { break-after: avoid; }
}
