/* admin.css — desktop admin GUI layout.
   All design tokens now come from static/shared/base.css (loaded first). This
   file previously forked the entire :root with colliding values ('Inter' that
   was never bundled, --radius-sm 8px vs base 6px, emerald vs forest). That fork
   is deleted — base.css is the single source of truth and carries the admin
   values (bg #0b0e14, surfaces, 16/12/8px radii, shadows) forward. */

body {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    overflow: hidden;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font);
}

/* ========================================================================== */
/* Backup & Restore — platform recovery console                               */
/* ========================================================================== */
.backup-view {
    --backup-cyan: #38bdf8;
    --backup-cyan-glow: rgba(56, 189, 248, 0.16);
    --backup-amber: #fbbf24;
    position: relative;
}

.backup-view::before {
    content: '';
    position: absolute;
    inset: -2rem -2rem auto;
    height: 260px;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(rgba(56, 189, 248, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.035) 1px, transparent 1px),
        radial-gradient(circle at 72% 20%, rgba(56, 189, 248, 0.11), transparent 38%);
    background-size: 28px 28px, 28px 28px, auto;
    mask-image: linear-gradient(to bottom, #000, transparent);
}

.backup-titlebar,
.backup-title-actions,
.backup-create,
.backup-create-copy,
.backup-create-actions,
.backup-section-title,
.backup-section-title > div,
.backup-guardrail {
    display: flex;
    align-items: center;
}

.backup-titlebar {
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.35rem;
}

.backup-titlebar h2 { margin: 0.2rem 0 0.35rem; }
.backup-titlebar p { margin: 0; max-width: 720px; }
.backup-title-actions { gap: 0.65rem; flex: 0 0 auto; }

.backup-eyebrow,
.backup-label {
    display: block;
    color: var(--backup-cyan);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.backup-config-note {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-md);
    background: rgba(251, 191, 36, 0.08);
    color: #fde68a;
    line-height: 1.5;
}

.backup-console {
    display: grid;
    grid-template-columns: minmax(250px, 1.35fr) repeat(3, minmax(160px, 1fr));
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.backup-console .card {
    min-height: 126px;
    padding: 1.05rem;
    background:
        linear-gradient(145deg, rgba(255,255,255,0.035), transparent 55%),
        var(--color-surface);
}

.backup-health {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 0.9rem;
    align-items: center;
}

.backup-health-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: 14px;
    background: var(--backup-cyan-glow);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

#backup-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-text-dim);
    box-shadow: 0 0 0 5px rgba(148, 163, 184, 0.12);
}
#backup-status-dot.ok { background: var(--color-primary); box-shadow: 0 0 0 5px var(--color-primary-glow), 0 0 20px var(--color-primary); }
#backup-status-dot.bad { background: var(--status-danger); box-shadow: 0 0 0 5px var(--color-danger-glow); }

.backup-health strong,
.backup-metric strong {
    display: block;
    margin: 0.38rem 0 0.2rem;
    font-size: 1.05rem;
    line-height: 1.2;
}
.backup-health .mono { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.backup-create {
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 0.8rem;
    border-color: rgba(56, 189, 248, 0.2);
}
.backup-create-copy { gap: 1rem; }
.backup-create-copy h3,
.backup-create-copy p { margin: 0; }
.backup-create-copy p { margin-top: 0.25rem; }
.backup-create-actions { gap: 0.65rem; min-width: min(100%, 430px); }
.backup-create-actions select { flex: 1; min-width: 180px; }
.backup-create-actions .btn { white-space: nowrap; }

.backup-step {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.24);
    color: var(--backup-cyan);
    background: var(--backup-cyan-glow);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 800;
}

.backup-list { padding: 0; overflow: hidden; }
.backup-section-title {
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--color-border);
}
.backup-section-title > div { gap: 0.75rem; }
.backup-section-title h3 { margin: 0; }
.backup-list .table-scroll { overflow-x: auto; }
.backup-table { margin: 0; min-width: 820px; }
.backup-table td { vertical-align: middle; }
.backup-table .actions { white-space: nowrap; }
.backup-download { display: inline-flex; text-decoration: none; }

.backup-scope,
.backup-storage {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.02em;
}
.backup-scope.tenant { color: #7dd3fc; background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.2); }
.backup-scope.database { color: #c4b5fd; background: rgba(139, 92, 246, 0.1); border: 1px solid rgba(139, 92, 246, 0.2); }
.backup-storage { color: var(--color-text-dim); background: rgba(255,255,255,0.035); border: 1px solid var(--color-border); }
.backup-storage span { width: 6px; height: 6px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 8px var(--color-primary); }

.backup-guardrail {
    align-items: flex-start;
    gap: 0.85rem;
    margin-top: 0.8rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: var(--radius-md);
    background: linear-gradient(110deg, rgba(251,191,36,0.09), rgba(251,191,36,0.025));
}
.backup-guardrail-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(251, 191, 36, 0.15);
    color: var(--backup-amber);
    font-weight: 900;
}
.backup-guardrail p { margin: 0.3rem 0 0; color: var(--color-text-dim); line-height: 1.55; }

@media (max-width: 1180px) {
    .backup-console { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}

@media (max-width: 760px) {
    .backup-titlebar,
    .backup-create { align-items: stretch; flex-direction: column; }
    .backup-title-actions,
    .backup-create-actions { width: 100%; min-width: 0; }
    .backup-title-actions .btn,
    .backup-create-actions .btn { flex: 1; }
    .backup-console { grid-template-columns: 1fr; }
    .backup-create-actions { flex-wrap: wrap; }
    .backup-create-actions select { min-width: 100%; }
    .backup-section-title { align-items: flex-start; flex-direction: column; }
}

/* Sidebar Styles */
.sidebar {
    background: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-border);
    padding: 1.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    /* The nav scrolls on its own (min-height:0 below). This is the fallback for a
       viewport so short that the brand and the footer alone do not fit, where
       there is no nav left to give up: the whole column scrolls rather than
       clipping the last button. */
    overflow-y: auto;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 0 12px var(--color-primary-glow);
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #fff 30%, var(--color-text-dim));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    overflow-y: auto;
    /* Without this the overflow-y above does nothing. A flex item defaults to
       min-height:auto, which refuses to shrink below its content, so the nav grew
       past the sidebar instead of scrolling inside it — and body{overflow:hidden}
       then simply cut it off. On a laptop screen that hid everything from RKSV
       downwards, including Logout, with no way to reach it. */
    min-height: 0;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    padding: 0.7rem 0.85rem;
    min-height: 42px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-dim);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    width: 100%;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text);
    transform: translateX(3px);
}

.nav-btn.active {
    background: var(--color-primary-glow);
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.15);
}

.nav-icon {
    flex-shrink: 0;
    stroke: var(--color-text-dim);
    transition: stroke 0.2s ease;
}

.nav-btn:hover .nav-icon {
    stroke: var(--color-text);
}

.nav-btn.active .nav-icon {
    stroke: var(--color-primary);
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-top: 1px solid var(--color-border);
    padding-top: 1.25rem;
}

.sidebar-footer .btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    min-height: 38px;
    gap: 0.5rem;
}

.btn-icon {
    flex-shrink: 0;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: rgba(239, 68, 68, 0.9);
}

.btn-danger-outline:hover {
    background: var(--color-danger-glow);
    border-color: var(--color-danger);
    color: #fff;
}

/* Content Area */
.content {
    overflow-y: auto;
    padding: 2.25rem;
    background: var(--color-bg);
}

/* View Sections and Transitions */
.view {
    display: none;
    animation: fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.view.active {
    display: block;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view h2 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

/* stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.card.stat {
    background: linear-gradient(135deg, var(--color-surface), rgba(24, 28, 38, 0.7));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-hover);
}

.card.stat .muted {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card.stat .mono {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.025em;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td {
    padding: 0.9rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.88rem;
}

.data-table th {
    background: rgba(34, 40, 54, 0.45);
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    color: var(--color-text-dim);
    word-break: break-word;
    max-width: 250px; /* Restrict width to support wrapping / ellipsis and prevent blowout */
}

/* Numeric / identifier cells must never wrap mid-token: the td word-break above
   would otherwise happily split "2510" into "25 10" or "10.00" into "10.0 0"
   (and "20 %" onto two lines). .num marks id/price/rate/count/hash cells. */
.data-table .num {
    white-space: nowrap;
}

.data-table tr {
    transition: all 0.15s ease;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

.data-table tr:hover td {
    color: var(--color-text);
}

.data-table tr:last-child td {
    border-bottom: none;
}

tr.row-inactive {
    opacity: 0.45;
}

tr.row-inactive td:nth-child(2) {
    text-decoration: line-through;
}

/* Toolbars */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    gap: 1.25rem;
    margin: 1.25rem 0 0.5rem;
    box-shadow: var(--shadow-sm);
}

.inline-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--color-text);
    font-weight: 500;
}

