:root, .theme-teal {
    --ink: #1a2b2b;
    --muted: #5b6b6a;
    --line: #d7e0de;
    --paper: #f4f7f6;
    --card: #ffffff;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --accent-2: #0f766e;
    --navy: #0b3a3a;
    --sidebar: #0b3a3a;
    --side-text: #d7edec;
    --side-muted: #8ba8a6;
    --side-active: #5eead4;
    --side-on: #0f4a48;
    --side-line: #1a4f4e;
    --side-gold: #f0d9a6;
    --hover-tint: #ecfdf5;
    --input-bg: #fff;
    --focus-ring: #5eead4;
    --ok: #15803d;
    --ok-bg: #dcfce7;
    --ok-line: #bbf7d0;
    --warn: #b45309;
    --warn-bg: #ffedd5;
    --bad: #b91c1c;
    --bad-bg: #fee2e2;
    --bad-line: #fecaca;
}
.theme-navy {
    --ink: #1e293b; --muted: #64748b; --line: #e2e8f0; --paper: #f5f7fa; --card: #fff;
    --accent: #1d4e89; --accent-dark: #163a66; --accent-2: #1d4e89; --navy: #0f2744;
    --sidebar: #0f2744; --side-text: #e2e8f0; --side-muted: #94a3b8; --side-active: #93c5fd;
    --side-on: #1e3a5f; --side-line: #1e3a5f; --side-gold: #fdba74; --hover-tint: #eff6ff; --focus-ring: #93c5fd;
}
.theme-warm {
    --ink: #1c1917; --muted: #57534e; --line: #e7e5e4; --paper: #f7f4ef; --card: #fffdf9;
    --accent: #3f5c4a; --accent-dark: #334a3c; --accent-2: #3f5c4a; --navy: #1c1917;
    --sidebar: #1c1917; --side-text: #f5f5f4; --side-muted: #a8a29e; --side-active: #d6c4a8;
    --side-on: #292524; --side-line: #292524; --side-gold: #d97706; --hover-tint: #f5f0e6; --focus-ring: #d6c4a8;
}
.theme-violet {
    --ink: #3b0764; --muted: #7c3aed; --line: #e9d5ff; --paper: #faf5ff; --card: #fff;
    --accent: #ec4899; --accent-dark: #db2777; --accent-2: #a855f7; --navy: #4c1d95;
    --sidebar: #4c1d95; --side-text: #f5d0fe; --side-muted: #d8b4fe; --side-active: #bef264;
    --side-on: #6d28d9; --side-line: #7e22ce; --side-gold: #fb7185; --hover-tint: #fae8ff; --focus-ring: #f0abfc;
    --ok: #65a30d; --ok-bg: #ecfccb; --ok-line: #d9f99d; --warn: #e11d48; --warn-bg: #ffe4e6;
    --bad: #c026d3; --bad-bg: #fae8ff; --bad-line: #f5d0fe;
}
.theme-grape {
    --ink: #2e1065; --muted: #6d28d9; --line: #ddd6fe; --paper: #f5f3ff; --card: #fff;
    --accent: #db2777; --accent-dark: #be185d; --accent-2: #06b6d4; --navy: #5b21b6;
    --sidebar: #5b21b6; --side-text: #ede9fe; --side-muted: #c4b5fd; --side-active: #22d3ee;
    --side-on: #4c1d95; --side-line: #6d28d9; --side-gold: #f0abfc; --hover-tint: #f5f3ff; --focus-ring: #22d3ee;
}
.theme-bubble {
    --ink: #881337; --muted: #be185d; --line: #fecdd3; --paper: #fff1f2; --card: #fff;
    --accent: #f472b6; --accent-dark: #db2777; --accent-2: #2dd4bf; --navy: #9d174d;
    --sidebar: #9d174d; --side-text: #fce7f3; --side-muted: #f9a8d4; --side-active: #5eead4;
    --side-on: #831843; --side-line: #9f1239; --side-gold: #fde68a; --hover-tint: #fdf2f8; --focus-ring: #5eead4;
}
.theme-aqua {
    --ink: #164e63; --muted: #0f766e; --line: #a5f3fc; --paper: #ecfeff; --card: #fff;
    --accent: #f43f5e; --accent-dark: #e11d48; --accent-2: #22d3ee; --navy: #0e7490;
    --sidebar: #0e7490; --side-text: #cffafe; --side-muted: #67e8f9; --side-active: #a3e635;
    --side-on: #155e75; --side-line: #0e7490; --side-gold: #fde68a; --hover-tint: #ecfeff; --focus-ring: #a3e635;
}
.theme-sunset {
    --ink: #7c2d12; --muted: #c2410c; --line: #fed7aa; --paper: #fff7ed; --card: #fff;
    --accent: #ea580c; --accent-dark: #c2410c; --accent-2: #d946ef; --navy: #7c2d12;
    --sidebar: #7c2d12; --side-text: #ffedd5; --side-muted: #fdba74; --side-active: #38bdf8;
    --side-on: #9a3412; --side-line: #c2410c; --side-gold: #fde68a; --hover-tint: #fff7ed; --focus-ring: #38bdf8;
}
.theme-indigo {
    --ink: #1e1b4b; --muted: #4f46e5; --line: #c7d2fe; --paper: #eef2ff; --card: #fff;
    --accent: #d946ef; --accent-dark: #c026d3; --accent-2: #22c55e; --navy: #312e81;
    --sidebar: #312e81; --side-text: #e0e7ff; --side-muted: #a5b4fc; --side-active: #fde047;
    --side-on: #3730a3; --side-line: #4338ca; --side-gold: #f9a8d4; --hover-tint: #eef2ff; --focus-ring: #fde047;
}
.theme-loud .sidebar-nav a.is-on {
    color: var(--sidebar);
    background: var(--side-active);
    border-left-color: var(--accent);
}
.theme-loud .stat .value,
.theme-loud .sales-badge .value { color: var(--accent-2); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 80%; }
body {
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 1rem;
    color: var(--ink);
    background: var(--paper);
    min-height: 100vh;
    min-height: 100dvh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
}
.auth-shell.is-wide {
    grid-template-columns: minmax(0, 1fr) minmax(380px, 520px);
}
.auth-panel {
    background: var(--sidebar);
    color: var(--side-text);
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.auth-panel h1 { font-size: 32px; margin: 0 0 12px; letter-spacing: -0.03em; }
.auth-panel p { color: var(--side-muted); line-height: 1.5; max-width: 36ch; }
.auth-mark { font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--side-gold); margin-bottom: 24px; }
.auth-form {
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--card);
}
.auth-form h2 { margin: 0 0 8px; font-size: 22px; }
.auth-form .hint { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

label { display: block; font-size: 0.8125rem; font-weight: 600; margin-bottom: 6px; }
input[type="email"], input[type="password"], input[type="text"], input[type="tel"], select {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--input-bg);
    padding: 10px 12px;
    font-size: 0.9375rem;
    margin-bottom: 16px;
}
input:focus, select:focus { outline: 2px solid var(--focus-ring); border-color: var(--accent); }
.row-inline { display: flex; align-items: center; gap: 8px; margin: 0 0 20px; font-size: 14px; }
.row-inline input { margin: 0; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: var(--accent);
    color: #fff;
    padding: 11px 16px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}
