/* =============================================================================
   Outpost — dark noir with warm amber.
   Amber marks actions and the current location only. Neutrals are tinted warm.
   Libre Baskerville for page titles and the store; Inter for everything else.
============================================================================= */

:root {
    color-scheme: dark;

    /* Surfaces, darkest to lightest */
    --bg:            oklch(0.17 0.006 70);
    --bg-sunken:     oklch(0.15 0.006 70);
    --surface:       oklch(0.21 0.007 70);
    --surface-hover: oklch(0.24 0.008 70);
    --sidebar:       oklch(0.155 0.007 70);
    --input:         oklch(0.185 0.006 70);

    --line:          oklch(0.28 0.008 70);
    --line-strong:   oklch(0.36 0.01 70);

    /* Text */
    --text-strong:   oklch(0.97 0.005 80);
    --text:          oklch(0.86 0.008 80);
    --text-muted:    oklch(0.66 0.01 75);
    --text-faint:    oklch(0.55 0.01 75);
    --on-accent:     oklch(0.18 0.02 60);

    /* Amber */
    --accent:        oklch(0.76 0.17 65);
    --accent-hover:  oklch(0.81 0.15 70);
    --accent-press:  oklch(0.70 0.16 62);
    --accent-tint:   oklch(0.76 0.17 65 / 0.12);
    --accent-line:   oklch(0.76 0.17 65 / 0.45);

    /* States */
    --success:       oklch(0.74 0.14 160);
    --success-tint:  oklch(0.74 0.14 160 / 0.14);
    --warning:       oklch(0.80 0.14 85);
    --warning-tint:  oklch(0.80 0.14 85 / 0.14);
    --danger:        oklch(0.68 0.19 25);
    --danger-tint:   oklch(0.68 0.19 25 / 0.14);
    --info:          oklch(0.76 0.11 230);
    --info-tint:     oklch(0.76 0.11 230 / 0.14);

    --radius-sm: 6px;
    --radius:    10px;
    --measure:   46rem; /* widest form or boxed block in a content column */
    --radius-lg: 14px;

    --font-serif: 'Libre Baskerville', Georgia, serif;
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono:  ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --focus: 0 0 0 3px oklch(0.76 0.17 65 / 0.45);
}

/* ---------- Base ---------- */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 400 15px/1.6 var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, fieldset {
    margin: 0;
}

/* Fieldsets otherwise grow to fit long unbreakable content. */
fieldset {
    min-width: 0;
}

ul, ol {
    padding: 0;
}

h1, h2, h3 {
    color: var(--text-strong);
    line-height: 1.25;
    font-weight: 600;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 150ms var(--ease);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus);
    border-radius: var(--radius-sm);
}

code,
.code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.code-strong {
    color: var(--text-strong);
    font-weight: 600;
    letter-spacing: 0.03em;
}

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 10;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: var(--on-accent);
    border-radius: var(--radius-sm);
}

.skip-link:focus {
    top: 1rem;
}

.hint {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.optional {
    color: var(--text-faint);
    font-weight: 400;
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

.text-accent {
    color: var(--accent);
}

.lead {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 62ch;
}

.lead-small {
    color: var(--text);
    max-width: 62ch;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 40px;
    padding: 0.5rem 1.05rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: 600 0.9rem/1.2 var(--font-sans);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--on-accent);
}

.btn-primary:active {
    background: var(--accent-press);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--text-strong);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--text-faint);
    color: var(--text-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text-strong);
}

.btn-danger {
    background: var(--danger);
    color: oklch(0.98 0.01 25);
}

.btn-danger:hover {
    background: oklch(0.72 0.19 25);
    color: oklch(0.98 0.01 25);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    min-height: 32px;
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
}