.inline-field input {
    min-height: 38px;
    padding: 0.4rem 0.75rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.inline-field input:focus {
    outline: none;
    border-color: var(--color-info);
    box-shadow: 0 0 0 3px var(--color-info-glow);
}

/* Buttons Styling */
.btn {
    min-height: 40px;
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    background: var(--color-border-hover);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--color-primary-strong);
    color: #fff;
    box-shadow: 0 2px 8px var(--color-primary-glow);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

/* Fiscal actions (Nullbeleg / daily + monthly closing) sign a permanent,
   irreversible RKSV Beleg. A caution outline keeps them from reading like the
   harmless CSV export sitting right next to them. */
.btn-fiscal {
    background: transparent;
    border: 1px solid rgba(212, 160, 23, 0.4);
    color: #e0b23c;
    box-shadow: none;
}

.btn-fiscal:hover {
    background: rgba(212, 160, 23, 0.12);
    border-color: var(--color-warn, #d4a017);
    color: #f0c657;
}

/* Keyboard focus ring — matches the accent focus used on inputs so tabbing
   through nav/buttons stays visible (the design otherwise removed outlines). */
.btn:focus-visible,
.btn-sm:focus-visible,
.nav-btn:focus-visible,
.preset-chip:focus-visible,
.chip:focus-visible {
    outline: 2px solid var(--color-info);
    outline-offset: 2px;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    color: var(--color-text);
    font-size: 0.8rem;
    font-weight: 500;
    min-height: 32px;
    transition: all 0.15s ease;
}

.btn-sm:hover {
    background: var(--color-surface-3);
    border-color: var(--color-border-hover);
    color: var(--color-text);
}

/* Destructive compact actions need to read as destructive at rest, not only
   after hover. The two-class selector deliberately wins over the generic
   .btn-sm surface declared above. */
.btn-sm.btn-danger {
    background: var(--color-danger-strong);
    border-color: var(--color-danger-strong);
    color: #fff;
    box-shadow: 0 5px 14px rgba(185, 28, 28, 0.2);
}

.btn-sm.btn-danger:hover {
    background: var(--color-danger-dim);
    border-color: var(--color-danger-dim);
    color: #fff;
}

/* Reservation badges — the .badge shell lives in base.css now; these status
   variants (used verbatim by admin.js: `badge badge-${status}`) map onto the
   shared status palette so their colours stay in lockstep with every app. */
.badge-booked {
    background: var(--status-info-bg);
    color: var(--status-info);
    border: 1px solid var(--status-info-border);
}

.badge-seated {
    background: var(--status-success-bg);
    color: var(--status-success);
    border: 1px solid var(--status-success-border);
}

.badge-done {
    background: var(--status-neutral-bg);
    color: var(--status-neutral);
    border: 1px solid var(--status-neutral-border);
}

.badge-cancelled,
.badge-no_show {
    background: var(--status-danger-bg);
    color: var(--status-danger);
    border: 1px solid var(--status-danger-border);
}

/* Reports workspace — a dense operating ledger. Reports intentionally uses
   fewer, tighter cards than the dashboard so a manager can reconcile a period
   without scrolling through oversized decorative metrics. */
.view.reports-view {
    --report-positive: var(--color-primary);
    --report-negative: var(--status-danger);
    --report-warn: var(--status-warn);
    min-width: 0;
    overflow-x: clip;
}

.report-titlebar,
.report-filter-row,
.report-card-head,
.report-section-head,
.report-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.report-titlebar { align-items: end; margin-bottom: 1rem; }
.report-titlebar h2 { margin: 0.15rem 0 0.25rem; }
.report-titlebar p { margin: 0; max-width: 760px; }
.report-export { flex: 0 0 auto; }

.report-eyebrow,
.report-kicker {
    display: block;
    color: var(--color-primary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 750;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.report-filter-card {
    padding: 0.8rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: linear-gradient(110deg, var(--color-primary-glow), transparent 40%), var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.report-filter-card .preset-chips { margin: 0 0 0.7rem; }
.report-filter-row { justify-content: flex-start; flex-wrap: wrap; }
.report-filter-row .inline-field input { color-scheme: dark; }
.report-status { min-height: 1.25rem; color: var(--color-text-dim); font-size: var(--text-sm); }
.report-status.is-error { color: var(--status-danger); }

.report-tabs {
    position: relative;
    display: flex;
    gap: 0;
    margin: 1rem 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--color-border-hover);
    scrollbar-width: none;
}
.report-tabs::-webkit-scrollbar { display: none; }
.report-tab {
    position: relative;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.7rem 1rem;
    border: 0;
    background: transparent;
    color: var(--color-text-dim);
    font-size: var(--text-base);
    font-weight: 650;
}
.report-tab::after {
    content: '';
    position: absolute;
    inset: auto 0 -1px;
    height: 2px;
    background: transparent;
}
.report-tab:hover { color: var(--color-text); }
.report-tab.active { color: var(--color-primary); }
.report-tab.active::after { background: var(--color-primary); box-shadow: 0 0 12px var(--color-primary); }
.report-tab:focus-visible,
.report-segmented button:focus-visible,
.report-category-row:focus-visible,
.report-chart-point:focus-visible,
.report-sort-button:focus-visible,
.report-drawer-close:focus-visible {
    outline: 2px solid var(--color-info);
    outline-offset: 2px;
}

.report-panel[hidden] { display: none; }
.report-panel-state,
.report-inline-state {
    min-height: 0;
    color: var(--color-text-dim);
    font-size: var(--text-sm);
}
.report-panel-state:not(:empty),
.report-inline-state:not(:empty) { padding: 0.75rem 0; }
.report-panel-state.is-error,
.report-inline-state.is-error { color: var(--status-danger); }

.report-kpi-rail {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.8rem;
}
.report-kpi {
    min-width: 0;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--color-border);
    border-top-color: var(--status-success-border);
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, rgba(255,255,255,0.025), transparent 60%), var(--color-surface);
    box-shadow: var(--shadow-sm);
}
.report-kpi > span {
    display: block;
    min-height: 2.2em;
    color: var(--color-text-dim);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.055em;
    line-height: 1.25;
    text-transform: uppercase;
}
.report-kpi strong {
    display: block;
    margin-top: 0.35rem;
    overflow: hidden;
    color: var(--color-text);
    font-size: clamp(1.05rem, 1.5vw, 1.45rem);
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.report-kpi small { display: block; margin-top: 0.25rem; color: var(--color-text-dim); }
.report-kpi-danger { border-top-color: var(--status-danger-border); }
.report-kpi-danger strong, .report-kpi-danger small { color: var(--status-danger); }
.report-kpi-warn { border-top-color: var(--status-warn-border); }
.report-kpi-warn strong { color: var(--status-warn); }
.report-finance-kpis { grid-template-columns: repeat(7, minmax(0, 1fr)); }

.report-card {
    min-width: 0;
    padding: 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}
.report-card-head { align-items: end; }
.report-card-head h3,
.report-section-head h3 { margin: 0.15rem 0 0; font-size: 1rem; }
.report-card-head > h3 { margin: 0; }

.report-trend-card {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px),
        var(--color-surface);
    background-size: 28px 28px, 28px 28px, auto;
}
.report-chart-legend { display: flex; flex-wrap: wrap; gap: 0.8rem; color: var(--color-text-dim); font-size: var(--text-xs); }
.report-chart-legend span::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 0.35rem; border-radius: 50%; background: currentColor; }
.report-chart-legend .positive { color: var(--report-positive); }
.report-chart-legend .negative { color: var(--report-negative); }
.report-chart-legend .annotation { color: var(--status-warn); }
.report-chart-legend .info { color: var(--status-info); }
.report-chart-legend .warn { color: var(--status-warn); }
.report-card-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.75rem; }
.report-chart-shell { position: relative; min-height: 280px; margin-top: 0.45rem; overflow-x: auto; overflow-y: hidden; }
.report-chart-shell > svg { display: block; min-width: 620px; width: 100%; height: 286px; overflow: visible; }
.report-chart-grid { stroke: var(--color-border-hover); stroke-width: 1; vector-effect: non-scaling-stroke; }
.report-chart-zero { stroke: var(--color-text-dim); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.report-chart-area-positive { fill: url(#report-positive-gradient); }
.report-chart-area-negative { fill: url(#report-negative-gradient); }
.report-chart-line-positive { fill: none; stroke: var(--report-positive); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.report-chart-line-negative { fill: none; stroke: var(--report-negative); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.report-chart-point { cursor: pointer; color: var(--report-positive); }
.report-chart-point.is-negative { color: var(--report-negative); }
.report-chart-point-hit { fill: transparent; }
.report-chart-point-dot { fill: currentColor; stroke: var(--color-surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.report-chart-point:hover .report-chart-point-dot,
.report-chart-point:focus .report-chart-point-dot { stroke: var(--color-text); stroke-width: 3; }
.report-chart-label { fill: var(--color-text-dim); font-family: var(--font-mono); font-size: 10px; }
.report-annotation-marker { fill: var(--status-warn); stroke: var(--color-surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.report-chart-tooltip {
    position: fixed;
    z-index: 12000;
    width: min(270px, calc(100vw - 24px));
    padding: 0.72rem 0.8rem;
    pointer-events: none;
    border: 1px solid var(--color-border-hover);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    background: rgba(16, 20, 29, 0.97);
    box-shadow: var(--shadow-md);
    color: var(--color-text);
    font-size: var(--text-xs);
}
.report-chart-tooltip.is-negative { border-left-color: var(--status-danger); }
.report-chart-tooltip strong { display: block; margin-bottom: 0.4rem; font-size: var(--text-sm); }
.report-tooltip-grid { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.7rem; }
.report-tooltip-grid span:nth-child(even) { font-family: var(--font-mono); text-align: right; }

.report-annotations-card { margin-top: 0.8rem; }
.report-annotation-list { display: grid; gap: 0.45rem; margin-top: 0.6rem; }
.report-annotation-row {
    display: grid;
    grid-template-columns: 7rem 6.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    min-height: 42px;
    padding: 0.45rem 0.55rem;
    border-top: 1px solid var(--color-border);
}
.report-annotation-row:first-child { border-top: 0; }
.report-annotation-date { font-family: var(--font-mono); color: var(--color-text-dim); }
.report-annotation-type,
.report-event-type {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: 0.18rem 0.5rem;
    border: 1px solid var(--status-info-border);
    border-radius: 999px;
    background: var(--status-info-bg);
    color: var(--status-info);
    font-size: var(--text-xs);
    font-weight: 700;
}
.report-annotation-type[data-type="holiday"], .report-annotation-type[data-type="closure"] { border-color: var(--status-warn-border); background: var(--status-warn-bg); color: var(--status-warn); }
.report-annotation-type[data-type="weather"] { border-color: var(--color-border-hover); background: var(--color-surface-2); color: var(--color-text-dim); }
.report-annotation-copy { min-width: 0; }
.report-annotation-copy strong, .report-annotation-copy span { display: block; overflow-wrap: anywhere; }
.report-annotation-copy span { margin-top: 0.1rem; color: var(--color-text-dim); font-size: var(--text-xs); }
.report-annotation-actions { display: flex; gap: 0.35rem; }

.report-summary-grid,
.report-finance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; margin-top: 0.8rem; }
.report-table { margin-top: 0.6rem; box-shadow: none; }
.report-table th, .report-table td { padding: 0.62rem 0.72rem; }
.report-table th:not(:first-child), .report-table td:not(:first-child) { text-align: right; }
.report-table tbody .empty-cta { padding: 1.1rem; }
.report-table .is-negative { color: var(--status-danger); }

.report-section-head { align-items: end; margin-bottom: 0.8rem; }
.report-segmented { display: inline-flex; padding: 3px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }
.report-segmented button { min-height: 38px; padding: 0.4rem 0.75rem; border: 0; border-radius: calc(var(--radius-sm) - 3px); background: transparent; color: var(--color-text-dim); font-size: var(--text-sm); font-weight: 650; }
.report-segmented button[aria-checked="true"] { background: var(--color-primary-strong); color: #fff; box-shadow: var(--shadow-sm); }
.report-notice { margin-bottom: 0.8rem; padding: 0.65rem 0.8rem; border: 1px solid var(--status-warn-border); border-radius: var(--radius-sm); background: var(--status-warn-bg); color: var(--status-warn); font-size: var(--text-sm); }
.report-operations-grid { display: grid; grid-template-columns: minmax(230px, 0.32fr) minmax(0, 1fr); gap: 0.8rem; }
.report-category-list { display: grid; gap: 0.45rem; margin-top: 0.7rem; }
.report-category-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.6rem; width: 100%; min-height: 48px; padding: 0.45rem 0.5rem; overflow: hidden; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--color-surface-2); color: var(--color-text); text-align: left; }
.report-category-row::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--share, 0%); background: linear-gradient(90deg, var(--color-primary-glow), transparent); pointer-events: none; }
.report-category-row > * { position: relative; }
/* Long unbreakable category names (no spaces to wrap at) otherwise overflow
   their grid track and paint underneath the right-aligned amount. Truncate
   with an ellipsis; the row is a filter button whose full name is still in
   the accessible DOM and in the detail panel once selected. */
.report-category-row > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-category-row:hover, .report-category-row.active { border-color: var(--status-success-border); }
.report-category-row.active { box-shadow: inset 3px 0 var(--color-primary); }
.report-category-row small { grid-column: 1 / -1; color: var(--color-text-dim); }
.report-count { color: var(--color-text-dim); }
.report-product-scroll { max-height: 620px; }
.report-product-table { min-width: 940px; }
.report-product-table thead { position: sticky; top: 0; z-index: 3; }
.report-product-table th:first-child, .report-product-table td:first-child { position: sticky; left: 0; z-index: 2; background: var(--color-surface); }
.report-product-table th:first-child { z-index: 4; background: #202532; }
.report-product-table th button { width: 100%; min-height: 44px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: inherit; text-transform: inherit; }
.report-product-table th:not(:first-child) button { text-align: right; }
.report-product-table th[aria-sort="ascending"] button::after { content: ' ↑'; color: var(--color-primary); }
.report-product-table th[aria-sort="descending"] button::after { content: ' ↓'; color: var(--color-primary); }
.report-product-table td.is-emphasis { color: var(--color-primary); font-weight: 750; }
.report-legacy-badge { margin-left: 0.35rem; color: var(--status-warn); font-size: 0.65rem; vertical-align: super; }

.report-aging { display: grid; gap: 0.65rem; margin-top: 0.8rem; }
.report-aging-row { display: grid; grid-template-columns: 4rem minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; }
.report-aging-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--color-surface-3); }
.report-aging-fill { height: 100%; border-radius: inherit; background: var(--status-warn); }
.report-account-trend-card, .report-timeline-card { margin-top: 0.8rem; }
.report-link { color: var(--color-text); text-decoration: none; }
.report-account-trend { min-height: 130px; margin-top: 0.7rem; overflow-x: auto; }
.report-account-trend svg { display: block; min-width: 620px; width: 100%; height: 176px; }
.report-account-hit { fill: transparent; }
.report-account-day { cursor: crosshair; }
.report-account-day:focus { outline: none; }
.report-account-day:focus .report-account-hit { fill: var(--color-primary-glow); }
.report-account-detail { position: sticky; left: 0; width: fit-content; max-width: 100%; min-height: 1.5rem; margin: 0.25rem 0 0; color: var(--color-text-dim); font-size: var(--text-xs); white-space: normal; }
.report-account-bar-transfer { fill: var(--status-info); opacity: 0.72; }
.report-account-bar-settled { fill: var(--color-primary); opacity: 0.72; }
.report-account-bar-reopened { fill: var(--status-danger); opacity: 0.72; }
.report-account-balance { fill: none; stroke: var(--status-warn); stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.report-boundary-note { margin: 0.6rem 0 0; padding: 0.55rem 0.7rem; border-left: 3px solid var(--status-warn); background: var(--status-warn-bg); color: var(--color-text-dim); font-size: var(--text-sm); }
.report-timeline { display: grid; gap: 0; margin-top: 0.8rem; }
.report-timeline-row { position: relative; display: grid; grid-template-columns: 9rem 7rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; min-height: 54px; padding: 0.55rem 0.4rem 0.55rem 1.1rem; border-top: 1px solid var(--color-border); }
.report-timeline-row::before { content: ''; position: absolute; left: 0.25rem; width: 7px; height: 7px; border-radius: 50%; background: var(--status-info); box-shadow: 0 0 0 4px var(--status-info-bg); }
.report-timeline-row[data-event="settled"]::before, .report-timeline-row[data-event="settlement"]::before { background: var(--color-primary); box-shadow: 0 0 0 4px var(--color-primary-glow); }
.report-timeline-row[data-event="reopened"]::before, .report-timeline-row[data-event="storno"]::before { background: var(--status-danger); box-shadow: 0 0 0 4px var(--status-danger-bg); }
.report-timeline-meta { color: var(--color-text-dim); font-size: var(--text-xs); overflow-wrap: anywhere; }

.report-day-layer { position: fixed; inset: 0; z-index: 9000; background: rgba(3, 6, 11, 0.62); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.18s ease; }
.report-day-layer[hidden] { display: none; }
.report-day-layer.open { opacity: 1; }
.report-day-drawer { position: absolute; inset: 0 0 0 auto; display: flex; flex-direction: column; width: min(510px, 94vw); padding: 1rem; overflow-y: auto; border-left: 1px solid var(--color-border-hover); background: var(--color-bg); box-shadow: -18px 0 48px rgba(0,0,0,0.48); transform: translateX(100%); transition: transform 0.22s cubic-bezier(0.2,0.8,0.2,1); }
.report-day-layer.open .report-day-drawer { transform: none; }
body.report-drawer-open { overflow: hidden; }
.content.report-scroll-locked { overflow: hidden; }
.report-drawer-head { position: sticky; top: -1rem; z-index: 4; margin: -1rem -1rem 0.8rem; padding: 1rem; border-bottom: 1px solid var(--color-border); background: rgba(11,14,20,0.96); backdrop-filter: blur(12px); }
.report-drawer-head h3 { margin: 0.15rem 0 0; }
.report-drawer-close { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid var(--color-border); border-radius: 50%; background: var(--color-surface); color: var(--color-text); font-size: 1.5rem; }
.report-day-content { display: grid; gap: 0.8rem; }
.report-day-kpis { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.5rem; }
.report-day-section { padding: 0.8rem; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.report-day-section h4 { margin: 0 0 0.55rem; }
.report-day-list { display: grid; gap: 0.4rem; }
.report-day-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 0.65rem; padding: 0.5rem 0; border-top: 1px solid var(--color-border); }
.report-day-row:first-child { border-top: 0; }
.report-day-row > span:last-child { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.report-day-more { width: 100%; margin-top: 0.8rem; }

@media (max-width: 1320px) {
    .report-kpi-rail, .report-finance-kpis { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1080px) {
    .report-operations-grid { grid-template-columns: 1fr; }
    .report-category-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .report-finance-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .view.reports-view { overflow-x: clip; }
    .report-titlebar, .report-section-head, .report-card-head { align-items: stretch; flex-direction: column; }
    .report-export { width: 100%; }
    .report-filter-row { align-items: stretch; flex-direction: column; }
    .report-filter-row .inline-field { align-items: stretch; flex-direction: column; }
    .report-filter-row .inline-field input, .report-filter-row .btn { width: 100%; min-height: 44px; }
    .report-tabs { margin-inline: -0.25rem; padding-inline: 0.25rem; mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
    .report-kpi-rail, .report-finance-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .report-summary-grid { grid-template-columns: 1fr; }
    .report-category-list { grid-template-columns: 1fr; }
    .report-annotation-row { grid-template-columns: 1fr auto; }
    .report-annotation-date, .report-annotation-type { grid-column: 1; }
    .report-annotation-copy { grid-column: 1 / -1; }
    .report-annotation-actions { grid-column: 2; grid-row: 1 / span 2; }
    .report-timeline-row { grid-template-columns: 1fr auto; }
    .report-timeline-row > :nth-child(2), .report-timeline-row > :nth-child(3) { grid-column: 1; }
    .report-timeline-row > :last-child { grid-column: 2; grid-row: 1; }
    .report-day-layer { display: flex; align-items: flex-end; }
    .report-day-drawer { position: relative; inset: auto; width: 100%; height: min(94dvh, 900px); border: 1px solid var(--color-border-hover); border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; transform: translateY(100%); }
}
@media (max-width: 440px) {
    .report-kpi-rail, .report-finance-kpis, .report-day-kpis { grid-template-columns: 1fr; }
    .report-kpi > span { min-height: 0; }
    .report-segmented { display: grid; width: 100%; }
    .report-day-row { grid-template-columns: minmax(0, 1fr) auto; }
    .report-day-row time { grid-column: 1; color: var(--color-text-dim); font-size: var(--text-xs); }
    .report-day-row > span:nth-of-type(1) { grid-column: 1; overflow-wrap: anywhere; }
    .report-day-row > span:last-child { grid-column: 2; grid-row: 1 / span 2; }
    .report-day-row > button { grid-column: 1 / -1; width: 100%; }
    .report-day-row.is-annotation { grid-template-columns: 1fr; }
    .report-day-row.is-annotation > span { grid-column: 1; grid-row: auto; text-align: left; white-space: normal; }
}

/* Compliance View */
.compliance-actions {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    align-items: end;
    box-shadow: var(--shadow-sm);
}

.compliance-actions label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.compliance-actions select,
.compliance-actions input {
    min-height: 40px;
    padding: 0.4rem 0.75rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.compliance-actions select:focus,
.compliance-actions input:focus {
    outline: none;
    border-color: var(--color-info);
    box-shadow: 0 0 0 3px var(--color-info-glow);
}

.compliance-actions button {
    grid-column: span 1;
    min-height: 40px;
}

/* ---------------------------------------------------------------------------
   Mobile / narrow screens styling collapse
   --------------------------------------------------------------------------- */
@media (max-width: 900px) {
    body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: 0.75rem 1rem;
        gap: 0.75rem;
        align-items: center;
    }

    .brand-container {
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .sidebar-footer {
        order: 1;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        flex-direction: row;
        gap: 0.4rem;
    }

    .sidebar-footer .btn {
        min-height: 36px;
        padding: 0.4rem 0.75rem;
    }

    .nav {
        order: 2;
        flex-basis: 100%;
        flex-direction: row;
        overflow-x: auto;
        gap: 0.35rem;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    /* Flatten the nav groups into the scroll strip: as block boxes each group
       stacked its buttons vertically, so the "horizontal" nav grew ~700px tall
       above the content and the Platform group was clipped with no way to reach
       it. display:contents makes the group's children direct flex items of the
       strip — one compact row of buttons, scrolled sideways (the mask fade on
       .nav above is the scroll affordance). Group labels go: there is no row
       for them in a single-line strip. */
    .nav-group {
        display: contents;
    }

    .nav-group-label {
        display: none;
    }

    .nav-btn {
        flex: 0 0 auto;
        /* The base rule sets width:100% for the vertical sidebar; without this
           reset every flattened button claims the full strip width and only one
           button is visible at a time in the horizontal scroll row. */
        width: auto;
        white-space: nowrap;
        padding: 0.5rem 0.85rem;
        min-height: 38px;
    }

    .nav-btn:hover {
        transform: none;
    }

    .content {
        padding: 1.25rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .view {
        overflow-x: auto;
    }

    .data-table {
        min-width: 650px;
    }
}

/* ===========================================================================
   Admin component library — shared token-driven building blocks used by the
   dashboard onboarding, reports and menu views. Card language: subtle border,
   12px radii, shadow-sm.
   =========================================================================== */

/* Onboarding / setup checklist (shown on an unconfigured dashboard) */
.setup-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.setup-card h3 {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--color-text);
}

.setup-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    font-size: var(--text-base);
    color: var(--color-text-dim);
}

.setup-step::before {
    content: '';
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--color-border-hover);
    background: transparent;
    transition: all 0.2s ease;
}

.setup-step.done {
    color: var(--color-text);
    background: var(--status-success-bg);
    border-color: var(--status-success-border);
}

.setup-step.done::before {
    border-color: var(--color-primary);
    background: var(--color-primary);
    box-shadow: inset 0 0 0 3px var(--color-surface);
}

.setup-step.pending {
    color: var(--color-text-dim);
}

/* Status lights (dashboard compliance / health). Single element: dot + label.
   NOTE: the .compliance-lights container rule lives further down (search
   "compliance-lights") next to .compliance-row, which is what #dash-compliance
   actually renders; a duplicate wrap-layout rule that used to sit here was dead
   (always overridden by that later definition) and has been removed. */

.status-light {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-dim);
}

.status-light::before {
    content: '';
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-text-dim);
}

.status-light.ok {
    color: var(--color-text);
}

.status-light.ok::before {
    background: var(--status-success);
    box-shadow: 0 0 0 3px var(--status-success-bg);
}

.status-light.warn {
    color: var(--status-warn);
}

.status-light.warn::before {
    background: var(--status-warn);
    box-shadow: 0 0 0 3px var(--status-warn-bg);
}

.status-light.bad {
    color: var(--status-danger);
}

.status-light.bad::before {
    background: var(--status-danger);
    box-shadow: 0 0 0 3px var(--status-danger-bg);
}

/* Preset chips (report / DEP-7 date presets). `.chip`/`.chip-row` are aliased so
   the current markup renders identically before the .preset-chip migration. */
.preset-chips,
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 0.25rem;
}

.preset-chip,
.chip {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    background: var(--color-surface-2);
    color: var(--color-text-dim);
    font-size: var(--text-sm);
    font-weight: 600;
    min-height: 32px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.preset-chip:hover,
.chip:hover {
    background: var(--color-surface-3);
    border-color: var(--color-border-hover);
    color: var(--color-text);
}

.preset-chip.active,
.chip.active,
.preset-chip[aria-pressed="true"],
.chip[aria-pressed="true"] {
    background: var(--color-primary-glow);
    border-color: var(--status-success-border);
    color: var(--color-primary);
}

/* VAT split table — compact, right-aligned numeric variant of the data table */
.vat-split-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-size: var(--text-base);
}

.vat-split-table th,
.vat-split-table td {
    padding: 0.7rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--color-border);
}

.vat-split-table th:first-child,
.vat-split-table td:first-child {
    text-align: left;
}

.vat-split-table th {
    background: rgba(34, 40, 54, 0.45);
    color: var(--color-text);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vat-split-table td {
    color: var(--color-text-dim);
    font-variant-numeric: tabular-nums;
}

.vat-split-table tr:last-child td {
    border-bottom: none;
}

.vat-split-table tfoot td {
    color: var(--color-text);
    font-weight: 700;
    border-top: 1px solid var(--color-border-hover);
}

/* Inline SVG chart — scales to its container, draws in currentColor */
.chart-svg {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    color: var(--color-primary);
    overflow: visible;
}

.chart-svg text {
    fill: var(--color-text-dim);
    font-size: var(--text-xs);
}

/* Empty-state call to action — centred hint with an action button */
.empty-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    text-align: center;
    padding: 2.5rem 1.5rem;
    margin-top: 1.25rem;
    color: var(--color-text-dim);
    background: var(--color-surface);
    border: 1px dashed var(--color-border-hover);
    border-radius: var(--radius-md);
}

.empty-cta p {
    margin: 0;
    max-width: 42ch;
    font-size: var(--text-base);
}

.empty-cta .btn {
    margin-top: 0.25rem;
}

/* Category sub-panel nested inside the Menu view */
.cat-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-top: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.cat-panel h3 {
    font-size: var(--text-md);
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

/* Honour reduced-motion: the admin view leans on fade-ins, nav slides and card
   lift transforms — strip them for users who ask for less movement. */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .view {
        animation: none;
    }

    .nav-btn:hover,
    .card.stat:hover,
    .btn:hover,
    .btn:active,
    .btn-sm:hover {
        transform: none;
    }
}

/* ---------------------------------------------------------------------------
   Reconciliation: late-added admin.js components beyond the design contract —
   menu subtabs, bulk bar, availability toggle, compliance lamps, and the
   Belegart badge variants (on the shared .badge base from base.css).
   --------------------------------------------------------------------------- */
.subtabs { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }

.subtab {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-dim);
    cursor: pointer;
    font-size: var(--text-sm, 0.85rem);
}

.subtab.active {
    color: #fff;
    background: var(--color-primary-strong);
    border-color: var(--color-primary-strong);
}

.subtab:focus-visible { outline: 2px solid var(--color-info); outline-offset: 2px; }

.bulk-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.table-select-cell {
    width: 42px;
    text-align: center;
}

.table-select-cell input { width: 1rem; height: 1rem; accent-color: var(--color-primary); }

/* A class-level display rule beats the UA [hidden] rule (author styles win over
   the user-agent sheet regardless of specificity), so every component that sets
   display AND carries the hidden attribute must re-assert the hiding:
   - .setup-card/#dash-setup: rendered as an empty accent bar above the stat cards
   - .btn/#restaurant-switch + #audit-more: ghost buttons
   - .nav-btn: role-limited nav items (applyPermissions hides them via .hidden)
   - .nav-group/.nav-superadmin: the mobile nav flattens groups with
     display:contents (below), which would also un-hide the Platform group
   - images with display:block: broken-image ghosts */
.bulk-bar[hidden],
.setup-card[hidden],
.btn[hidden],
.nav-btn[hidden],
.nav-group[hidden],
.bon-logo-img[hidden],
.enroll-qr img[hidden] { display: none; }

.avail-toggle {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: transparent;
    cursor: pointer;
    font-size: var(--text-xs, 0.72rem);
}

.avail-toggle.on,
.avail-toggle.ok {
    color: var(--status-success);
    border-color: var(--status-success-border);
    background: var(--status-success-bg);
}

.avail-toggle.off,
.avail-toggle.bad {
    color: var(--status-danger);
    border-color: var(--status-danger-border);
    background: var(--status-danger-bg);
}

/* The dashboard compliance widget (#dash-compliance): one .compliance-row per
   register, stacked vertically. This is the single source of truth for the
   .compliance-lights container (a duplicate wrap rule up in the status-light
   section was removed). margin-top preserves the spacing that rule provided. */
.compliance-lights { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 1.5rem; }

.compliance-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: var(--text-sm, 0.85rem);
}

.compliance-reg { font-weight: 600; min-width: 8rem; }

/* Belegart badges (shared .badge base lives in base.css) */
.badge-beleg { color: var(--status-success); border-color: var(--status-success-border); background: var(--status-success-bg); }
.badge-storno { color: var(--status-danger); border-color: var(--status-danger-border); background: var(--status-danger-bg); }
.badge-start,
.badge-stop { color: var(--status-info); border-color: var(--status-info-border); background: var(--status-info-bg); }
.badge-month,
.badge-year { color: var(--status-warn); border-color: var(--status-warn-border); background: var(--status-warn-bg); }
.badge-null { color: var(--status-neutral); border-color: var(--status-neutral-border); background: var(--status-neutral-bg); }

/* ===========================================================================
   Feature expansion (v0.1.3): allergen matrix, staff, reprint queue, system
   health, QR self-order, audit filters, manager role gating.
   =========================================================================== */

/* --- Manager role gating (#19): hide config-only controls --- */
body.role-limited [data-config-only] { display: none !important; }

/* --- Allergen matrix (#5) --- */
.matrix-scroll { overflow-x: auto; }
.allergen-matrix th.allergen-col {
    writing-mode: vertical-rl;
    text-align: left;
    white-space: nowrap;
    font-size: 0.72rem;
    padding: 0.35rem 0.2rem;
    color: var(--color-text-dim);
}
.allergen-matrix td.allergen-cell { text-align: center; color: var(--color-border-hover); }
.allergen-matrix td.allergen-cell.on { color: var(--status-danger); font-weight: 700; }
.link-btn {
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--color-primary); font: inherit; text-align: left;
}
.link-btn:hover { text-decoration: underline; }

/* Row action groups (Edit / Duplicate / Deactivate …): without a wrapper the
   buttons broke at the literal space between them, so Deactivate wrapped alone
   onto a second line and row heights went uneven. One inline-flex group with
   flex-wrap keeps the wrap points consistent and the gap uniform. */
.row-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* --- QR self-order cells (#23/#24) --- */
.qr-on {
    display: inline-block; font-size: 0.72rem; font-weight: 700;
    color: var(--status-success); border: 1px solid var(--status-success-border);
    background: var(--status-success-bg); border-radius: 999px; padding: 0.05rem 0.5rem;
    margin-right: 0.3rem; vertical-align: middle;
}

/* --- System health (#88) --- */
.health-badge.ok { color: var(--status-success); }
.health-badge.bad { color: var(--status-danger); }

/* --- Reprint queue (#71) --- */
tr.row-danger td { background: var(--status-danger-bg); }
.print-status {
    display: inline-block; font-size: 0.72rem; font-weight: 700;
    border-radius: 999px; padding: 0.05rem 0.5rem; border: 1px solid transparent;
}
.print-status.printed { color: var(--status-success); border-color: var(--status-success-border); background: var(--status-success-bg); }
.print-status.queued  { color: var(--status-warn);    border-color: var(--status-warn-border);    background: var(--status-warn-bg); }
.print-status.failed  { color: var(--status-danger);  border-color: var(--status-danger-border);  background: var(--status-danger-bg); }

/* --- Device enrollment (#013) --- */
.enroll-panel {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-start;
    margin: 1rem 0 1.75rem;
}
.enroll-qr {
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    min-width: 240px;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}
.enroll-qr img { display: block; width: 240px; height: 240px; }
.enroll-meta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    flex: 1;
    min-width: 240px;
}
.enroll-meta input { width: 100%; }
.enroll-meta #enroll-url { word-break: break-all; font-size: var(--text-xs, 0.72rem); }

/* Device inventory (#043) — dense operational rows, with the gold rail reserved
   for the irreversible history boundary. The browser string remains secondary:
   labels and activity are what operators scan during a busy shift. */
.device-section-heading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.4rem;
}
.device-section-heading h3 { margin: 0; }
.device-count {
    display: inline-grid;
    min-width: 1.65rem;
    height: 1.65rem;
    place-items: center;
    border: 1px solid var(--color-border-hover);
    border-radius: 999px;
    background: var(--color-surface-2);
    color: var(--color-text-dim);
    font-size: 0.68rem;
}
.device-table-scroll {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
}
.device-table {
    min-width: 940px;
    margin-top: 0.75rem;
}
.device-table th,
.device-table td { padding: 0.72rem 0.85rem; vertical-align: middle; }
.device-table td:first-child { min-width: 175px; }
.device-table td:nth-child(2) { min-width: 180px; }
.device-identity,
.device-activity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.28rem;
}
.device-identity strong { color: var(--color-text); font-weight: 700; }
.device-id {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    color: var(--color-text-dim);
    font-size: 0.68rem;
}
.device-environment {
    display: inline-flex;
    max-width: 250px;
    align-items: center;
    gap: 0.28rem;
}
.device-environment > span {
    overflow: hidden;
    color: var(--color-text);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.device-time { color: var(--color-text-dim); font-size: 0.72rem; white-space: nowrap; }
.device-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    max-width: none !important;
    white-space: nowrap;
}
.device-history {
    margin-top: 1.35rem;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-left: 3px solid rgba(232, 180, 74, 0.55);
    border-radius: var(--radius-md);
    background: rgba(24, 28, 38, 0.72);
    box-shadow: var(--shadow-sm);
}
.device-history[hidden] { display: none; }
.device-history > summary {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 0.95rem;
    color: var(--color-text);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    list-style: none;
    text-transform: uppercase;
    transition: background 0.15s ease;
}
.device-history > summary::-webkit-details-marker { display: none; }
.device-history > summary::before {
    content: '›';
    color: var(--color-accent);
    font: 800 1.1rem/1 var(--font-mono);
    transform: rotate(0deg);
    transition: transform 0.15s ease;
}
.device-history[open] > summary::before { transform: rotate(90deg); }
.device-history > summary:hover { background: rgba(255, 255, 255, 0.02); }
.device-history > summary .device-count { margin-left: auto; }
.device-history .device-table-scroll { padding: 0 0.8rem 0.8rem; }
.device-history-table { margin-top: 0; box-shadow: none; }
.device-history-table tbody { opacity: 0.82; }
.device-history-status { padding: 0.2rem 0.95rem 0.85rem; }
.device-history-more { margin: 0 0.8rem 0.9rem; font-size: 0.8rem; }

@media (max-width: 720px) {
    .device-table { min-width: 860px; }
    .device-history { min-width: 0; }
    .device-history .device-table-scroll { padding-inline: 0.55rem; }
}

/* --- Audit filters + load-more (#84) --- */
.audit-filter {
    min-height: 38px; padding: 0.35rem 0.6rem;
    background: var(--color-surface-2, var(--color-surface));
    border: 1px solid var(--color-border); border-radius: var(--radius-sm, 6px);
    color: var(--color-text); font-size: 0.9rem;
}
.audit-filter:focus { outline: 2px solid var(--color-info); outline-offset: -1px; }
.load-more-wrap { display: flex; justify-content: center; margin: 0.9rem 0; }

/* ===========================================================================
   Bon layout editor (admin-bon.js)

   Uses the design tokens from base.css. An earlier version invented its own
   (--surface, --border), which do not exist — every fallback then resolved to a
   LIGHT value, so the editor rendered light text on a white card and the labels
   were invisible against the dark theme.
   =========================================================================== */

.bon-doctypes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin: 0.75rem 0 1rem;
}