.auth-form .btn { width: 100%; }
.btn:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--hover-tint); color: var(--ink); border-color: var(--line); }
.btn-sm { padding: 6px 10px; font-size: 13px; }

.ui-icon { width: 16px; height: 16px; display: block; }
.icon-btn {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
}
.icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.icon-btn.is-off { opacity: 0.35; pointer-events: none; }
.icon-btn:hover, .icon-btn:focus-visible {
    background: var(--hover-tint);
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.icon-btn.is-tone-danger { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.icon-btn.is-tone-danger:hover, .icon-btn.is-tone-danger:focus-visible { background: var(--bad); border-color: var(--bad); color: #fff; }
.icon-btn.is-solid {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    width: auto;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
}
.icon-btn.is-solid:hover, .icon-btn.is-solid:focus-visible {
    background: var(--accent-dark);
    color: #fff;
}
.icon-btn.has-caption {
    width: auto;
    min-width: 72px;
    height: auto;
    padding: 10px 8px 8px;
    gap: 4px;
}
.icon-btn-caption {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.02em;
}
.icon-btn-tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    background: var(--sidebar);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 20;
}
.icon-btn:hover .icon-btn-tip,
.icon-btn:focus-visible .icon-btn-tip { opacity: 1; }
@media (hover: none) {
    .icon-btn:not(.has-caption) { width: auto; min-width: 32px; height: auto; padding: 6px 6px 4px; }
    .icon-btn:not(.has-caption) .icon-btn-tip {
        position: static;
        transform: none;
        background: transparent;
        color: var(--muted);
        opacity: 1;
        padding: 2px 0 0;
        font-size: 10px;
        font-weight: 700;
        white-space: normal;
        max-width: 4.5rem;
        text-align: center;
        line-height: 1.15;
    }
}
.icon-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.actions.icon-row, .quick-links.icon-row, .toolbar .icon-row { margin: 0; }
.form-inline-icon .icon-btn { margin: 0; }
.gst-tabs.icon-row a.icon-btn.is-on,
.icon-row a.icon-btn.is-on,
.book-money-actions a.icon-btn.is-on {
    border-color: var(--accent);
    background: var(--hover-tint);
    color: var(--accent);
}
.form-inline-icon { display: inline-flex; margin: 0; }
.error { color: var(--bad); font-size: 13px; margin: -8px 0 12px; }

.app-shell {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    min-height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--sidebar);
}
.sidebar {
    background: var(--sidebar);
    color: var(--side-text);
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
}
.sidebar-brand {
    display: block;
    padding: 20px 18px 6px;
    color: #fff;
    text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; color: #fff; }
.sidebar-mark {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--side-gold);
}
.sidebar-identity {
    padding: 0 18px 12px;
    font-size: 13px;
    color: var(--side-muted);
}
.sidebar-identity a {
    display: block;
    color: var(--side-gold);
    margin-top: 6px;
    font-size: 12px;
}
.sidebar-dealer {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    word-break: break-word;
}
.sidebar-meta {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
}
.sidebar-fy-role {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
}
.sidebar-fy-sep { opacity: 0.55; }
.sidebar-pos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 14px 8px;
    background: var(--accent);
    color: #fff;
    text-align: center;
    padding: 10px 12px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
}
.sidebar-pos .ui-icon { width: 14px; height: 14px; }
.sidebar-pos:hover, .sidebar-pos.is-on {
    background: var(--accent-dark);
    color: #fff;
    text-decoration: none;
}
.sidebar-nav { display: flex; flex-direction: column; padding: 4px 0 16px; flex: 1; }
.sidebar-nav .nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--side-muted);
    padding: 14px 18px 4px;
}
.sidebar-nav a {
    color: var(--side-text);
    text-decoration: none;
    padding: 6px 16px;
    border-left: 3px solid transparent;
    font-size: 0.8125rem;
}
.sidebar-nav a:hover { color: #fff; text-decoration: none; background: var(--side-on); }
.sidebar-nav a.is-on { color: var(--side-active); background: var(--side-on); border-left-color: var(--side-active); }
.sidebar-foot {
    padding: 14px 16px 18px;
    border-top: 1px solid var(--side-line);
    font-size: 13px;
    color: var(--side-muted);
}
.sidebar-user { margin-bottom: 8px; }
.sidebar-foot a { color: var(--side-gold); }
.sidebar-logout {
    width: 100%;
    margin-top: 10px;
    color: var(--side-text);
    border-color: var(--side-line);
}
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar-title { margin: 0; font-size: 18px; flex: 1; }
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
}
.help-icon .ui-icon { width: 16px; height: 16px; }
.help-icon:hover { border-color: var(--accent); color: var(--accent); }
.help-modal { z-index: 40; }
.help-modal-card {
    width: min(720px, 100%);
    max-height: 90vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.help-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.help-modal-head h2 { margin: 0; font-size: 20px; }
.help-video {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #0f172a;
}
.help-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.help-body { font-size: 14px; line-height: 1.55; }
.help-body h2 { font-size: 16px; margin: 18px 0 8px; }
.help-body h3 { font-size: 14px; margin: 14px 0 6px; }
.help-body p { margin: 0 0 10px; }
.help-body ul, .help-body ol { margin: 0 0 12px; padding-left: 20px; }
.help-body li { margin: 0 0 4px; }
.help-body code { font-size: 13px; }
.topbar-meta { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.topbar-logout { margin: 0; flex-shrink: 0; }
.fy-switch { flex-shrink: 0; }
.fy-switch form { display: flex; align-items: center; gap: 6px; margin: 0; }
.fy-switch select { width: auto; margin: 0; font-size: 13px; padding: 6px 8px; }
.sidebar-toggle {
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
}
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: #0f172a99;
    z-index: 30;
}
.sidebar-backdrop[hidden] { display: none; }
.app-main { min-width: 0; min-height: 100%; background: var(--paper); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 24px 48px; }
.wrap-wide { max-width: 1400px; }
.wrap-pos { max-width: none; }
.print-only { display: none; }
.report-print { display: none; }
.report-print-title { font-size: 16px; margin: 0 0 4px; font-weight: 700; color: #1c1917; }
.report-print-meta { margin: 0 0 10px; color: #57534e; font-size: 10px; }
.report-print-table { width: 100%; border-collapse: collapse; }
.report-print-table th,
.report-print-table td {
    border: 1px solid #d6d3d1;
    padding: 4px 5px;
    text-align: left;
    vertical-align: top;
}
.report-print-table th {
    background: #f5f5f4;
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 700;
}
.report-print-table td.num,
.report-print-table th.num { text-align: right; }
.report-print-table tfoot th { background: #f5f5f4; font-size: 10px; text-transform: none; }
.print-logo { max-height: 48px; max-width: 140px; display: block; margin: 0 0 6px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar h1 { margin: 0; }
.book-money-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px 10px;
    margin: 0 0 12px;
}
.book-money-bar .book-money-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin: 0;
    white-space: nowrap;
    font-size: 12px;
}
.book-money-bar .book-money-field:has(.search-select) > label {
    display: inline;
    margin: 0;
}
.book-money-bar .book-money-field select,
.book-money-bar .book-money-field input[type="date"],
.book-money-bar .book-money-field input[type="text"] {
    margin: 0;
    width: auto;
    min-width: 0;
}
.book-money-bar .book-money-field input[type="text"] {
    width: 12rem;
}
.book-money-bar .book-money-field:has(.search-select) {
    flex: 2 1 28rem;
    min-width: 22rem;
    max-width: 42rem;
}
.book-money-bar .book-money-field:has(.search-select) .search-select {
    flex: 1;
    min-width: 0;
}
.book-money-bar .book-money-field.is-compact:has(.search-select) {
    flex: 1 1 11rem;
    min-width: 9.5rem;
    max-width: 16rem;
}
.book-money-bar .book-money-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    white-space: nowrap;
}
.book-money-bar .book-money-check input {
    margin: 0;
}
.book-money-bar .book-money-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
}
.search-select {
    position: relative;
    display: block;
    min-width: 16rem;
}
.search-select-input {
    width: 100%;
    margin: 0;
    border: 1px solid var(--line);
    background: #fff;
    padding: 8px 12px;
    font-size: 0.9375rem;
}
.search-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
}
.search-select-list {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 16rem;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 8px 24px #0f172a24;
}
.search-select-option {
    display: block;
    width: 100%;
    margin: 0;
    padding: 8px 12px;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.search-select-option:hover,
.search-select-option.is-active {
    background: var(--hover-tint);
}
.search-select-option.is-on {
    font-weight: 600;
    color: var(--accent);
}
.search-select-empty {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 13px;
}
.flash { background: var(--ok-bg); border: 1px solid var(--ok-line); padding: 10px 12px; margin-bottom: 16px; }
.flash-error { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.card input[type=checkbox], .form-grid input[type=checkbox] { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid input, .form-grid select, .card input, .card select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px 12px;
    font-size: 0.9375rem;
    margin-bottom: 0;
}
input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="url"], textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px 12px;
    font-size: 0.9375rem;
}
.section-title { font-size: 15px; margin: 20px 0 8px; }
.dash-section { margin: 8px 0 28px; }
.dash-section .section-title { margin-top: 0; }
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}
.dash-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 84px;
    padding: 12px 8px 10px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    text-decoration: none;
}
.dash-link .ui-icon { width: 22px; height: 22px; flex-shrink: 0; }
.dash-link-name {
    display: block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    max-width: 100%;
    color: var(--ink);
}
.dash-link:hover, .dash-link:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.totals { text-align: right; font-size: 16px; }
.num { text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }
.card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.quick-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.modal {
    position: fixed;
    inset: 0;
    background: #1c191799;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 20px;
    width: min(420px, 100%);
}
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0 28px; }
.stat, .card {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 16px 18px;
}
.stat .value { font-size: 28px; font-weight: 700; }
.stat .label, .muted { color: var(--muted); font-size: 13px; }
.stats-home .stat { min-width: 0; }
.sales-badges {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 12px;
}
.pending-badges {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 28rem;
}
.sales-badge {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 0;
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--line);
    color: inherit;
}
a.sales-badge:hover {
    text-decoration: none;
    background: var(--hover-tint);
}
a.sales-badge.is-on {
    border-color: var(--accent);
    background: var(--hover-tint);
}
.sales-badge .value {
    font-size: clamp(11px, 1.05vw, 15px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--ink);
    overflow-wrap: anywhere;
}
.sales-badge .label {
    font-size: clamp(8px, 0.75vw, 10px);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 2px;
    color: var(--muted);
}
.sales-badges.is-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.list-search {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    margin-left: auto;
    flex: 0 0 14rem;
    min-width: 14rem;
    max-width: 14rem;
    width: 14rem;
}
.list-search-bar {
    display: flex;
    align-items: center;
    width: 100%;
    height: 36px;
    padding: 0 6px 0 14px;
    border: 0;
    border-radius: 8px;
    background: color-mix(in srgb, var(--ink) 6%, var(--card));
}
.list-search-bar:focus-within {
    outline: 2px solid var(--focus-ring);
}
.list-search-bar input[type="search"] {
    flex: 1;
    min-width: 0;
    width: auto;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 0.875rem;
    color: var(--ink);
    appearance: none;
    -webkit-appearance: none;
}
.list-search-bar input[type="search"]::placeholder {
    color: var(--muted);
    opacity: 0.85;
}
.list-search-bar input[type="search"]:focus {
    outline: none;
    border: 0;
    box-shadow: none;
}
.list-search-bar input[type="search"]::-webkit-search-decoration,
.list-search-bar input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}
.list-search-go,
.list-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
}
.list-search-go:hover,
.list-search-clear:hover {
    color: var(--accent);
    text-decoration: none;
}
.list-search-clear { color: var(--muted); }
.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin: 0 0 12px;
    flex-wrap: nowrap;
}
.list-toolbar .quick-links {
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
}
.list-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.list-foot .actions { margin: 0; }
.list-table .list-row-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    vertical-align: middle;
}
.pager {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    margin-left: auto;
}
.pager-status { font-size: 13px; color: var(--muted); }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr.is-cancelled td { color: var(--muted); }
tr.is-cancelled td a { color: var(--muted); }
.dealer-list { display: grid; gap: 10px; }
.dealer-list button {
    text-align: left;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}