.btn-large {
    min-height: 48px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.link-button:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.link-danger {
    color: var(--danger);
}

.link-danger:hover {
    color: oklch(0.74 0.17 25);
}

.link-quiet {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.link-quiet:hover {
    color: var(--text-strong);
}

form.inline {
    display: inline;
}

/* ---------- Forms ---------- */

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

.form-narrow {
    max-width: 30rem;
}

.form-wide {
    max-width: var(--measure);
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 0 1.5rem;
    border: 0;
    border-bottom: 1px solid var(--line);
}

.form-section legend {
    padding: 0;
    margin-bottom: 1rem;
    color: var(--text-strong);
    font-weight: 600;
    font-size: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field label,
.field > .label {
    color: var(--text-strong);
    font-weight: 500;
    font-size: 0.9rem;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 1rem;
}

.input {
    width: 100%;
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    background: var(--input);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text-strong);
    font: inherit;
    transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.input::placeholder {
    color: var(--text-faint);
}

.input:hover {
    border-color: var(--text-faint);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus);
}

.input:disabled {
    color: var(--text-muted);
    background: var(--bg-sunken);
}

.input:user-invalid {
    border-color: var(--danger);
}

textarea.input {
    resize: vertical;
    line-height: 1.5;
}

select.input {
    appearance: none;
    padding-right: 2rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 1rem) 50%, calc(100% - 0.7rem) 50%;
    background-size: 0.3rem 0.3rem;
    background-repeat: no-repeat;
}

.input-code {
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.input-file {
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
}

.input-file::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.45rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text-strong);
    font: 600 0.85rem var(--font-sans);
    cursor: pointer;
}

.check-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    font-size: 0.92rem;
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    accent-color: var(--accent);
}

.radio-stack {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.radio-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.75rem;
}

.radio-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    background: var(--input);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}

.radio-card input {
    margin-top: 0.2rem;
}

.radio-card > span {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    color: var(--text-strong);
}

.radio-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-tint);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.money-input {
    position: relative;
}

.money-input span {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.money-input .input {
    padding-left: 1.6rem;
    font-size: 1.15rem;
    font-weight: 600;
}

.optional-fields summary {
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
}

.optional-fields[open] summary {
    margin-bottom: 1rem;
}

.optional-fields .field + .field {
    margin-top: 1rem;
}

/* ---------- Feedback ---------- */

.flashes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.flash {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-strong);
    font-size: 0.92rem;
}

.flash-success {
    border-color: oklch(0.74 0.14 160 / 0.45);
    background: var(--success-tint);
}

.flash-error {
    border-color: oklch(0.68 0.19 25 / 0.5);
    background: var(--danger-tint);
}

.flash-info {
    border-color: oklch(0.76 0.11 230 / 0.4);
    background: var(--info-tint);
}

