:root {
    color-scheme: light;
    font: 100%/1.5 system-ui, sans-serif;
    --bg: #eff3f0;
    --surface: #fff;
    --text: #202b26;
    --muted: #52635b;
    --border: #d2ded7;
    --accent: #176044;
    --accent-soft: #e1f1e7;
    --danger: #a52a37;
    --danger-soft: #fae9eb;
    --header: #132c23;
    --header-text: #fff;
    --header-muted: #bde3cd;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]), :root[data-theme="green"] {
        color-scheme: dark;
        --bg: #13201b;
        --surface: #1b2b24;
        --text: #e9f4ed;
        --muted: #baccc1;
        --border: #42584c;
        --accent: #91e2af;
        --accent-soft: #29473a;
        --danger: #ff9fab;
        --danger-soft: #4a2630;
        --header: #0e1915;
    }
}
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f1f4f8;
    --surface: #fff;
    --text: #1b2637;
    --muted: #46566c;
    --border: #bdc9d8;
    --accent: #214e9d;
    --accent-soft: #e3edff;
    --header: #fff;
    --header-text: var(--text);
    --header-muted: var(--muted);
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #15191f;
    --surface: #20262e;
    --text: #edf1f7;
    --muted: #b8c3d1;
    --border: #4b5768;
    --accent: #a8c7ff;
    --accent-soft: #293c58;
    --danger: #ff9fab;
    --danger-soft: #4a2630;
    --header: #101319;
    --header-text: var(--text);
    --header-muted: var(--muted);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shell { width: min(72rem, calc(100% - 2rem)); margin-inline: auto; }