.dealer-list button:hover { border-color: var(--accent); }
.dealer-list strong { display: block; }
.dealer-list span { color: var(--muted); font-size: 13px; }

.qty-grid { overflow-x: auto; margin: 8px 0 16px; }
.qty-grid table { min-width: 480px; }
.qty-grid th, .qty-grid td { text-align: center; }
.qty-grid th:first-child, .qty-grid td:first-child { text-align: left; }
.qty-grid input { width: 72px; text-align: right; padding: 6px 8px; }
.qty-plain {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem);
    gap: 6px;
    max-width: 12rem;
    margin: 4px 0 8px;
}
.qty-plain label { font-weight: 600; font-size: 13px; }
.qty-plain input { width: 100%; text-align: right; padding: 8px 10px; }
.scan-row { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.scan-row input { max-width: 360px; margin: 0; }

.pos-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
    gap: 16px;
    align-items: start;
}
.pos-pay { min-width: 0; }
.pos-party { margin: 0 0 4px; }
.pos-party-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}
.pos-pay .pos-party-row select {
    width: auto;
    flex: 1;
    min-width: 0;
    margin: 0;
}
.pos-party-row .icon-btn,
.pos-party-row .icon-btn.is-solid {
    width: 42px;
    min-width: 42px;
    height: auto;
    align-self: stretch;
    padding: 0;
}
.pos-customer-modal { z-index: 60; }
.pos-customer-card { width: min(460px, 100%); display: flex; flex-direction: column; gap: 12px; }
.pos-customer-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.pos-customer-span { grid-column: 1 / -1; }
.pos-customer-form input,
.pos-customer-form select,
.pos-customer-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px 12px;
    font-size: 16px;
}
.pos-customer-form .actions { margin: 4px 0 0; }
.pos-scan {
    margin: 0 0 16px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--line);
}
.pos-scan-label {
    display: block;
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.pos-scan-bar {
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    height: 56px;
    min-width: 0;
}
.pos-scan-glyph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    color: var(--muted);
    background: color-mix(in srgb, var(--ink) 5%, var(--card));
    border: 1px solid var(--line);
    border-right: 0;
    border-radius: 10px 0 0 10px;
}
.pos-scan-glyph .ui-icon { width: 20px; height: 20px; }
.pos-cart .pos-scan-bar input,
.pos-scan-bar input#barcode {
    flex: 1;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 56px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--ink) 5%, var(--card));
    font-size: 16px;
    font-weight: 600;
    box-shadow: none;
}
.pos-scan-bar input#barcode::placeholder {
    font-weight: 500;
    color: var(--muted);
    opacity: 0.85;
}
.pos-scan-bar:focus-within .pos-scan-glyph,
.pos-scan-bar:focus-within input#barcode {
    border-color: var(--accent);
    background: var(--card);
}
.pos-scan-bar:focus-within input#barcode { outline: none; }
.pos-scan-bar .icon-btn,
.pos-scan-bar .icon-btn.is-solid {
    width: 56px;
    min-width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 0 10px 10px 0;
}
.pos-scan-bar .icon-btn .ui-icon { width: 22px; height: 22px; }
.pos-scan-bar .icon-btn-tip {
    left: auto;
    right: 4px;
    transform: none;
}
.pos-scan-hint {
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
}
.card > .pos-scan {
    position: static;
    margin: 0 0 16px;
    padding: 0 0 16px;
}
.pos-lines-wrap { min-width: 0; }
.pos-lines { margin: 0; }
.pos-lines th.pos-line-remove-head { width: 1%; }
.pos-lines td.pos-line-remove {
    width: 1%;
    text-align: right;
    white-space: nowrap;
    vertical-align: middle;
}
.pos-empty {
    margin: 12px 0 0;
    padding: 18px 14px;
    text-align: center;
    color: var(--muted);
    background: color-mix(in srgb, var(--ink) 4%, var(--card));
    border: 1px dashed var(--line);
    border-radius: 10px;
}
.pos-qty { white-space: nowrap; }
.pos-qty-ctrl {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.pos-item-name { min-width: 0; overflow-wrap: anywhere; }
.pos-grand { font-size: 36px; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.03em; }
.pos-total { margin: 8px 0 0; }
.pos-disc {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    margin: 0 0 10px;
}
.pos-disc input { margin: 0; }
.pos-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin: 0 0 8px;
    font-size: 13px;
}
.pos-breakdown div { display: flex; justify-content: space-between; gap: 8px; }
.pos-breakdown dt { color: var(--muted); font-weight: 500; }
.pos-breakdown dd { margin: 0; font-variant-numeric: tabular-nums; }
.pos-disc-hint { margin: 0 0 8px; font-size: 12px; }
.voucher-after-disc {
    max-width: 18rem;
    margin: 12px 0 0;
}
.voucher-after-disc input { margin: 0; }
.voucher-bill-disc {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    max-width: 28rem;
    margin: 12px 0 8px;
}
.voucher-bill-disc input { margin: 0; }
.voucher-charges {
    display: grid;
    gap: 10px;
    margin: 8px 0 12px;
    max-width: 48rem;
}
.voucher-charge-row {
    display: grid;
    grid-template-columns: 1.4fr 1.4fr 7rem auto;
    gap: 10px 12px;
    align-items: end;
}
.voucher-charge-row input,
.voucher-charge-row select { margin: 0; }
.voucher-charge-actions { padding-bottom: 2px; }
@media (max-width: 720px) {
    .voucher-charge-row { grid-template-columns: 1fr; }
}
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.pay-grid .btn { padding: 14px 12px; }
tr.is-hold td { font-style: italic; }
.qty-btn {
    border: 1px solid var(--line);
    background: #fff;
    width: 28px;
    height: 28px;
    cursor: pointer;
}
.pos-bills { margin: 16px 0 0; min-width: 0; }
.pos-bills .section-title { margin-top: 0; }
.pos-bills + .pos-bills { margin-top: 18px; }
.pos-bills-table { width: 100%; margin: 0; font-size: 13px; }
.pos-bills-table thead { display: none; }
.pos-bills-table tbody { display: grid; gap: 8px; }
.pos-bills-table tbody tr {
    display: block;
    position: relative;
    margin: 0;
    padding: 10px 44px 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--ink) 3%, var(--card));
    min-width: 0;
}
.pos-bills-table td {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    width: 100%;
    border-bottom: 0;
    padding: 3px 0;
    text-align: left;
    overflow-wrap: anywhere;
}
.pos-bills-table td.num { text-align: left; }
.pos-bills-table td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.pos-bills-table td.list-row-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    width: auto;
    padding: 0;
    display: flex;
    grid-template-columns: none;
}
.pos-bills-table td.list-row-actions::before { content: none; }
.scan-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
}
.scan-overlay video {
    width: min(100%, 480px);
    max-height: 70vh;
    background: #000;
}
.is-native-app .pc-only { display: none; }