.flash-close {
    padding: 0 0.25rem;
    border: 0;
    background: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.flash-close:hover {
    color: var(--text-strong);
}

.notice {
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: var(--radius-sm);
    background: var(--info-tint);
    color: var(--text-strong);
    font-size: 0.92rem;
}

.notice-danger {
    background: var(--danger-tint);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}

.pill::before {
    content: '';
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
}

.pill-success { background: var(--success-tint); color: var(--success); }
.pill-warning { background: var(--warning-tint); color: var(--warning); }
.pill-danger  { background: var(--danger-tint);  color: var(--danger); }
.pill-info    { background: var(--info-tint);    color: var(--info); }
.pill-muted   { background: oklch(0.5 0.01 75 / 0.18); color: var(--text-muted); }

.empty {
    padding: 3rem 1.5rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    text-align: center;
}

.empty h2,
.empty h1 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.empty p {
    margin: 0 auto 1.25rem;
    max-width: 44ch;
    color: var(--text-muted);
}

.empty-page {
    margin: 4rem auto;
    max-width: 34rem;
}

.empty-inline {
    padding: 2rem 0;
    color: var(--text-muted);
}

/* ---------- Page structure ---------- */

.container {
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

.page-title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.75rem;
    letter-spacing: 0.005em;
}

.page-lead {
    max-width: var(--measure);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.breadcrumbs {
    margin-bottom: 0.75rem;
    color: var(--text-faint);
    font-size: 0.85rem;
}

.breadcrumbs a {
    color: var(--text-muted);
}

.section {
    margin-bottom: 2.25rem;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.section-title {
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}

.section-head .section-title {
    margin-bottom: 0;
}

.panel {
    padding: 1.25rem 1.4rem;
    margin-bottom: 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.panel-title {
    margin-bottom: 0.4rem;
    font-size: 1rem;
}

.panel .hint {
    margin-bottom: 1rem;
}

.panel-quiet {
    background: transparent;
}

/* Secondary panels that follow a main form sit clearly apart from it. */
form + .panel {
    margin-top: 3rem;
}

.panel-danger {
    background: transparent;
    border-color: oklch(0.68 0.19 25 / 0.45);
}

.panel-danger,
.panel-quiet {
    max-width: var(--measure);
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(14rem, 1fr);
    gap: 2.5rem;
}

.details {
    display: grid;
    grid-template-columns: minmax(7rem, max-content) 1fr;
    gap: 0.55rem 1.5rem;
    margin-bottom: 2rem;
}

.details dt {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.details dd {
    color: var(--text-strong);
    overflow-wrap: anywhere;
}

.details-stacked {
    grid-template-columns: 1fr;
    gap: 0.1rem;
}

.details-stacked dd {
    margin-bottom: 0.65rem;
}

.details-compact {
    margin-bottom: 1.5rem;
}

.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}

.tabs a {
    padding: 0.6rem 0.9rem;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.92rem;
    white-space: nowrap;
}

.tabs a:hover {
    color: var(--text-strong);
    text-decoration: none;
}

.tabs a[aria-current="page"] {
    border-bottom-color: var(--accent);
    color: var(--text-strong);
}

.tabs-inline {
    margin-bottom: 0;
    border-bottom: 0;
}

.tabs-inline a {
    padding: 0.4rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 999px;
    margin: 0;
}

.tabs-inline a[aria-current="page"] {
    border-color: var(--line-strong);
    background: var(--surface);
}

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

.search {
    display: flex;
    gap: 0.5rem;
    flex: 1 1 18rem;
    max-width: 28rem;
    margin-left: auto;
}

/* ---------- Tables and lists ---------- */

.table-wrap {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.table th {
    padding: 0.65rem 1rem;
    background: var(--bg-sunken);
    border-bottom: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: oklch(0.21 0.007 70 / 0.6);
}

.table tfoot td {
    border-top: 1px solid var(--line);
    border-bottom: 0;
    color: var(--text-muted);
}

.table .nowrap {
    white-space: nowrap;
}

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

.table td .hint {
    display: block;
}

.row-title {
    color: var(--text-strong);
    font-weight: 600;
}

/* The row's main link covers the whole row; other controls stay on top. */
.table tr:has(.row-title) {
    position: relative;
    cursor: pointer;
}

.row-title::after {
    content: '';
    position: absolute;
    inset: 0;
}

.table tr:has(.row-title) :is(a:not(.row-title), button, input, select) {
    position: relative;
    z-index: 1;
}

.row-title:hover,
.table tr:has(.row-title):hover .row-title {
    color: var(--accent);
}

.count-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

.table-form td {
    padding: 0.5rem 1rem;
}

.table-form .input {
    max-width: 12rem;
}

.receipt-total td {
    color: var(--text-strong);
    font-weight: 700;
}

.plain-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.site-list {
    max-width: var(--measure);
    list-style: none;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.site-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem;
}

.site-list li + li {
    border-top: 1px solid var(--line);
}

.key-field {
    display: flex;
    gap: 0.5rem;
    max-width: 34rem;
    margin-bottom: 0.5rem;
}

.key-field .input {
    text-transform: none;
}

pre.command {
    margin: 0.5rem 0;
    padding: 0.6rem 0.8rem;
    overflow-x: auto;
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text-strong);
    font: 0.85rem var(--font-mono);
}

/* ---------- Store header and footer ---------- */

.site-header {
    border-bottom: 1px solid var(--line);
    background: oklch(0.17 0.006 70 / 0.94);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: saturate(1.2) blur(6px);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-strong);
    font: 700 1.15rem var(--font-serif);
}

.brand:hover {
    color: var(--text-strong);
    text-decoration: none;
}

.brand-mark {
    width: 0.8rem;
    height: 0.8rem;
    background: var(--accent);
    transform: rotate(45deg);
    border-radius: 2px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.site-nav > a:not(.btn) {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.92rem;
}

.site-nav > a:not(.btn):hover,
.site-nav > a[aria-current="page"]:not(.btn) {
    color: var(--text-strong);
    text-decoration: none;
}

.site-nav form {
    display: flex;
}

.site-nav .link-button {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.92rem;
}

.site-nav .link-button:hover {
    color: var(--text-strong);
}

.count {
    display: inline-flex;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.35rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 0.72rem;
    font-weight: 700;
}

.site-main {
    flex: 1;
    padding: 2.5rem 0 4rem;
}

.site-footer {
    padding: 1.75rem 0;
    border-top: 1px solid var(--line);
    color: var(--text-faint);
    font-size: 0.85rem;
}

/* ---------- Store pages ---------- */

.store-intro {
    padding: 1.5rem 0 2.5rem;
}

.store-intro h1 {
    margin-bottom: 0.75rem;
    font: 700 clamp(2rem, 4vw, 2.75rem)/1.15 var(--font-serif);
}

.catalog-toolbar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.75rem;
}

.catalog-toolbar .input {
    max-width: 20rem;
}

.chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.chip {
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font: 500 0.85rem var(--font-sans);
    cursor: pointer;
    transition: border-color 150ms var(--ease), color 150ms var(--ease), background-color 150ms var(--ease);
}

.chip:hover {
    color: var(--text-strong);
    border-color: var(--text-faint);
}

.chip[aria-pressed="true"] {
    background: var(--accent-tint);
    border-color: var(--accent-line);
    color: var(--text-strong);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 1rem;
}

.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    transition: background-color 200ms var(--ease), border-color 200ms var(--ease);
}

.product-card:hover {
    background: var(--surface);
    border-color: var(--line-strong);
}

.product-card.is-featured {
    border-color: var(--accent-line);
}

.product-meta {
    display: flex;
    gap: 0.75rem;
    color: var(--text-faint);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tag-accent {
    color: var(--accent);
}

.product-card-title {
    font: 700 1.2rem/1.3 var(--font-serif);
}

/* The whole card is clickable through the title link. */
.product-card-title a {
    color: var(--text-strong);
}

.product-card-title a::after {
    content: '';
    position: absolute;
    inset: 0;
}

.product-card-title a:hover {
    text-decoration: none;
}

.product-card-tagline {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.price {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-top: auto;
    padding-top: 0.75rem;
    color: var(--text-strong);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.price-was {
    color: var(--text-faint);
    font-weight: 400;
    font-size: 0.9rem;
}

.price-large {
    padding-top: 0;
    font-size: 2rem;
    font-weight: 700;
}

.product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 21rem;
    gap: 3.5rem;
    align-items: start;
}

.product-title {
    margin: 0.5rem 0 0.75rem;
    font: 700 clamp(1.9rem, 3.5vw, 2.5rem)/1.15 var(--font-serif);
}

.product-body .lead {
    margin-bottom: 2rem;
}

.prose {
    max-width: 68ch;
    margin-bottom: 2.5rem;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.75;
}

.buy-box {
    position: sticky;
    top: 88px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.buy-label {
    margin-bottom: 0.5rem;
    color: var(--text-strong);
    font-weight: 600;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    border: 0;
}

.option {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}

.option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-tint);
}

.option-name {
    color: var(--text-strong);
    font-weight: 500;
}

.option-price {
    color: var(--text-strong);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Cart */

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20rem;
    gap: 2.5rem;
    align-items: start;
}

.line-items {
    list-style: none;
    margin-bottom: 1.25rem;
    border-top: 1px solid var(--line);
}

.line-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1.25rem;
    align-items: center;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--line);
}

.line-item-title {
    color: var(--text-strong);
    font-weight: 600;
}

.line-item-price {
    color: var(--text-strong);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.summary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.summary-title {
    font-size: 1rem;
}

.summary-lines {
    display: grid;
    grid-template-columns: 1fr auto;
    row-gap: 0.5rem;
}

.summary-lines dd {
    padding-left: 1rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.summary-total {
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
    color: var(--text-strong);
    font-size: 1.1rem;
    font-weight: 700;
}

.coupon-form {
    display: flex;
    gap: 0.5rem;
}

.coupon-applied {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.75rem;
    background: var(--accent-tint);
    border-radius: var(--radius-sm);
    color: var(--text-strong);
    font-size: 0.9rem;
}

/* ---------- Auth and setup ---------- */

.auth {
    max-width: 24rem;
    margin: 2rem auto;
}

.auth .page-title {
    margin-bottom: 1.5rem;
}

.label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.label-row .link-quiet {
    font-size: 0.85rem;
}

.auth .lead {
    margin: -0.75rem 0 1.5rem;
    font-size: 0.95rem;
}

.auth-switch {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 0.92rem;
    text-align: center;
}

.minimal-main {
    width: 100%;
    max-width: 36rem;
    margin: 0 auto;
    padding: 3rem 1.25rem 4rem;
}

.minimal-main > .brand {
    margin-bottom: 2.5rem;
}

.setup .lead {
    margin: 0.75rem 0 2rem;
}

.setup-step {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.4rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.setup-step legend {
    float: left;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0;
    color: var(--text-strong);
    font-weight: 600;
}

.step-number {
    display: inline-flex;
    width: 1.6rem;
    height: 1.6rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 0.85rem;
    font-weight: 700;
}

.setup-step .hint p + p,
.setup-step .hint p + pre {
    margin-top: 0.4rem;
}

/* ---------- Account ---------- */

.account-layout {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
}

.section-nav {
    position: sticky;
    top: 88px;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.section-nav-label {
    margin-bottom: 0.75rem;
    color: var(--text-faint);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.section-nav-label strong {
    color: var(--text-muted);
    font-weight: 600;
}

.section-nav a {
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.92rem;
}

.section-nav a:hover {
    background: var(--surface);
    color: var(--text-strong);
    text-decoration: none;
}

.section-nav a[aria-current="page"] {
    background: var(--surface);
    color: var(--text-strong);
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

.software-list {
    list-style: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.software-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
}

.software-row + .software-row {
    border-top: 1px solid var(--line);
}

.software-title {
    color: var(--text-strong);
    font-weight: 600;
    font-size: 1.02rem;
}

.software-actions {
    display: flex;
    gap: 0.5rem;
}

.older-releases {
    margin-top: 1rem;
}

.older-releases summary {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
}

.older-releases ul {
    list-style: none;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.renew {
    max-width: var(--measure);
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.renew p {
    margin-bottom: 0.9rem;
}

/* Receipt */

.receipt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.receipt {
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.receipt-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.receipt-store {
    margin-bottom: 0.25rem;
    color: var(--accent);
    font: 700 0.95rem var(--font-serif);
}

.receipt-table {
    margin-bottom: 2rem;
    border: 1px solid var(--line);
}

.receipt-keys {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.receipt-keys li {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.receipt-keys code {
    color: var(--text-strong);
}

.receipt-foot {
    margin-top: 2rem;
}

/* ---------- Admin shell ---------- */

.admin-shell {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.4rem 1rem;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
}

.admin-sidebar > .brand {
    padding: 0 0.6rem;
    font-size: 1.05rem;
}

.sidebar-toggle {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1;
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sidebar-label {
    padding: 0 0.6rem;
    margin-bottom: 0.35rem;
    color: var(--text-faint);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-group a,
.sidebar-group .link-button {
    display: block;
    width: 100%;
    padding: 0.42rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
}

.sidebar-group a:hover,
.sidebar-group .link-button:hover {
    background: var(--surface);
    color: var(--text-strong);
    text-decoration: none;
}

.sidebar-group a[aria-current="page"] {
    background: var(--accent-tint);
    color: var(--text-strong);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.admin-main {
    padding: 2rem 2.5rem 4rem;
    max-width: 76rem;
}

.mode {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.mode::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
}

.mode-live { color: var(--success); }
.mode-test { color: var(--warning); }
.mode-off  { color: var(--danger); }

.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    margin-bottom: 2.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.stat-strip > div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.9rem 1.1rem;
}

.stat-strip > div + div {
    border-left: 1px solid var(--line);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.stat-value {
    color: var(--text-strong);
    font-size: 1.25rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.stat-value a {
    color: inherit;
}

.checklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.check {
    display: grid;
    grid-template-columns: 1.4rem 1fr;
    column-gap: 0.5rem;
}

.check::before {
    content: '!';
    grid-row: span 2;
    display: inline-flex;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}

.check-problem::before { background: var(--danger-tint); color: var(--danger); }
.check-warning::before { background: var(--warning-tint); color: var(--warning); }
.check-ok::before      { content: '✓'; background: var(--success-tint); color: var(--success); }

.check a {
    color: var(--text-strong);
    font-weight: 500;
}

.system-checks {
    list-style: none;
    margin-bottom: 2.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.system-check {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.1rem 1.25rem;
}

.system-check + .system-check {
    border-top: 1px solid var(--line);
}

.system-check-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.system-check h2 {
    font-size: 0.98rem;
}

.system-check form {
    margin-top: 0.5rem;
}

.state {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.state-ok      { color: var(--success); }
.state-warning { color: var(--warning); }
.state-problem { color: var(--danger); }

.settings-note {
    margin-top: 2.5rem;
    max-width: 38rem;
}

/* ---------- Responsive ---------- */

/* ---------- Product images ---------- */

.product-card-image {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    margin-bottom: 0.5rem;
    background: var(--bg-sunken);
    border-radius: var(--radius-sm);
}

.product-card.is-retired {
    opacity: 0.72;
}

.price-retired {
    color: var(--text-muted);
    font-weight: 500;
}

.product-card-placeholder {
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    color: var(--line-strong);
    font: 700 3rem/1 var(--font-serif);
}

.gallery {
    margin: 0 0 2rem;
}

.gallery-main {
    display: block;
    overflow: hidden;
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.gallery-main img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 32rem;
    object-fit: contain;
}

.gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
    list-style: none;
}

.gallery-thumb {
    display: block;
    width: 5.5rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    opacity: 0.7;
    transition: opacity 150ms var(--ease), border-color 150ms var(--ease);
}

.gallery-thumb:hover,
.gallery-thumb[aria-current="true"] {
    opacity: 1;
    border-color: var(--accent-line);
}

.gallery-thumb img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.upload-bar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: var(--measure);
    margin-bottom: 2rem;
}

.upload-bar .field {
    flex: 1 1 18rem;
}

.image-manager {
    display: grid;
    gap: 0.75rem;
    max-width: var(--measure);
    margin-bottom: 1rem;
    list-style: none;
}

.image-row {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.image-thumb {
    width: 8rem;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: var(--bg-sunken);
    border-radius: var(--radius-sm);
}

.image-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.inline-field {
    display: flex;
    gap: 0.5rem;
}

.image-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    width: 6.5rem;
}

/* ---------- Small shared pieces ---------- */

.postal-address {
    display: flex;
    flex-direction: column;
    font-style: normal;
}

.effect-list {
    display: grid;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
    padding-left: 1.2rem;
}

.page-intro {
    max-width: var(--measure);
    margin-bottom: 1.75rem;
    color: var(--text-muted);
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 0.5rem;
}

.price-per {
    color: var(--text-muted);
    font-size: 0.5em;
    font-weight: 500;
}

.code-block {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 1rem 1.1rem;
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: 0.84rem/1.6 var(--font-mono);
    white-space: pre;
    overflow: auto;
    resize: vertical;
    tab-size: 4;
}

.snippet + .snippet {
    margin-top: 2.5rem;
}

/* ---------- Sales report ---------- */

.date-range {
    flex-wrap: wrap;
    align-items: center;
    max-width: 30rem;
}

.date-range .input {
    flex: 1 1 8.5rem;
    min-width: 0;
}

.date-range span {
    color: var(--text-muted);
}

.report-currencies {
    margin-bottom: 1.25rem;
}

.chart {
    margin: 0;
    padding: 1rem 1rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.chart svg {
    display: block;
    width: 100%;
    height: 11rem;
}

.chart-bar {
    fill: var(--accent);
}

.chart-bar:hover {
    fill: var(--accent-hover);
}

.chart-axis {
    stroke: var(--line-strong);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.chart-axis-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    color: var(--text-faint);
    font-size: 0.8rem;
}

.share-list {
    display: grid;
    gap: 1rem;
    list-style: none;
}

.share-list li {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 1rem;
}

.share-meter {
    grid-column: 1 / -1;
    width: 100%;
    height: 0.4rem;
}

.share-meter::-webkit-meter-bar {
    background: var(--surface);
    border: 0;
    border-radius: 999px;
}

.share-meter::-webkit-meter-optimum-value {
    background: var(--accent);
    border-radius: 999px;
}

.share-meter::-moz-meter-bar {
    background: var(--accent);
    border-radius: 999px;
}

/* ---------- News ---------- */

.news-list {
    list-style: none;
    max-width: var(--measure);
}

.news-item {
    padding: 1.6rem 0;
    border-top: 1px solid var(--line);
}

.news-item:first-child {
    padding-top: 0;
    border-top: 0;
}

.news-title {
    margin: 0.4rem 0 0.5rem;
    font: 700 1.35rem/1.3 var(--font-serif);
}

.news-title a {
    color: var(--text-strong);
}

.news-title a:hover {
    color: var(--accent);
}

.news-summary {
    color: var(--text-muted);
    max-width: 65ch;
}

.news-post {
    max-width: 68ch;
}

.news-post-head {
    margin-bottom: 1.75rem;
}

.news-post-head .product-title {
    margin-top: 0.5rem;
}

.news-product {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.news-back {
    margin-top: 1rem;
}

/* Sanitized rich text, shared by the news page and the editor. */
.rich-text > * + * {
    margin-top: 1em;
}

.rich-text h2,
.rich-text h3 {
    margin-top: 1.6em;
    color: var(--text-strong);
    line-height: 1.3;
}

.rich-text h2 { font-size: 1.3rem; }
.rich-text h3 { font-size: 1.1rem; }

.rich-text ul,
.rich-text ol {
    padding-left: 1.4em;
}

.rich-text li + li {
    margin-top: 0.3em;
}

.rich-text blockquote {
    padding: 0.2em 0 0.2em 1em;
    border-left: 1px solid var(--accent-line);
    color: var(--text-muted);
}

.rich-text pre {
    padding: 0.8rem 1rem;
    overflow-x: auto;
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font: 0.88rem/1.6 var(--font-mono);
}

.rich-text a {
    text-decoration: underline;
    text-decoration-color: var(--accent-line);
    text-underline-offset: 0.18em;
}

.rich-text .ql-align-center  { text-align: center; }
.rich-text .ql-align-right   { text-align: right; }
.rich-text .ql-align-justify { text-align: justify; }

/* Quill's "snow" editor, recoloured for the dark theme. */
.ql-toolbar.ql-snow {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-family: var(--font-sans);
}

.ql-container.ql-snow {
    background: var(--input);
    border: 1px solid var(--line-strong);
    border-top: 0;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    color: var(--text);
    font: 400 1rem/1.7 var(--font-sans);
}

.ql-container.ql-snow:focus-within {
    border-color: var(--accent-line);
}

.ql-editor {
    min-height: 18rem;
    padding: 1rem 1.1rem;
}

/* Match the spacing customers see on the published post. */
.ql-editor > * + * {
    margin-top: 0.75em;
}

.ql-editor h2 { font-size: 1.3rem; color: var(--text-strong); }
.ql-editor h3 { font-size: 1.1rem; color: var(--text-strong); }
.ql-editor a  { color: var(--accent); }

.ql-editor blockquote {
    border-left: 1px solid var(--accent-line);
    color: var(--text-muted);
}

.ql-snow .ql-editor pre.ql-syntax,
.ql-snow .ql-editor .ql-code-block-container {
    background: var(--bg-sunken);
    color: var(--text);
}

.ql-editor.ql-blank::before {
    color: var(--text-faint);
    font-style: normal;
}

.ql-snow .ql-stroke {
    stroke: var(--text-muted);
}

.ql-snow .ql-fill,
.ql-snow .ql-stroke.ql-fill {
    fill: var(--text-muted);
}

.ql-snow .ql-picker {
    color: var(--text-muted);
}

.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button:focus .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,
.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke {
    stroke: var(--accent);
}

.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button:focus .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill,
.ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill,
.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill {
    fill: var(--accent);
}

.ql-snow.ql-toolbar button:hover,
.ql-snow.ql-toolbar button.ql-active,
.ql-snow.ql-toolbar .ql-picker-label:hover,
.ql-snow.ql-toolbar .ql-picker-label.ql-active,
.ql-snow.ql-toolbar .ql-picker-item:hover,
.ql-snow.ql-toolbar .ql-picker-item.ql-selected {
    color: var(--accent);
}

.ql-snow .ql-picker-options,
.ql-snow .ql-picker.ql-expanded .ql-picker-label,
.ql-snow .ql-picker.ql-expanded .ql-picker-options {
    background: var(--surface);
    border-color: var(--line-strong);
}

.ql-snow .ql-tooltip {
    z-index: 3;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    box-shadow: none;
    color: var(--text);
}

.ql-snow .ql-tooltip input[type="text"] {
    background: var(--input);
    border: 1px solid var(--line-strong);
    color: var(--text-strong);
}

.ql-snow .ql-tooltip a.ql-action,
.ql-snow .ql-tooltip a.ql-remove {
    color: var(--accent);
}

@media (max-width: 900px) {
    .product-layout,
    .cart-layout,
    .split {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .buy-box,
    .section-nav {
        position: static;
    }

    .account-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .section-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .section-nav a {
        flex: 0 0 auto;
    }

    .section-nav-label {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    .admin-shell {
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
    }

    .admin-sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        padding: 0.9rem 1.25rem;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-toggle {
        display: inline-flex;
        padding: 0.35rem 0.8rem;
        border: 1px solid var(--line-strong);
        border-radius: var(--radius-sm);
        background: var(--surface);
        color: var(--text-strong);
        font: 600 0.85rem var(--font-sans);
        cursor: pointer;
    }

    .sidebar-nav {
        display: none;
        width: 100%;
    }

    .sidebar-nav.is-open {
        display: flex;
    }

    .admin-main {
        padding: 1.5rem 1.25rem 3rem;
    }

    .stat-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-strip > div + div {
        border-left: 0;
    }

    .stat-strip > div:nth-child(even) {
        border-left: 1px solid var(--line);
    }

    .stat-strip > div:nth-child(n + 3) {
        border-top: 1px solid var(--line);
    }
}

@media (max-width: 560px) {
    .image-row {
        grid-template-columns: 5.5rem minmax(0, 1fr);
    }

    .image-thumb {
        width: 5.5rem;
    }

    .image-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: flex-end;
        width: auto;
    }

    .site-header-inner {
        padding-block: 0.75rem;
        row-gap: 0.5rem;
    }

    .table .code {
        white-space: nowrap;
    }

    .line-item {
        grid-template-columns: 1fr auto;
    }

    .line-item form {
        grid-column: 1 / -1;
    }

    .details {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }

    .details dd {
        margin-bottom: 0.6rem;
    }

    .receipt {
        padding: 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* ---------- Print (receipts) ---------- */

@media print {
    :root {
        color-scheme: light;
    }

    body {
        background: white;
        color: black;
    }

    .site-header,
    .site-footer,
    .section-nav,
    .flashes,
    .no-print {
        display: none !important;
    }

    .account-layout {
        display: block;
    }

    .receipt,
    .table-wrap,
    .receipt-table {
        border: 0;
        background: none;
    }

    .page-title,
    h1, h2, .details dd, .receipt-keys code, .receipt-total td {
        color: black;
    }

    .table th {
        background: none;
        color: #333;
    }
}