main { padding-block: 1.5rem 3rem; }
.narrow { max-width: 28rem; padding-top: clamp(2rem, 9vw, 6rem); }
.top { background: var(--header); color: var(--header-text); border-bottom: 1px solid var(--border); }
.top :focus-visible { outline-color: var(--header-text); }
.top-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; padding-block: .8rem; }
.brand { color: inherit; text-decoration: none; font-weight: 750; }
.brand span { color: var(--header-muted); font-size: .875rem; margin-inline-start: .5rem; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.theme-picker { display: flex; align-items: center; gap: .4rem; }
.theme-picker[hidden] { display: none; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tabs a { padding: .6rem .75rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs a[aria-current] { color: var(--accent); border-color: currentColor; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.45rem); line-height: 1.15; margin-bottom: 1.15rem; letter-spacing: -.035em; }
h2 { font-size: 1.07rem; line-height: 1.4; overflow-wrap: anywhere; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: .7rem; padding: 1rem; }
.login { padding: 1.4rem; }
form { margin: 0; }
label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 650; }
input, textarea, button { font: inherit; }
input:not([type=checkbox]), textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: .5rem .65rem; border-radius: .35rem; }
textarea { resize: vertical; }
.login form, .filter-panel form, details form { display: grid; gap: .8rem; }
button { width: fit-content; padding: .42rem .8rem; border-radius: .35rem; border: 1px solid transparent; background: var(--accent); color: var(--surface); font-weight: 700; cursor: pointer; }
button.secondary { background: var(--accent-soft); color: var(--accent); }
button.danger { background: var(--danger-soft); color: var(--danger); }
button:hover { filter: brightness(.92); }
.toolbar, .links, .pager, .record-actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; }
.toolbar { margin-bottom: 1rem; }
.toolbar label { width: min(100%, 25rem); }
.toolbar a { padding-block: .45rem; }
summary { cursor: pointer; width: fit-content; font-weight: 650; }
details[open] > summary { margin-bottom: .7rem; }
.stack { display: grid; gap: .7rem; margin-top: .8rem; }
.record { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; }
.record-actions { align-items: start; justify-content: end; }
.record-actions form { max-width: 14rem; }
.record-actions details > summary { padding: .45rem .55rem; }
.comment-reply { margin-top: .8rem; max-width: 36rem; }
.comment-reply button { justify-self: start; }
.meta { color: var(--muted); font-size: .85rem; margin-bottom: .3rem; }
.tag { display: inline-block; color: var(--accent); background: var(--accent-soft); padding: .1rem .45rem; border-radius: .3rem; font-size: .85rem; vertical-align: baseline; }
.tag.muted { color: var(--muted); background: var(--bg); }
.subtle { color: var(--muted); margin: .2rem 0 .45rem; overflow-wrap: anywhere; }
.links { font-size: .9rem; margin-top: .45rem; }
.comment { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: .45rem; }
.answer { margin-top: .75rem; padding: .75rem; background: var(--bg); border-radius: .35rem; }
.answer details { margin-top: .5rem; }
.check { display: flex; align-items: start; gap: .4rem; font-weight: 500; }
.check input { margin-top: .3rem; }
.danger-details > summary { color: var(--danger); }
.message { padding: .65rem .8rem; border-radius: .4rem; margin-bottom: .9rem; background: var(--accent-soft); color: var(--accent); }
.message.error { background: var(--danger-soft); color: var(--danger); }
.pager { justify-content: center; align-items: center; margin-top: 1rem; }
.empty, .pager span { color: var(--muted); }
.filter-panel { max-width: 48rem; }
.queue-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: .75rem; }
.queue { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: .25rem .6rem; color: var(--text); text-decoration: none; }
.queue:hover { border-color: var(--accent); }
.queue p { grid-column: 1 / -1; font-size: .9rem; }
p + section { margin-top: .75rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .6rem .55rem; vertical-align: top; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
thead th { color: var(--muted); font-size: .9rem; }
tbody tr:last-child > * { border-bottom: 0; }
@media (max-width: 42rem) {
    .record { grid-template-columns: 1fr; }
    .record-actions { justify-content: start; }
    .brand span { display: block; margin-inline-start: 0; }
}

select { font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: .5rem .65rem; border-radius: .35rem; }
.editor-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-top: .8rem; }
.deal-product { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem .8rem; }
.deal-product > label { width: min(100%, 16rem); }
.deal-pricing, .deal-languages { display: grid; gap: .8rem; align-items: start; }
.deal-pricing { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
.deal-languages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.deal-pricing select { width: 100%; }
.deal-languages fieldset { display: grid; align-content: start; gap: .7rem; min-width: 0; margin: 0; padding: .75rem; border: 1px solid var(--border); border-radius: .45rem; }
.editor-submit { display: flex; flex-wrap: wrap; gap: .65rem; padding-top: .75rem; border-top: 1px solid var(--border); }
@media (max-width: 42rem) {
    .deal-languages { grid-template-columns: minmax(0, 1fr); }
    .deal-pricing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .deal-pricing label:last-child { grid-column: 1 / -1; }
}
@media (max-width: 28rem) {
    .deal-pricing { grid-template-columns: minmax(0, 1fr); }
}
legend { font-weight: 700; padding-inline: .3rem; }
.back-link, .invite { margin-bottom: 1rem; }
.button-link { display: inline-block; border-radius: .35rem; padding: .42rem .8rem; font-weight: 700; color: var(--surface); background: var(--accent); text-decoration: none; }
.signin-link, .return-form { margin-top: .9rem; }
.return-form { display: grid; gap: .65rem; max-width: 42rem; }
.return-note { margin-bottom: .9rem; }
.setup-code { margin-block: .6rem; overflow-wrap: anywhere; }
.setup-code code { background: var(--accent-soft); border-radius: .3rem; padding: .15rem .35rem; }
.usage-totals { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.usage-totals dd { font-size: 1.55rem; font-weight: 750; margin: .2rem 0 0; font-variant-numeric: tabular-nums; }
.usage-totals dt { color: var(--muted); }
.writing-actions { min-width: 0; }
.writing-buttons { display: flex; flex-wrap: wrap; gap: .45rem; }
.writing-actions p:empty { display: none; }
.writing-actions p { margin: .25rem 0 0; }
button:disabled { cursor: wait; opacity: .65; }
.editor-history { min-width: 0; padding: .85rem; border: 1px solid var(--border); border-radius: .45rem; }
.editor-history-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.editor-history-plot { position: relative; margin-top: .5rem; }
.editor-history canvas { display: block; width: 100%; height: 11rem; color: var(--muted); border-color: var(--border); outline-color: var(--accent); cursor: crosshair; touch-action: pan-y; }
.editor-history-tooltip { position: absolute; top: 0; right: 0; max-width: 100%; padding: .2rem .45rem; border: 1px solid var(--border); border-radius: .35rem; background: var(--surface); color: var(--text); font-size: .85rem; pointer-events: none; }
.editor-history p:empty { display: none; }
.deal-preview article > details { margin-top: .75rem; }
.deal-preview h3 { font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.preview-votes { display: flex; flex-wrap: wrap; gap: .75rem 2rem; margin: .6rem 0 0; }
.preview-votes dt { color: var(--muted); font-size: .85rem; }
.preview-votes dd { margin: 0; font-size: 1.35rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.preview-thread { display: grid; gap: .75rem; margin: .75rem 0 0; padding: 0; list-style: none; }
.preview-thread li > article { background: var(--bg); border-radius: .45rem; padding: .75rem; }
.preview-thread .preview-thread { padding-inline-start: clamp(.5rem, 3vw, 1.25rem); border-inline-start: 2px solid var(--border); }