.bill-list { display: grid; gap: 8px; margin: 8px 0 12px; }
.bill-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    padding: 10px 12px;
    background: #fff;
}
.bill-item span { color: var(--muted); font-size: 13px; }
.item-composer { margin: 8px 0 16px; padding: 12px; border: 1px dashed var(--line); background: #fff; }
.sku-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sku-pick[hidden] { display: none; }
.sku-pick-btn {
    appearance: none;
    border: 1px solid var(--line);
    background: #f8fafc;
    color: var(--ink);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    text-align: left;
}
.sku-pick-btn:hover { border-color: var(--accent, #2563eb); background: #fff; }

@media (max-width: 960px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 40;
        width: min(260px, 86vw);
        height: 100vh;
        height: 100dvh;
        min-height: 100dvh;
        transform: translateX(-100%);
        transition: transform 0.18s ease;
    }
    .sidebar.is-open { transform: none; }
    .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; }
    .pos-shell { grid-template-columns: 1fr; }
    .pos-pay select,
    .pos-pay input {
        font-size: 16px;
    }
    .pos-cart, .pos-pay { padding: 14px; }
    .pos-lines thead { display: none; }
    .pos-lines tbody { display: grid; gap: 8px; }
    .pos-lines tbody tr {
        display: block;
        position: relative;
        margin: 0;
        padding: 12px 44px 12px 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: color-mix(in srgb, var(--ink) 3%, var(--card));
    }
    .pos-lines td {
        display: grid;
        grid-template-columns: 5.5rem minmax(0, 1fr);
        gap: 8px;
        align-items: center;
        width: 100%;
        border-bottom: 0;
        padding: 4px 0;
        text-align: left;
    }
    .pos-lines td.num { text-align: left; }
    .pos-lines td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
    }
    .pos-lines td.pos-line-remove {
        position: absolute;
        top: 8px;
        right: 8px;
        width: auto;
        padding: 0;
        display: block;
        grid-template-columns: none;
    }
    .pos-lines td.pos-line-remove::before { content: none; }
    .stats { grid-template-columns: 1fr 1fr; }
    .stats-home {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        margin: 12px 0 16px;
    }
    .stats-home .stat { padding: 8px 6px; }
    .stats-home .stat .value { font-size: 16px; line-height: 1.2; }
    .stats-home .stat .label { font-size: 10px; line-height: 1.2; }
    .sales-badges { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
    .sales-badge { padding: 6px 7px; }
    .sales-badge .value { font-size: 13px; }
    .sales-badge .label { font-size: 9px; }
    .list-toolbar { gap: 8px; }
    .list-search { width: 14rem; flex-basis: 14rem; max-width: 14rem; }
    .wrap { padding: 16px 14px 40px; }
    .wrap-pos { padding: 12px 12px 28px; }
    .topbar { padding: 10px 12px; gap: 8px; }
    .topbar-title { font-size: 16px; }
    .topbar-meta { display: none; }
    .actions { gap: 6px; }
    .dash-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
    .dash-link { min-height: 76px; padding: 10px 6px 8px; }
    .dash-link-name { font-size: 11px; }
    .scan-row { flex-wrap: wrap; }
    .scan-row input { max-width: none; flex: 1; min-width: 0; }
    .pay-grid { grid-template-columns: 1fr 1fr; }
    table { font-size: 13px; }
}

@media (max-width: 840px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-panel { padding: 28px 24px; min-height: auto; }
    .stats { grid-template-columns: 1fr; }
    .stats-home {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        margin: 10px 0 14px;
    }
    .stats-home .stat { padding: 6px 4px; }
    .stats-home .stat .value { font-size: 15px; }
    .stats-home .stat .label { font-size: 9px; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .sales-badges { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
    .sales-badge { padding: 5px 6px; border-radius: 0; }
    .sales-badge .value { font-size: 12px; }
    .sales-badge .label { font-size: 8px; letter-spacing: 0.03em; }
    .list-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .list-search {
        width: 100%;
        max-width: none;
        flex: 1 1 auto;
        margin-left: 0;
    }
    .list-search-bar {
        height: 44px;
        padding: 0 4px 0 12px;
        border-radius: 10px;
    }
    .list-search-bar input[type="search"] {
        height: 44px;
        font-size: 16px;
    }
    .list-search-go,
    .list-search-clear {
        width: 44px;
        height: 44px;
    }
    .list-search-go .ui-icon,
    .list-search-clear .ui-icon {
        width: 18px;
        height: 18px;
    }
    .list-card {
        overflow: visible;
        padding: 10px;
    }
    .list-table { font-size: 14px; }
    .list-table thead { display: none; }
    .list-table tbody,
    .list-table tr,
    .list-table td { display: block; width: 100%; }
    .list-table tbody { display: grid; gap: 8px; }
    .list-table tbody tr {
        position: relative;
        margin: 0;
        padding: 10px 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--card);
    }
    .list-table tbody tr:has(.bulk-id) { padding-left: 36px; }
    .list-table tbody tr:has(.list-row-actions) { padding-right: 80px; }
    .list-table td {
        display: grid;
        grid-template-columns: 7.25rem minmax(0, 1fr);
        gap: 8px;
        align-items: center;
        border-bottom: 0;
        padding: 3px 0;
        text-align: left;
    }
    .list-table td.num { text-align: left; }
    .list-table td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
    }
    .list-table td.list-check {
        position: absolute;
        left: 8px;
        top: 12px;
        width: auto;
        display: block;
        padding: 0;
        grid-template-columns: none;
    }
    .list-table td.list-check::before { content: none; }
    .list-table tr.is-empty {
        padding: 16px 12px;
        text-align: center;
    }
    .list-table td.list-empty {
        display: block;
        padding: 0;
        text-align: center;
        color: var(--muted);
    }
    .list-table td.list-empty::before { content: none; }
    .list-table td.list-row-actions {
        position: absolute;
        top: 8px;
        right: 8px;
        width: auto;
        padding: 0;
        display: flex;
        gap: 4px;
        grid-template-columns: none;
    }
    .list-table td.list-row-actions::before { content: none; }
    .list-table td.list-line-no { display: none; }
    .list-foot { margin-top: 10px; }
    .pager { margin-left: 0; }
    .pos-cart, .pos-pay { padding: 14px; }
    .pos-scan {
        position: sticky;
        top: 0;
        z-index: 4;
        margin: -14px -14px 14px;
        padding: 12px 14px 12px;
        background: var(--card);
    }
    .pos-scan-bar,
    .pos-scan-glyph,
    .pos-cart .pos-scan-bar input,
    .pos-scan-bar input#barcode,
    .pos-scan-bar .icon-btn,
    .pos-scan-bar .icon-btn.is-solid {
        height: 52px;
    }
    .pos-scan-glyph,
    .pos-scan-bar .icon-btn,
    .pos-scan-bar .icon-btn.is-solid {
        width: 52px;
        min-width: 52px;
    }
    .pos-grand { font-size: 28px; }
    .pos-qty-ctrl { justify-content: flex-start; }
    .pos-customer-form { grid-template-columns: 1fr; }
    .pay-grid { gap: 10px; }
    .pay-grid .icon-btn.has-caption { min-height: 64px; }
}

@media (max-width: 480px) {
    .sales-badges { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
    .sales-badge { padding: 4px 4px; }
    .sales-badge .value { font-size: 11px; }
    .sales-badge .label { font-size: 8px; letter-spacing: 0.02em; }
    .list-table td { grid-template-columns: 5.75rem minmax(0, 1fr); gap: 6px; font-size: 13px; }
    .list-table td a { overflow-wrap: anywhere; }
    .pos-scan-bar input#barcode { font-size: 16px; padding: 0 10px; }
    .pos-scan-glyph { display: none; }
    .pos-cart .pos-scan-bar input,
    .pos-scan-bar input#barcode {
        border-left: 1px solid var(--line);
        border-radius: 10px 0 0 10px;
    }
    .pos-scan-bar:focus-within input#barcode { border-left-color: var(--accent); }
    .pos-lines td { grid-template-columns: 4.75rem minmax(0, 1fr); }
    .pos-bills-table td { grid-template-columns: 4.75rem minmax(0, 1fr); }
}

#voucher-form .pos-scan-bar,
#voucher-form .pos-scan-glyph,
#voucher-form .pos-scan-bar input#barcode,
#voucher-form .pos-scan-bar .icon-btn,
#voucher-form .pos-scan-bar .icon-btn.is-solid {
    height: 40px;
    border-radius: 0;
}
#voucher-form .pos-scan-glyph,
#voucher-form .pos-scan-bar .icon-btn,
#voucher-form .pos-scan-bar .icon-btn.is-solid {
    width: 40px;
    min-width: 40px;
    padding: 0;
}
#voucher-form .pos-scan-glyph .ui-icon { width: 16px; height: 16px; }
#voucher-form .pos-scan-bar .icon-btn .ui-icon { width: 18px; height: 18px; }
#voucher-form #lines th,
#voucher-form #lines td {
    padding: 0 6px;
    vertical-align: middle;
}
#voucher-form #lines .line input:not([type=hidden]) {
    height: 40px;
    padding: 0 10px;
}
#voucher-form #lines td.line-remove {
    width: 1%;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}