.bon-doctype[aria-current="true"],
.bon-doctype[aria-selected="true"],
.bon-doctype.active {
    /* -strong is the fill token whose white text clears AA; --color-primary is
       for text and glow, not fills. */
    background: var(--color-primary-strong);
    border-color: var(--color-primary-dim);
    color: #fff;
}

.bon-doctype { position: relative; }
.bon-doctype.has-draft::after,
.bon-doctype.has-error::after {
    content: "";
    position: absolute;
    top: -0.22rem;
    right: -0.18rem;
    width: 0.52rem;
    height: 0.52rem;
    border: 2px solid var(--color-bg);
    border-radius: 50%;
    background: var(--status-warn);
}
.bon-doctype.has-error::after { background: var(--color-danger); }

.bon-badge {
    margin-left: auto;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: var(--status-warn-bg);
    border: 1px solid var(--status-warn-border);
    color: var(--status-warn);
}

.bon-layout {
    display: grid;
    grid-template-columns: minmax(25rem, 0.85fr) minmax(0, 1.35fr);
    gap: 1.25rem;
    align-items: start;
}

/* Single column on narrow screens: the preview drops under the editor rather
   than squeezing both into unusable widths. */
@media (max-width: 68rem) {
    .bon-layout { grid-template-columns: minmax(0, 1fr); }
}

.bon-pane { min-width: 0; }

.bon-command-rail {
    display: flex;
    /* Wrap at every width, not just narrow screens: the German publish label
       ("Layout veröffentlichen") plus undo/redo and the save-status badge exceed
       the editor pane's minimum width at common desktop sizes, and without
       wrapping the button shrank mid-text and overflowed into the preview pane,
       colliding with its "Preview" heading and the card headers below it. */
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.7rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, color-mix(in srgb, var(--color-primary) 8%, var(--color-surface)), var(--color-surface));
}
.bon-command-spacer { flex: 1; }
.bon-save-status {
    color: var(--color-text-dim);
    font: 700 0.76rem/1.2 var(--font-mono);
    letter-spacing: 0.035em;
    text-transform: uppercase;
}
.bon-save-status::before { content: "●"; margin-right: 0.4rem; color: var(--color-primary); }
.bon-save-status[data-status="dirty"]::before,
.bon-save-status[data-status="saving"]::before { color: var(--status-warn); }
.bon-save-status[data-status="error"] { color: var(--color-danger); }
.bon-save-status[data-status="error"]::before { color: var(--color-danger); }

/* --- toolbar --------------------------------------------------------------
   Each control is a labelled column. Previously the labels were inline and
   collided with the buttons. */
.bon-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.bon-toolbar > label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--color-text-dim);
}