#voucher-form #lines-empty {
    margin: 0 0 12px;
    padding: 14px 12px;
    text-align: center;
    border: 1px dashed var(--line);
    background: color-mix(in srgb, var(--ink) 4%, var(--card));
}
#voucher-form .actions.icon-row {
    margin-top: 20px;
}

@media (max-width: 720px) {
    #voucher-form #lines thead { display: none; }
    #voucher-form #lines tbody { display: grid; gap: 8px; }
    #voucher-form #lines tbody tr.line {
        display: block;
        position: relative;
        margin: 0;
        padding: 10px 44px 10px 12px;
        border: 1px solid var(--line);
        background: var(--card);
    }
    #voucher-form #lines td {
        display: grid;
        grid-template-columns: 5.5rem minmax(0, 1fr);
        gap: 8px;
        align-items: center;
        width: 100%;
        border-bottom: 0;
        padding: 4px 0;
        text-align: left;
    }
    #voucher-form #lines td.num { text-align: left; }
    #voucher-form #lines td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
    }
    #voucher-form #lines td.line-remove {
        position: absolute;
        top: 8px;
        right: 8px;
        width: auto;
        padding: 0;
        display: block;
        grid-template-columns: none;
    }
    #voucher-form #lines td.line-remove::before { content: none; }
}