.bon-toolbar select,
.bon-test-strip select,
.bon-palette input[type="search"] {
    min-height: 2.2rem;
}

.bon-palette {
    position: relative;
    z-index: 12;
    margin: -0.25rem 0 0.8rem;
    padding: 0.75rem;
    border: 1px solid var(--color-primary-dim);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: 0 18px 42px rgba(0,0,0,.35);
}
.bon-palette[hidden] { display: none; }
.bon-palette-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.55rem; }
.bon-palette input[type="search"] {
    width: 100%;
    margin-bottom: 0.65rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    background: var(--color-surface-2);
}
.bon-palette-group + .bon-palette-group { margin-top: 0.65rem; }
.bon-palette-group h4 {
    margin: 0 0 0.35rem;
    color: var(--color-text-dim);
    font: 800 0.68rem/1.2 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.bon-palette-group > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.35rem; }
.bon-palette-group button {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
}
.bon-palette-group button:hover,
.bon-palette-group button:focus-visible { border-color: var(--color-primary); outline: none; }

.bon-selection-tools {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.6rem;
    padding: 0.45rem 0.6rem;
    border: 1px dashed var(--color-primary-dim);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-primary) 7%, var(--color-surface));
}
.bon-selection-tools[hidden] { display: none; }
.bon-selection-tools strong { margin-right: auto; font-size: 0.78rem; }

/* --- block list ---------------------------------------------------------- */

.bon-block-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bon-block {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
}

.bon-block[draggable="true"] { cursor: grab; }
.bon-block[draggable="true"]:hover { border-color: var(--color-border-hover); }
.bon-block:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.bon-block.is-selected {
    border-color: var(--color-primary);
    box-shadow: inset 3px 0 0 var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
}
.bon-block.is-dragging { opacity: 0.48; }
.bon-block.bon-drop-before { box-shadow: 0 -3px 0 var(--color-accent); }
.bon-block.bon-drop-after { box-shadow: 0 3px 0 var(--color-accent); }

.bon-block-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bon-block-head strong { color: var(--color-text); }

.bon-handle { color: var(--color-text-dim); letter-spacing: -2px; cursor: grab; }
.bon-select { width: 1rem; height: 1rem; accent-color: var(--color-primary); }

.bon-lock { line-height: 1; }

.bon-block-actions { margin-left: auto; display: flex; gap: 0.3rem; }

.bon-context { position: relative; }
.bon-context > summary {
    display: grid;
    place-items: center;
    min-width: 2rem;
    min-height: 2rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    cursor: pointer;
    list-style: none;
}
.bon-context > summary::-webkit-details-marker { display: none; }
.bon-context[open] > summary { border-color: var(--color-primary); }
.bon-context-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.25rem);
    right: 0;
    min-width: 9rem;
    padding: 0.3rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    box-shadow: 0 14px 32px rgba(0,0,0,.38);
}
.bon-context-menu button {
    display: block;
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 0;
    border-radius: 3px;
    color: var(--color-text);
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.bon-context-menu button:hover,
.bon-context-menu button:focus-visible { background: var(--color-surface); outline: 1px solid var(--color-primary-dim); }
.bon-context-menu button.danger { color: var(--color-danger); }
.bon-context-menu button:disabled { opacity: 0.4; cursor: not-allowed; }

.bon-block-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 0.9rem;
    align-items: center;
    margin-top: 0.55rem;
    font-size: 0.85rem;
}

.bon-block-opts label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--color-text-dim);
}

/* Form controls, matching .modal-input from modal.js so the editor looks like
   the rest of the portal instead of falling back to the browser's defaults. */
.bon-block-opts select,
.bon-block-opts input[type="text"],
.bon-block-opts input[type="number"],
.bon-block-opts textarea,
.bon-toolbar select {
    padding: 0.35rem 0.5rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.85rem;
}

.bon-block-opts select:focus,
.bon-block-opts input:focus,
.bon-toolbar select:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: -1px;
    border-color: transparent;
}

.bon-block-opts input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.bon-block-opts .bon-check { color: var(--color-text); }

.bon-block-opts .bon-grow { flex: 1 1 16rem; }
.bon-block-opts .bon-grow input,
.bon-block-opts .bon-grow textarea { width: 100%; }
.bon-block-opts textarea { min-height: 3.7rem; resize: vertical; font-family: inherit; }

.bon-block-opts .hint {
    flex: 1 1 100%;
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: var(--color-text-dim);
}

/* --- logo ---------------------------------------------------------------- */

.bon-logo {
    margin-top: 1.25rem;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem 1rem;
}

.bon-logo legend {
    padding: 0 0.4rem;
    color: var(--color-text-dim);
    font-size: 0.85rem;
}

.bon-logo input[type="file"] {
    color: var(--color-text);
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

.bon-logo-placement {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0 0 0.75rem;
    padding: 0.62rem 0.7rem;
    border-left: 3px solid var(--color-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: color-mix(in srgb, var(--color-primary) 9%, var(--color-surface-2));
    color: var(--color-text-dim);
    font-size: 0.78rem;
    line-height: 1.35;
}

.bon-logo-placement > span:first-child {
    flex: 0 0 auto;
    color: var(--color-primary);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

/* A checkerboard makes a transparent logo's background obvious, which matters:
   transparency prints as paper, not ink. */
.bon-logo-img {
    display: block;
    max-width: 100%;
    max-height: 8rem;
    margin-bottom: 0.6rem;
    border-radius: var(--radius-sm);
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #d9d9d9 25%, transparent 25%, transparent 75%, #d9d9d9 75%),
        linear-gradient(45deg, #d9d9d9 25%, transparent 25%, transparent 75%, #d9d9d9 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}

/* --- preview ------------------------------------------------------------- */

/* Sticky so the paper stays in view while scrolling a long block list. */
.bon-preview {
    position: sticky;
    top: 1rem;
}

.bon-preview-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.bon-preview-tools h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-text-dim);
}
.bon-preview-tools label { display: flex; align-items: center; gap: 0.45rem; color: var(--color-text-dim); font-size: 0.75rem; }
.bon-preview-tools input { width: 7rem; accent-color: var(--color-primary); }
.bon-preview-tools output { min-width: 3rem; color: var(--color-text); font-family: var(--font-mono); }

.bon-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(15rem, 1fr));
    gap: 0.75rem;
}
.bon-preview-card {
    position: relative;
    min-width: 0;
    padding: 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}
.bon-preview-card > header {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.45rem;
    color: var(--color-text);
    font-size: 0.78rem;
}
.bon-preview-card > header span { color: var(--color-text-dim); font-size: 0.7rem; }
.bon-preview-card.is-loading::after {
    content: "";
    position: absolute;
    top: 0.68rem;
    right: 0.65rem;
    width: 0.65rem;
    height: 0.65rem;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: bon-spin .7s linear infinite;
}
@keyframes bon-spin { to { transform: rotate(360deg); } }

.bon-preview-scroll {
    --bon-zoom: 1;
    height: 35rem;
    overflow: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #d8d9dc;
}

.bon-preview-frame {
    display: block;
    width: calc(100% / var(--bon-zoom));
    height: calc(35rem / var(--bon-zoom));
    border: 0;
    /* White because it shows a PDF of white receipt paper. */
    background: #fff;
    transform: scale(var(--bon-zoom));
    transform-origin: top left;
}

.bon-preview-open {
    display: inline-block;
    margin: 0.45rem 0 0;
    font-size: 0.8rem;
    color: var(--color-text-dim);
}
.bon-preview-open[hidden] { display: none; }

.bon-test-strip {
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
    margin-top: 0.75rem;
    padding: 0.65rem;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--status-warn);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}
.bon-test-strip label { display: flex; flex: 1; flex-direction: column; gap: 0.25rem; color: var(--color-text-dim); font-size: 0.75rem; }
.bon-test-strip select { padding: 0.35rem 0.5rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text); background: var(--color-surface-2); }

@media (max-width: 88rem) {
    .bon-preview-grid { grid-template-columns: 1fr; }
    .bon-preview-scroll { height: 28rem; }
    .bon-preview-frame { height: calc(28rem / var(--bon-zoom)); }
}