@media (max-width: 480px) {
    #voucher-form #lines td { grid-template-columns: 4.75rem minmax(0, 1fr); }
}

.voucher-show h1 { overflow-wrap: anywhere; }
.voucher-show .totals { overflow-wrap: anywhere; }
@media (max-width: 720px) {
    .voucher-show h1 { font-size: 1.25rem; }
    .voucher-show .muted { overflow-wrap: anywhere; }
    .voucher-show .totals { text-align: left; }
    .voucher-show .gst-summary { max-width: none; }
    .voucher-show .list-table td { overflow-wrap: anywhere; }
}

.gst-summary { margin: 12px 0; max-width: 28rem; }
.gst-summary th, .gst-summary td { font-size: 13px; }
.gst-tabs { display: flex; gap: 6px; margin: 0 0 16px; flex-wrap: wrap; align-items: center; }
.gst-tabs a:not(.icon-btn) {
    display: inline-flex;
    padding: 8px 12px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    font-weight: 600;
    font-size: 13px;
}
.gst-tabs a:not(.icon-btn).is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.gst-tabs a:not(.icon-btn):hover { text-decoration: none; }
.toolbar select { margin: 0; width: auto; }
.perm-wrap { overflow-x: auto; }
.perm-table { min-width: 520px; }
.perm-table th, .perm-table td { vertical-align: middle; }
.perm-table th:not(:first-child), .perm-table td:not(:first-child) { text-align: center; width: 8rem; }
.perm-table input[type="checkbox"] { width: auto; margin: 0; }
.perm-table select { width: auto; min-width: 10rem; margin: 0; }
.perm-group td { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--hover-tint); font-weight: 700; border-bottom: 0; }

.scheme-picker { margin: 0; }
.radio-stack { display: flex; flex-direction: column; gap: 6px; }
.radio-line { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.radio-line input { width: auto; margin: 0; }
.scheme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 8px;
    margin: 0 0 16px;
}
.scheme-choice {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--line);
    background: var(--card);
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    color: var(--ink);
}
.scheme-choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.scheme-choice:has(input:checked) {
    border-color: var(--accent);
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.scheme-thumb { display: flex; height: 36px; overflow: hidden; border: 1px solid var(--line); }
.scheme-thumb b, .scheme-thumb span, .scheme-thumb i { display: block; }
.scheme-thumb b { width: 16px; }
.scheme-thumb span { flex: 1; }
.scheme-thumb i { width: 22px; }
.scheme-tag { font-size: 10px; color: var(--muted); font-weight: 600; }

@media print {
    @page {
        size: A4;
        margin: 12mm;
    }
    .sidebar,
    .topbar,
    .sidebar-toggle,
    .sidebar-backdrop,
    .no-print,
    .flash,
    .sidebar-logout,
    .help-modal,
    .help-icon,
    .report-screen,
    .gst-tabs {
        display: none !important;
    }
    .print-only { display: block !important; }
    .report-print {
        display: block !important;
        font-family: DejaVu Sans, "Segoe UI", Tahoma, sans-serif;
        font-size: 10px;
        color: #1c1917;
    }
    .app-shell { display: block !important; }
    .app-main, .wrap { margin: 0 !important; padding: 0 !important; max-width: none !important; }
    .card { box-shadow: none; border: none; background: #fff; }
    .list-table thead { display: table-header-group !important; }
    .list-table,
    .list-table tbody { display: table !important; width: 100% !important; }
    .list-table tbody { display: table-row-group !important; }
    .list-table tr {
        display: table-row !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }
    .list-table td {
        display: table-cell !important;
        width: auto !important;
        padding: 8px 6px !important;
        border-bottom: 1px solid var(--line) !important;
        grid-template-columns: none !important;
        position: static !important;
    }
    .list-table td::before { display: none !important; }
    body, .app-body { background: #fff !important; color: #1c1917 !important; }
    a { color: inherit !important; text-decoration: none !important; }
    .report-print-table thead { display: table-header-group; }
    .report-print-table tr { break-inside: avoid; page-break-inside: avoid; }
}