@media (max-width: 42rem) {
    .bon-command-rail { align-items: stretch; flex-wrap: wrap; }
    .bon-command-spacer { display: none; }
    .bon-save-status { flex: 1 1 100%; }
    .bon-selection-tools, .bon-test-strip { align-items: stretch; flex-direction: column; }
    .bon-preview-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
    .bon-preview-card { flex: 0 0 min(88vw, 23rem); scroll-snap-align: start; }
}

@media (prefers-reduced-motion: reduce) {
    .bon-preview-card.is-loading::after { animation-duration: 1.4s; }
}

/* Printer routing is presented as a compact patch panel: every card is one
   reusable route, while the protected defaults remain visually distinct. */
.zone-view-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.zone-view-header h2,
.zone-view-header p { margin: 0; }
.zone-view-header p { max-width: 46rem; margin-top: 0.4rem; }

.zone-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
}

.zone-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.85rem;
    min-height: 76px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    background:
        linear-gradient(105deg, var(--color-primary-glow), transparent 48%),
        var(--color-surface);
}

.zone-card-protected {
    border-left-color: var(--color-text-dim);
    background: var(--color-surface);
}

.zone-index,
.zone-lock {
    color: var(--color-text-dim);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.zone-card-copy { display: flex; min-width: 0; flex-direction: column; gap: 0.2rem; }
.zone-card-copy strong { overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); }
.zone-card-copy span { color: var(--color-text-dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }

.zone-chip-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.zone-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.45rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-primary-glow);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

@media (max-width: 720px) {
    .zone-view-header { align-items: stretch; flex-direction: column; }
    .zone-view-header .btn { align-self: flex-start; }
}

/* ===========================================================================
   Operator rail — shared orientation, attention and feedback primitives.
   The admin stays deliberately dense and industrial: a narrow emerald signal
   line and monospaced telemetry distinguish live operational context from
   ordinary configuration content.
   =========================================================================== */
.brand-home {
    width: 100%; margin: 0; border: 0; background: transparent; color: inherit;
    text-align: left; cursor: pointer;
}
.brand-home:hover .brand-logo { box-shadow: 0 0 0 3px var(--color-primary-glow), 0 0 18px rgba(16,185,129,.24); }
.brand-home:focus-visible { outline: 2px solid var(--color-info); outline-offset: 4px; border-radius: var(--radius-sm); }

.operator-context {
    display: grid; gap: 0.18rem; margin-top: -0.75rem; padding: 0.7rem 0.8rem;
    border: 1px solid var(--color-border); border-left: 2px solid var(--color-primary);
    border-radius: var(--radius-sm); background: rgba(16,185,129,.035); min-width: 0;
}
.operator-context-label { color: var(--color-primary); font: 700 .63rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.operator-context strong, .operator-context-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operator-context strong { font-size: .84rem; }
.operator-context-user { color: var(--color-text-dim); font-size: .72rem; }

.nav-count {
    margin-left: auto; min-width: 1.35rem; height: 1.35rem; display: inline-grid; place-items: center;
    padding: 0 .35rem; border-radius: 999px; font: 800 .65rem/1 var(--font-mono);
    color: #fff; background: var(--color-danger-strong);
}
.nav-count.warn { color: #17130a; background: var(--color-warn); }
.nav-count.info { background: #1d4ed8; }
.nav-count[hidden] { display: none; }

/* One body-level tooltip serves each live sidebar counter. Fixed positioning is
   deliberate: both the desktop nav and the narrow-screen nav are scrollports,
   so a tooltip nested inside either would be clipped at exactly the small
   viewports where its explanation matters most. */
.nav-count-tooltip {
    position: fixed;
    z-index: 1400;
    display: grid;
    gap: 0.38rem;
    width: max-content;
    min-width: 12rem;
    max-width: min(21rem, calc(100vw - 1rem));
    padding: 0.68rem 0.72rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-left: 2px solid var(--color-primary);
    border-radius: var(--radius-sm);
    background: #0b0e15;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.42);
    color: var(--color-text);
    font-size: 0.75rem;
    line-height: 1.25;
    pointer-events: auto;
}
.nav-count-tooltip[hidden] { display: none; }
.nav-count-tooltip-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 1.2rem;
}
.nav-count-tooltip-row span { color: var(--color-text-dim); }
.nav-count-tooltip-row strong {
    color: var(--color-text);
    font: 800 0.72rem/1 var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.view-titlebar {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem;
    margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-border);
}
.view-title-copy { min-width: 0; }
.view-titlebar .view-title-copy h2 { margin: 0; }
.view-title-copy > p { max-width: 54rem; margin: .35rem 0 0; }
.view-title-actions { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }
.view-freshness { display: inline-flex; align-items: center; gap: .4rem; color: var(--color-text-dim); font-size: .72rem; white-space: nowrap; }
.refresh-btn, .copy-btn {
    width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    background: var(--color-surface-2); color: var(--color-text-dim); cursor: pointer;
}
.refresh-btn:hover, .copy-btn:hover { border-color: var(--color-border-hover); color: var(--color-primary); background: var(--color-surface-3); }
.refresh-btn:focus-visible, .copy-btn:focus-visible { outline: 2px solid var(--color-info); outline-offset: 2px; }
.refresh-btn svg, .copy-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.copy-btn { width: 28px; height: 28px; margin-left: .3rem; vertical-align: middle; }

.button-spinner {
    display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor;
    border-right-color: transparent; border-radius: 50%; animation: admin-spin .7s linear infinite;
}
@keyframes admin-spin { to { transform: rotate(360deg); } }
.view-loading-row td { padding: 2.25rem 1rem; text-align: center; color: var(--color-text-dim); }
.view[aria-busy="true"] .refresh-btn svg { animation: admin-spin .8s linear infinite; }
button[aria-busy="true"] { cursor: progress; }
button:disabled { opacity: .62; cursor: not-allowed; transform: none !important; }

.attention-panel {
    margin-bottom: 1.25rem; padding: 1rem 1.1rem; border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-warn); border-radius: var(--radius-md);
    background: linear-gradient(110deg, var(--color-warn-glow), transparent 48%), var(--color-surface);
    box-shadow: var(--shadow-sm);
}
.attention-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.attention-head h3 { margin: .12rem 0 0; }
.attention-kicker { color: var(--color-warn); font: 750 .66rem/1 var(--font-mono); letter-spacing: .13em; text-transform: uppercase; }
.attention-total { min-width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: var(--color-warn-glow); color: var(--color-warn); font: 800 .8rem/1 var(--font-mono); }
.attention-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: .55rem; margin-top: .85rem; }
.attention-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem .8rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface-2); color: var(--color-text); text-align: left; }
.attention-item:hover { border-color: var(--color-border-hover); background: var(--color-surface-3); }
.attention-item strong { color: var(--color-warn); font-family: var(--font-mono); }
.attention-item.danger strong { color: var(--status-danger); }
.attention-item.info strong { color: var(--status-info); }

.menu-filterbar { margin-top: 0; gap: .75rem; }
.menu-search-field { flex: 1 1 230px; }
.menu-search-field input, .menu-filterbar select {
    width: 100%; min-height: 38px; padding: .45rem .7rem; border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); background: var(--color-surface-2); color: var(--color-text);
}
.menu-search-field input:focus, .menu-filterbar select:focus { outline: 2px solid var(--color-info); outline-offset: 1px; }
.filter-result-count { margin-left: auto; color: var(--color-text-dim); font-size: .76rem; }
.menu-thumb { width: 44px; height: 44px; display: block; object-fit: cover; border-radius: 8px; border: 1px solid var(--color-border); background: var(--color-surface-2); }
.menu-thumb-empty { display: grid; place-items: center; color: var(--color-text-dim); font-size: .65rem; }

.status-with-copy { display: inline-flex; align-items: center; gap: .15rem; }
.drag-handle {
    min-width: 30px; min-height: 30px; padding: 0; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--color-text-dim); font: 800 .9rem/1 var(--font-mono);
    cursor: grab; touch-action: none;
}
.drag-handle:hover, .drag-handle:focus-visible { background: var(--color-surface-3); color: var(--color-primary); outline: none; }
.drag-handle:active { cursor: grabbing; }
tr.is-dragging { opacity: .45; }
tr.drag-over td { box-shadow: inset 0 2px 0 var(--color-primary); }

@media (max-width: 900px) {
    .operator-context { order: 0; flex: 1 1 220px; margin: 0; }
    .view-titlebar { align-items: stretch; flex-direction: column; gap: .8rem; }
    .view-title-actions { justify-content: flex-start; }
    .view-freshness { margin-left: auto; }
    .attention-list { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .operator-context-user { display: none; }
    .view-refreshed { display: none; }
    .menu-filterbar { align-items: stretch; flex-direction: column; }
    .filter-result-count { margin-left: 0; }
}

/* Internal accounts are an operational ledger, not another generic settings
   table. The narrow accent rail separates configuration from the two financial
   projections while keeping the dense Admin visual language intact. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.account-setting-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin: 0 0 1.25rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-info);
    border-radius: var(--radius-md);
    background:
        linear-gradient(105deg, var(--color-info-glow), transparent 48%),
        var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.account-setting-card h3,
.account-setting-card p,
.account-report-head h3,
.account-report-title h3,
.account-report-title p {
    margin: 0;
}

.account-setting-card p,
.account-report-title p { margin-top: 0.25rem; }

.account-kicker {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--color-primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.account-setting-action,
.account-report-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.account-setting-action select,
.pwa-settings-group select {
    min-height: 40px;
    min-width: 10rem;
    padding: 0.45rem 2rem 0.45rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    color: var(--color-text);
}

.account-setting-action select:focus-visible,
.pwa-settings-group select:focus-visible {
    outline: 2px solid var(--color-info);
    outline-offset: 2px;
}

.account-type {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0.2rem 0.55rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.account-type-open {
    border-color: var(--status-info-border);
    background: var(--status-info-bg);
    color: var(--status-info);
}

.account-type-consumption {
    border-color: var(--status-warn-border);
    background: var(--status-warn-bg);
    color: var(--status-warn);
}

/* Archived accounts remain actionable. The global inactive-row opacity is too
   destructive here: it fades Reactivate/Edit and makes historical data look
   disabled. Preserve hierarchy with surface and colour instead. */
.account-view tr.row-inactive { opacity: 1; }
.account-view tr.row-inactive td {
    color: color-mix(in srgb, var(--color-text-dim) 68%, var(--color-text) 32%);
    background: color-mix(in srgb, var(--color-surface) 96%, var(--color-text) 4%);
}
.account-view tr.row-inactive td:first-child {
    box-shadow: inset 3px 0 color-mix(in srgb, var(--color-text-dim) 45%, transparent);
}
.account-view tr.row-inactive td:nth-child(2) { text-decoration: none; }
.account-view tr.row-inactive:hover td {
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-surface) 91%, var(--color-text) 9%);
}

.account-empty-row td { padding: 0.8rem; }

.account-empty-state {
    display: grid;
    grid-template-columns: minmax(190px, 320px) max-content;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 4vw, 3.5rem);
    min-height: 220px;
    padding: 1rem clamp(1rem, 4vw, 3rem);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at 37% 52%, color-mix(in srgb, var(--status-warn) 10%, transparent), transparent 34%),
        var(--color-surface);
}

.account-empty-state img {
    display: block;
    width: min(100%, 320px);
    height: auto;
    margin-inline: auto;
    filter: drop-shadow(0 14px 18px rgb(0 0 0 / 24%));
}

.account-empty-copy {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
    color: var(--color-text-dim);
}

.account-report-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.account-report-toolbar {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 0.75rem;
    margin: 0;
    padding: 0.85rem;
    background: linear-gradient(145deg, rgba(255,255,255,.025), transparent 48%), var(--color-surface-2);
    box-shadow: inset 0 1px rgba(255,255,255,.025), var(--shadow-sm);
}

.account-report-toolbar .inline-field {
    display: grid;
    grid-column: span 4;
    gap: 0.32rem;
    min-width: 0;
    color: var(--color-text-dim);
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.account-report-toolbar .inline-field:nth-of-type(-n+2) { grid-column: span 2; }
.account-report-toolbar .inline-field:nth-of-type(n+5) { grid-column: span 5; }

.account-report-toolbar :is(input[type="date"], select) {
    width: 100%;
    min-height: 42px;
    padding: 0.58rem 0.75rem;
    border: 1px solid color-mix(in srgb, var(--color-border) 72%, #9fb1ca 28%);
    border-radius: 10px;
    outline: none;
    color: var(--color-text);
    background-color: color-mix(in srgb, var(--color-bg) 68%, var(--color-surface) 32%);
    box-shadow: inset 0 1px rgba(255,255,255,.04), 0 1px 2px rgba(0,0,0,.2);
    color-scheme: dark;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.account-report-toolbar :is(input[type="date"], select):hover {
    border-color: color-mix(in srgb, var(--color-primary) 42%, var(--color-border));
    background-color: color-mix(in srgb, var(--color-bg) 55%, var(--color-surface) 45%);
}

.account-report-toolbar :is(input[type="date"], select):focus-visible {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow), inset 0 1px rgba(255,255,255,.05);
}

.account-report-toolbar select {
    appearance: none;
    padding-right: 2.4rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238fa2bb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
}

.account-report-toolbar select option {
    color: var(--color-text);
    background: var(--color-surface);
}

.account-report-toolbar input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.72;
    cursor: pointer;
}
.account-report-toolbar input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.account-report-toolbar > .btn {
    grid-column: span 2;
    width: 100%;
}
.account-stats { margin-top: 1rem; }

.account-report-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.8fr) minmax(560px, 1.4fr);
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.account-report-grid > article {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.account-report-grid .data-table { margin-top: 0.85rem; }

@media (max-width: 1180px) {
    .account-report-grid { grid-template-columns: 1fr; }
    .account-report-toolbar .inline-field,
    .account-report-toolbar .inline-field:nth-of-type(-n+2),
    .account-report-toolbar .inline-field:nth-of-type(n+5) { grid-column: span 6; }
    .account-report-toolbar > .btn { grid-column: span 3; }
}

@media (max-width: 720px) {
    .account-setting-card,
    .account-report-head,
    .account-report-title {
        align-items: stretch;
        flex-direction: column;
    }

    .account-setting-action { justify-content: flex-start; flex-wrap: wrap; }
    .account-report-toolbar .inline-field,
    .account-report-toolbar .inline-field:nth-of-type(-n+2),
    .account-report-toolbar .inline-field:nth-of-type(n+5),
    .account-report-toolbar > .btn { grid-column: 1 / -1; }

    .account-empty-state {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        min-height: 0;
        text-align: center;
    }

    .account-empty-state img { width: min(100%, 240px); }
    .account-empty-copy { align-items: center; }
}

/* Catalogue translation dialog — a compact editorial language workspace nested
   inside item/category editing. It deliberately shares the existing modal
   palette while giving each language a clearly bounded, scannable card. */
.modal-box.catalog-translation-dialog {
    width: min(780px, calc(100vw - 32px));
    max-width: 780px;
    max-height: min(88dvh, 900px);
}

.catalog-translation-form { gap: 0; }

.catalog-translation-intro {
    margin: -0.3rem 0 1rem;
    color: var(--color-text-dim);
    font-size: 0.86rem;
    line-height: 1.55;
}

.catalog-translation-fallback {
    display: grid;
    grid-template-columns: minmax(110px, auto) 1fr;
    align-items: baseline;
    gap: 0.35rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid color-mix(in srgb, var(--color-accent) 34%, var(--color-border));
    border-left: 3px solid var(--color-accent);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--color-accent) 7%, var(--color-surface-2));
}

.catalog-translation-fallback-label {
    color: var(--color-text-dim);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.catalog-translation-fallback-value {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--color-text);
}

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

.catalog-translation-count {
    color: var(--color-text-dim);
    font-size: 0.74rem;
}

.catalog-translation-list {
    display: grid;
    gap: 0.75rem;
}

.catalog-translation-row {
    display: grid;
    grid-template-columns: minmax(130px, 0.48fr) minmax(220px, 1fr);
    gap: 0.75rem 0.9rem;
    margin: 0;
    padding: 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--color-accent) 5%, transparent), transparent 45%),
        var(--color-surface-2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.catalog-translation-row:focus-within {
    border-color: color-mix(in srgb, var(--color-accent) 55%, var(--color-border));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 12%, transparent);
}

.catalog-translation-row-head {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
}

.catalog-translation-legend {
    margin: 0;
    overflow: hidden;
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-translation-remove {
    flex: 0 0 auto;
    color: var(--status-danger, #f87171);
}

.catalog-translation-field { margin: 0; }
.catalog-translation-field-description { grid-column: 1 / -1; }
.catalog-translation-field textarea { min-height: 76px; resize: vertical; }
.catalog-translation-hint { grid-column: 1 / -1; margin: -0.25rem 0 0; }

.catalog-translation-empty {
    margin: 0;
    padding: 1.15rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-dim);
    text-align: center;
}

.catalog-translation-error { margin-top: 0.75rem; }

@media (max-width: 620px) {
    .modal-box.catalog-translation-dialog {
        width: 100%;
        max-width: none;
        max-height: 92dvh;
    }

    .catalog-translation-fallback,
    .catalog-translation-row {
        grid-template-columns: 1fr;
    }

    .catalog-translation-field-description,
    .catalog-translation-row-head,
    .catalog-translation-hint { grid-column: 1; }

    .catalog-translation-toolbar { align-items: stretch; flex-direction: column; }
    .catalog-translation-add { width: 100%; }
}

/* ========================================================================== */
/* Order history — dense operational trace workspace                          */
/* ========================================================================== */

.history-view {
    --history-amber: #f6b94a;
    --history-blue: #59c3ff;
    --history-line: rgba(148, 163, 184, .16);
    position: relative;
    overflow: hidden;
}
.history-view::before {
    content: '';
    position: absolute;
    inset: -3rem -2rem auto 42%;
    z-index: -1;
    height: 260px;
    pointer-events: none;
    background: repeating-linear-gradient(115deg, transparent 0 18px, rgba(246, 185, 74, .035) 18px 19px),
        radial-gradient(circle at 70% 10%, rgba(246, 185, 74, .12), transparent 42%);
    mask-image: linear-gradient(to bottom, #000, transparent);
}
.history-titlebar, .history-title-actions, .history-filter-primary, .history-presets,
.history-detail-head, .history-receipt-head, .history-receipt-actions,
.history-item-title, .history-item-meta, .history-print-row, .history-payment-row,
.history-event-copy > div { display: flex; align-items: center; }
.history-titlebar { display: flex; justify-content: space-between; gap: 1.5rem; margin-bottom: .9rem; }
.history-titlebar h2 { margin: .16rem 0 .25rem; }
.history-titlebar p { margin: 0; max-width: 760px; color: var(--color-text-dim); }
.history-title-actions { gap: .7rem; align-self: flex-end; }
.history-result-count { color: var(--color-text-dim); font-family: var(--font-mono); font-size: .74rem; }
.history-eyebrow { color: var(--history-amber); font-family: var(--font-mono); font-size: .66rem; font-weight: 800; letter-spacing: .16em; }

.history-filter-card {
    padding: .85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(255,255,255,.032), transparent 42%), var(--color-surface);
    box-shadow: inset 0 1px rgba(255,255,255,.035);
}
.history-filter-primary { gap: .7rem; align-items: end; }
.history-filter-primary label, .history-filter-grid label {
    display: grid;
    gap: .3rem;
    min-width: 0;
    color: var(--color-text-dim);
    font-size: .66rem;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.history-filter-primary label input, .history-filter-grid label select { width: 100%; }
.history-filter-card :is(input[type="search"], input[type="date"], select) {
    min-height: 40px;
    padding: .58rem .72rem;
    border: 1px solid color-mix(in srgb, var(--color-border) 76%, #9fb1ca 24%);
    border-radius: 10px;
    outline: none;
    color: var(--color-text);
    background-color: color-mix(in srgb, var(--color-bg) 72%, var(--color-surface) 28%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 1px 2px rgba(0,0,0,.18);
    color-scheme: dark;
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.history-filter-card :is(input[type="search"], input[type="date"], select):hover {
    border-color: color-mix(in srgb, var(--history-blue) 38%, var(--color-border));
    background-color: color-mix(in srgb, var(--color-bg) 60%, var(--color-surface) 40%);
}
.history-filter-card :is(input[type="search"], input[type="date"], select):focus-visible {
    border-color: var(--history-blue);
    box-shadow: 0 0 0 3px rgba(89,195,255,.14), inset 0 1px rgba(255,255,255,.045);
}
.history-filter-card input::placeholder { color: color-mix(in srgb, var(--color-text-dim) 78%, transparent); opacity: 1; }
.history-filter-card input[type="search"] {
    padding-left: 2.35rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238fa2bb' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: .75rem center;
}
.history-filter-card select {
    appearance: none;
    padding-right: 2.35rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238fa2bb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .72rem center;
    cursor: pointer;
}
.history-filter-card select option { color: var(--color-text); background: var(--color-surface); }
.history-filter-card input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: .72;
    cursor: pointer;
}
.history-filter-card input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.history-search { flex: 1 1 380px; }
.history-filter-primary label:not(.history-search) { flex: 0 1 170px; }
.history-presets { gap: .38rem; margin-top: .55rem; }
.history-preset {
    padding: .26rem .58rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-dim);
    background: transparent;
    font-size: .7rem;
    cursor: pointer;
}
.history-preset:hover { color: var(--history-amber); border-color: rgba(246,185,74,.38); background: rgba(246,185,74,.06); }
.history-filter-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(118px, 1fr)) auto;
    gap: .55rem;
    align-items: end;
    margin-top: .7rem;
    padding-top: .7rem;
    border-top: 1px solid var(--history-line);
}
.history-reset { white-space: nowrap; }

.history-workspace {
    display: grid;
    grid-template-columns: minmax(640px, 1.25fr) minmax(360px, .75fr);
    gap: .8rem;
    min-height: 0;
    height: calc(100vh - 315px);
    margin-top: .8rem;
}
.history-list-card, .history-detail {
    min-height: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    overflow: hidden;
}
.history-list-card { display: flex; flex-direction: column; }
.history-list-card .table-scroll { flex: 1; overflow: auto; }
.history-table { min-width: 780px; margin: 0; }
.history-table thead { position: sticky; top: 0; z-index: 2; background: var(--color-surface); }
.history-order-row { cursor: pointer; }
.history-order-row.is-selected td { background: rgba(246,185,74,.075); border-bottom-color: rgba(246,185,74,.24); }
.history-order-row.is-selected td:first-child { box-shadow: inset 3px 0 var(--history-amber); }
.history-order-row:focus-visible { outline: 2px solid var(--history-blue); outline-offset: -2px; }
.history-reference span { display: block; }
.history-ref-main { color: var(--color-text); font-family: var(--font-mono); font-weight: 800; }
.history-ref-sub { margin-top: .15rem; color: var(--color-text-dim); font-size: .68rem; }
.history-source {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: .18rem .46rem;
    border: 1px solid var(--history-line);
    border-radius: 4px;
    color: #b9c3d2;
    background: rgba(148,163,184,.06);
    font-size: .67rem;
    font-weight: 750;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.history-source-guest { color: #7dd3fc; border-color: rgba(56,189,248,.25); background: rgba(56,189,248,.08); }
.history-source-mixed { color: #d8b4fe; border-color: rgba(192,132,252,.25); background: rgba(192,132,252,.08); }
.history-source-internal_account { color: #fde68a; border-color: rgba(246,185,74,.28); background: rgba(246,185,74,.08); }
.history-more { margin: .65rem auto; }
.history-skeleton td { padding: .62rem 1rem; }
.history-skeleton span {
    display: block;
    width: calc(54% + var(--s) * 4%);
    height: 24px;
    border-radius: 5px;
    background: linear-gradient(90deg, rgba(255,255,255,.025), rgba(255,255,255,.075), rgba(255,255,255,.025));
    background-size: 220% 100%;
    animation: history-shimmer 1.1s linear infinite;
}
@keyframes history-shimmer { to { background-position: -220% 0; } }

.history-detail {
    position: relative;
    overflow-y: auto;
    container: history-trace / inline-size;
}
.history-detail-empty { display: grid; place-items: center; align-content: center; min-height: 100%; padding: 2rem; text-align: center; color: var(--color-text-dim); }
/* Author-level display rules outrank the browser's [hidden] stylesheet. Keep
   this explicit so selecting an order cannot leave the empty prompt visible
   above the loaded trace. */
.history-detail-empty[hidden], #history-detail-shell[hidden] { display: none; }
.history-detail-empty p { max-width: 290px; margin: .35rem 0 0; line-height: 1.5; }
.history-detail-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: .8rem; border: 1px solid rgba(246,185,74,.25); border-radius: 50%; color: var(--history-amber); background: rgba(246,185,74,.07); font-size: 1.35rem; }
.history-detail-head {
    position: sticky;
    top: 0;
    z-index: 4;
    justify-content: space-between;
    gap: 1rem;
    padding: .66rem .78rem;
    border-bottom: 1px solid var(--history-line);
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    backdrop-filter: blur(12px);
}
.history-detail-head h3 { margin: .1rem 0 0; font-family: var(--font-mono); font-size: .9rem; line-height: 1.2; }
.history-detail-close { width: 28px; height: 28px; border: 1px solid var(--color-border); border-radius: 8px; color: var(--color-text-dim); background: transparent; cursor: pointer; }
.history-detail-close:hover { color: var(--color-text); border-color: var(--history-amber); }
.history-detail-status { display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem; color: var(--color-text-dim); }
.history-detail-status:empty { display: none; }
#history-detail-content { padding: .62rem .72rem .78rem; }

.history-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--history-line); border-radius: 10px; background: var(--history-line); }
.history-summary-grid > div { min-width: 0; padding: .46rem .55rem; background: var(--color-surface-raised, #151923); }
.history-summary-grid span { display: block; color: var(--color-text-dim); font-size: .58rem; line-height: 1.15; text-transform: uppercase; letter-spacing: .07em; }
.history-summary-grid strong { display: block; margin-top: .14rem; overflow: hidden; font-size: .78rem; line-height: 1.25; text-overflow: ellipsis; }
.history-summary-grid strong .badge, .history-summary-grid strong .history-source { margin-top: 0; }
.history-order-actions { display: flex; justify-content: flex-end; margin-top: .45rem; }
.history-detail-section { margin-top: .72rem; }
.history-detail-section > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .28rem; }
.history-detail-section > header h4 { margin: 0; font-size: .69rem; letter-spacing: .075em; text-transform: uppercase; }
.history-detail-section > header span { color: var(--color-text-dim); font-family: var(--font-mono); font-size: .63rem; }
.history-section-empty { padding: .65rem; border: 1px dashed var(--color-border); border-radius: 8px; color: var(--color-text-dim); text-align: center; }

.history-item-line { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: .45rem; padding: .36rem 0; border-top: 1px solid var(--history-line); }
.history-item-line:first-of-type { border-top: 0; }
.history-item-qty { display: grid; place-items: start center; padding-top: .06rem; color: var(--history-amber); font-size: .78rem; font-weight: 800; }
.history-item-copy { min-width: 0; }
.history-item-title { gap: .3rem; }
.history-item-title strong { overflow-wrap: anywhere; font-size: .8rem; line-height: 1.25; }
.history-item-meta { flex-wrap: wrap; gap: .2rem .48rem; margin-top: .12rem; color: var(--color-text-dim); font-size: .61rem; line-height: 1.25; }
.history-item-meta .history-source { padding: .08rem .3rem; font-size: .58rem; }
.history-line-flag { padding: .1rem .32rem; border-radius: 4px; color: #fde68a; background: rgba(246,185,74,.1); font-size: .62rem; }
.history-item-modifiers { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
.history-item-modifiers span { padding: .15rem .36rem; border-radius: 4px; color: #c4b5fd; background: rgba(139,92,246,.09); font-size: .67rem; }
.history-item-note { margin-top: .28rem; padding: .32rem .45rem; border-left: 2px solid var(--history-amber); color: #fde9bd; background: rgba(246,185,74,.065); font-size: .7rem; line-height: 1.35; }
.history-item-note span { display: block; margin-bottom: .12rem; color: var(--history-amber); font-size: .58rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.history-item-money { display: grid; justify-items: end; align-content: start; gap: .08rem; white-space: nowrap; font-size: .78rem; }
.history-item-money span { color: var(--color-text-dim); font-size: .58rem; }

.history-receipt-card, .history-transfer-card { padding: .52rem .58rem; border: 1px solid var(--history-line); border-radius: 9px; background: rgba(255,255,255,.018); }
.history-receipt-card + .history-receipt-card, .history-transfer-card + .history-transfer-card { margin-top: .35rem; }
.history-receipt-head { justify-content: space-between; gap: .8rem; }
.history-receipt-head > div { display: flex; align-items: center; gap: .45rem; }
.history-receipt-number { color: var(--history-amber); font-family: var(--font-mono); font-weight: 850; }
.history-receipt-meta { display: flex; flex-wrap: wrap; gap: .18rem .55rem; margin-top: .24rem; color: var(--color-text-dim); font-size: .61rem; }
.history-vat { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .28rem; }
.history-vat span { padding: .1rem .3rem; border: 1px solid var(--history-line); border-radius: 4px; color: var(--color-text-dim); font-size: .58rem; }
.history-receipt-actions { flex-wrap: wrap; gap: .28rem; margin-top: .38rem; }
.history-receipt-actions .btn-sm { min-height: 28px; padding: .3rem .48rem; font-size: .66rem; }
.history-pdf { display: inline-flex; text-decoration: none; }
.history-verify-result { margin-top: .3rem; }
.history-payment-row, .history-print-row { justify-content: space-between; gap: .55rem; padding: .38rem 0; border-top: 1px solid var(--history-line); }
.history-payment-row:first-of-type, .history-print-row:first-of-type { border-top: 0; }
.history-payment-row > div { display: grid; gap: .12rem; }
.history-payment-row > div:last-child { justify-items: end; }
.history-payment-row span, .history-print-row span { color: var(--color-text-dim); font-size: .67rem; }
.history-payment-row.is-storno strong { color: var(--status-danger); }
.history-transfer-card { display: grid; grid-template-columns: 1fr auto; gap: .32rem .65rem; }
.history-transfer-card > div { display: grid; gap: .12rem; }
.history-transfer-card span { color: var(--color-text-dim); font-size: .68rem; }
.history-transfer-balance { text-align: right; }
.history-transfer-card p { grid-column: 1 / -1; margin: .12rem 0 0; padding-top: .3rem; border-top: 1px solid var(--history-line); color: #fde9bd; }

.history-event { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: .4rem; min-height: 44px; }
.history-event-rail { position: relative; }
.history-event-rail::after { content: ''; position: absolute; top: 13px; bottom: -2px; left: 7px; width: 1px; background: var(--history-line); }
.history-event:last-child .history-event-rail::after { display: none; }
.history-event-rail span { position: relative; z-index: 1; display: block; width: 8px; height: 8px; margin: 4px 0 0 3px; border: 2px solid var(--color-surface); border-radius: 50%; background: var(--history-blue); box-shadow: 0 0 0 2px rgba(89,195,255,.15); }
.history-event-copy { padding-bottom: .42rem; }
.history-event-copy > div { gap: .4rem; }
.history-event-copy strong { font-size: .7rem; }
.history-event-copy p { margin: .1rem 0; color: var(--color-text-dim); font-size: .62rem; line-height: 1.3; }
.history-event-copy > span { color: var(--color-text-dim); font-family: var(--font-mono); font-size: .57rem; }
.history-replay { padding: .1rem .28rem; border-radius: 3px; color: #86efac; background: rgba(34,197,94,.08); font-size: .57rem; font-weight: 800; text-transform: uppercase; }

@container history-trace (min-width: 560px) {
    .history-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1320px) {
    .history-filter-grid { grid-template-columns: repeat(4, minmax(135px, 1fr)); }
    .history-workspace { grid-template-columns: minmax(560px, 1.15fr) minmax(330px, .85fr); }
}
@media (max-width: 1040px) {
    .history-workspace { display: block; height: calc(100vh - 370px); }
    .history-list-card { height: 100%; }
    .history-detail { position: fixed; inset: 0 0 0 auto; z-index: 60; width: min(520px, 94vw); height: 100vh; border-radius: 0; transform: translateX(105%); transition: transform .22s ease; box-shadow: -24px 0 80px rgba(0,0,0,.55); }
    .history-detail.is-open { transform: translateX(0); }
}
@media (max-width: 720px) {
    .history-view { overflow-y: auto; }
    .history-titlebar { flex-direction: column; }
    .history-title-actions { align-self: stretch; justify-content: space-between; }
    .history-filter-primary { flex-wrap: wrap; }
    .history-search { flex-basis: 100%; }
    .history-filter-primary label:not(.history-search) { flex: 1 1 130px; }
    .history-filter-primary .btn { flex: 1 1 100%; }
    .history-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .history-reset { grid-column: 1 / -1; }
    .history-workspace { height: 62vh; min-height: 480px; }
    .history-detail { width: 100vw; }
    .history-item-line { grid-template-columns: 34px minmax(0, 1fr); }
    .history-item-money { grid-column: 2; grid-auto-flow: column; justify-content: start; justify-items: start; gap: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .history-detail { transition: none; }
    .history-skeleton span { animation: none; }
}
.pwa-settings-header { align-items: flex-start; }
.pwa-settings-grid { display: grid; gap: 1.25rem; margin-top: 1rem; }
.pwa-settings-group { display: grid; gap: 0.75rem; }
.pwa-settings-group > h3 { margin: 0; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.pwa-settings-group .account-setting-card { margin: 0; }
.pwa-settings-group h4 { margin: 0 0 0.25rem; font-size: 1rem; }
@media (min-width: 1100px) {
    .pwa-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .pwa-settings-group:first-child { grid-row: span 2; }
}
