/* ==========================================================
   1. Design tokens: change the look of the whole system here
   ========================================================== */
:root {
    /* Brand color: overridden from Settings (theme partial) */
    --color-primary: #2563eb;

    /* Neutrals */
    --color-bg: #f6f7f9;
    --color-surface: #ffffff;
    --color-text: #111827;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;

    /* Status */
    --color-danger: #dc2626;
    --color-danger-soft: #fef2f2;
    --color-success: #16a34a;
    --color-success-soft: #f0fdf4;

    /* Derived from the brand color automatically */
    --color-on-primary: #ffffff;
    --color-primary-ink: var(--color-primary);
    --color-primary-hover: color-mix(in srgb, var(--color-primary) 85%, black);
    --color-primary-soft: color-mix(in srgb, var(--color-primary-ink) 10%, white);

    /* Shape */
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, .08);
}

/* ==========================================================
   2. Base
   ========================================================== */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

h1 { margin: 0 0 16px; font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; }
a { color: var(--color-primary); }
.muted { color: var(--color-muted); font-size: .9rem; }

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ==========================================================
   3. Buttons
   ========================================================== */
button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 20px; padding: 11px 18px;
    font: inherit; font-size: .95rem; font-weight: 600;
    background: var(--color-primary); color: var(--color-on-primary);
    border: 1px solid color-mix(in srgb, var(--color-primary) 85%, black); border-radius: var(--radius-sm);
    cursor: pointer; text-decoration: none;
    transition: background .15s, box-shadow .15s;
    white-space: nowrap;
}
button:hover, .btn:hover { background: var(--color-primary-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn { margin-top: 0; }

.btn-secondary, .btn-ghost, .menu-btn {
    margin: 0;
    background: var(--color-surface); color: var(--color-text);
    border-color: var(--color-border);
}
.btn-secondary:hover, .btn-ghost:hover, .menu-btn:hover { background: var(--color-bg); }

.btn-danger { background: var(--color-danger); color: #fff; border-color: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--color-danger) 85%, black); }

.btn-link {
    margin: 0; padding: 0; background: none; border: 0;
    color: var(--color-primary); font-weight: 500;
}
.btn-link:hover { background: none; text-decoration: underline; }

.menu-btn { display: none; }

/* ==========================================================
   4. Forms
   ========================================================== */
label { display: block; margin: 16px 0 6px; font-size: .875rem; font-weight: 500; }

input, select {
    width: 100%; padding: 11px 12px;
    font: inherit; font-size: 1rem;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
input[type="color"] { height: 46px; padding: 4px; }
input[type="checkbox"] { width: auto; }

.check { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 500; }
.form { max-width: 520px; }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.form-actions button { margin-top: 0; }

textarea {
    width: 100%; padding: 11px 12px;
    font: inherit; font-size: 1rem; resize: vertical;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
}
textarea:focus {
    outline: none;
    border-color: var(--color-primary-ink);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.gen-form { margin-top: 20px; }
.gen-form h2 { margin: 0 0 4px; font-size: 1.1rem; }
.group-head { display: flex; align-items: center; gap: 16px; margin: 20px 0 10px; }
.chip-all { margin: 0; font-size: .85rem; color: var(--color-muted); font-weight: 500; display: flex; align-items: center; gap: 6px; cursor: pointer; }

.chip {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0 8px 8px 0; padding: 8px 14px;
    border: 1px solid var(--color-border); border-radius: 999px;
    font-size: .92rem; font-weight: 500; cursor: pointer;
    background: var(--color-surface);
}
.chip:hover { background: var(--color-bg); }
.chip:has(input:checked) {
    background: var(--color-primary-soft);
    border-color: var(--color-primary-ink);
}
.chip .swatch { margin-right: 0; }

.inline-label { margin: 0; white-space: nowrap; }
.fill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; padding: 16px 20px; }
.fill-row input { width: 140px; }
.qty-input  { width: 110px; }
.cost-input { width: 140px; }

.payment-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 4px; }
.payment-form select { width: auto; min-width: 170px; }
.payment-form button { margin: 0; }

.pin-mask { -webkit-text-security: disc; text-security: disc; }

/* ==========================================================
   5. Cards, tables, badges, alerts
   ========================================================== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px;
}
.page-head h1 { margin: 0; }

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 14px 16px; text-align: left; vertical-align: top;
    border-bottom: 1px solid var(--color-border);
}
.table th {
    font-size: .75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--color-muted); background: #fafafa;
}
.table tbody tr:hover { background: #fafafa; }
.table tr:last-child td { border-bottom: 0; }

.row-actions { display: flex; align-items: center; gap: 16px; }
.row-actions a { font-weight: 500; text-decoration: none; }
.row-actions a:hover { text-decoration: underline; }
form.inline { display: inline; margin: 0; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: .78rem; font-weight: 600;
}
.badge-ok  { background: var(--color-success-soft); color: #166534; }
.badge-off { background: #f3f4f6; color: var(--color-muted); }

.alert {
    background: var(--color-danger-soft); color: #991b1b;
    border: 1px solid #fecaca; border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: .92rem;
}
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: var(--color-success-soft); color: #166534; border-color: #bbf7d0; }
.content .alert { margin-bottom: 16px; }

.badge-danger { background: var(--color-danger-soft); color: #991b1b; }
.badge-warn   { background: #fffbeb; color: #92400e; }

.stats {
    display: grid; gap: 14px; margin-bottom: 20px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
}
.stat-label { font-size: .8rem; color: var(--color-muted); font-weight: 500; }
.stat-value { margin-top: 4px; font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; }

.qty-in  { color: var(--color-success); font-weight: 600; }
.qty-out { color: var(--color-danger);  font-weight: 600; }

/* ==========================================================
   6. App shell: sidebar, top bar, content
   ========================================================== */
.shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }

.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 20px 14px;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px 20px; font-weight: 700; font-size: 1.1rem;
}
.brand::before {
    content: ""; width: 12px; height: 12px; border-radius: 4px;
    background: var(--color-primary);
}

.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--color-muted); font-weight: 500; text-decoration: none;
    transition: background .15s, color .15s;
}
.nav a:hover { background: var(--color-bg); color: var(--color-text); }
.nav a.active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: 14px;
    padding: 12px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.topbar .spacer { flex: 1; }
.topbar .who span { display: block; }
.content { padding: 28px 24px; width: 100%; max-width: 1100px; }
.page { max-width: 960px; margin: 0 auto; padding: 24px 16px; }

.overlay { display: none; }

.nav-title {
    padding: 18px 12px 6px;
    font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--color-muted);
}

/* ==========================================================
   7. Login page
   ========================================================== */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 32px;
}
.auth-card h1 { margin: 0 0 20px; font-size: 1.4rem; }
.auth-card button { width: 100%; }

.icon { width: 20px; height: 20px; flex: none; }

.user { display: flex; align-items: center; gap: 10px; }
.user .who { line-height: 1.3; text-align: left; }
.avatar {
    display: grid; place-items: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--color-primary-soft); color: var(--color-primary);
    font-size: .85rem; font-weight: 700;
}

/* ==========================================================
   9. Readable colors for any theme color
   ========================================================== */
a, .btn-link, .nav a.active, .avatar { color: var(--color-primary-ink); }
:focus-visible { outline-color: var(--color-primary-ink); }
input:focus, select:focus { border-color: var(--color-primary-ink); }
.brand::before { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }

/* ==========================================================
   Icons and Buttons
   ========================================================== */

/* Icons inside buttons are slightly smaller than menu icons */
button .icon, .btn .icon { width: 18px; height: 18px; }

/* Icon-only buttons (table actions), styled as real buttons */
.icon-btn {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; margin: 0; padding: 0;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    cursor: pointer; text-decoration: none;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.icon-btn:hover { background: var(--color-bg); border-color: #d1d5db; box-shadow: var(--shadow-md); }

.icon-btn-danger { color: var(--color-danger); background: var(--color-danger-soft); border-color: #fecaca; }
.icon-btn-danger:hover { background: #fee2e2; border-color: #fca5a5; }

.icon-btn-ok { color: var(--color-success); background: var(--color-success-soft); border-color: #bbf7d0; }
.icon-btn-ok:hover { background: #dcfce7; border-color: #86efac; }

.row-actions { gap: 8px; }
.row-actions a.icon-btn:hover { text-decoration: none; }

/* ==========================================================
   10. Confirmation dialog
   ========================================================== */
dialog.modal {
    width: min(92vw, 400px);
    padding: 0; border: 0; border-radius: var(--radius);
    background: var(--color-surface); color: var(--color-text);
    box-shadow: var(--shadow-md);
}
dialog.modal[open] { animation: modal-in .15s ease-out; }
dialog.modal::backdrop { background: rgba(17, 24, 39, .45); backdrop-filter: blur(2px); }

.modal-box { padding: 24px; }
.modal-title { margin: 0 0 8px; font-size: 1.15rem; font-weight: 650; }
.modal-text { margin: 0 0 24px; color: var(--color-muted); }
.modal-box > .alert { margin-top: 12px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-actions > button { margin: 0; min-height: 44px; white-space: normal; }

@keyframes modal-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.swatch {
    display: inline-block; width: 14px; height: 14px; margin-right: 8px;
    border: 1px solid var(--color-border); border-radius: 50%;
    vertical-align: -2px;
}

/* ==========================================================
   Paginations and Filters
   ========================================================== */

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.filters input { flex: 1; min-width: 200px; width: auto; }
.filters select { width: auto; min-width: 180px; }
.filters button { margin: 0; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 8px; }
.pagination a { font-weight: 500; text-decoration: none; }
.pagination a:hover { text-decoration: underline; }

/* ==========================================================
   Purchase orders
   ========================================================== */

.badge-info   { background: #dbeafe; color: #1e40af; }
.badge-closed { background: #ede9fe; color: #5b21b6; }

.details {
    display: grid; gap: 18px; margin-bottom: 8px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.details div { display: flex; flex-direction: column; gap: 2px; }
.details .wide { grid-column: 1 / -1; }
.details .muted { font-size: .8rem; }

.section-title { margin: 28px 0 12px; font-size: 1.1rem; font-weight: 650; }
.total-label { text-align: right; color: var(--color-muted); }
.table tfoot td { border-top: 1px solid var(--color-border); border-bottom: 0; background: #fafafa; }

.head-actions { display: flex; align-items: center; gap: 12px; }

.pick-list { display: flex; flex-direction: column; gap: 4px; padding: 8px; margin-bottom: 8px; }
.pick {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--color-text); text-decoration: none;
}
.pick:hover { background: var(--color-bg); }
.pick-on { background: var(--color-primary-soft); }

.head-actions { flex-wrap: wrap; justify-content: flex-end; }

/* ==========================================================
   8. Small screens: sidebar becomes a slide-in drawer
   ========================================================== */
@media (max-width: 1024px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; top: 0; bottom: 0; left: 0; height: auto; width: 270px;
        transform: translateX(-100%); transition: transform .2s; z-index: 20;
        box-shadow: var(--shadow-md);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .overlay {
        display: block; position: fixed; inset: 0;
        background: rgba(0, 0, 0, .35); z-index: 10;
    }
    .menu-btn { display: inline-flex; }
    .topbar { padding: 10px 16px; }
    .content { padding: 20px 16px; }
}

@media (max-width: 800px) {
    .btn-ghost .label { display: none; }
    .user .who { display: none; }
}

/* ==========================================================
   11. Phones
   ========================================================== */
.page-head { flex-wrap: wrap; }
.page-head h1 { overflow-wrap: anywhere; }
.cell { display: block; }

@media (max-width: 640px) {
    h1 { font-size: 1.3rem; }
    /* .card { padding: 16px; } */

    /* Heading: title on top, then status and buttons across the full width */
    .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
    .page-head > .btn { width: 100%; }
    .head-actions { width: 100%; justify-content: flex-start; }
    .head-actions .badge { order: -1; margin-right: 100%; }
    .head-actions > .btn,
    .head-actions > form.inline { flex: 1 1 140px; }
    .head-actions form.inline .btn { width: 100%; }
    .head-actions > form.inline:has(.icon-btn) { flex: 0 0 auto; }

    /* Search and filter bars */
    .filters input, .filters select { flex: 1 1 100%; width: 100%; min-width: 0; }
    .filters button { flex: 1 1 auto; }

    /* Detail cards and numbers */
    .details { grid-template-columns: 1fr 1fr; gap: 14px; }
    .details > div { min-width: 0; overflow-wrap: anywhere; }
    .stats { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 1.25rem; }

    /* Tables become stacked cards */
    .card.table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
    .table thead { display: none; }
    .table, .table tbody, .table tfoot, .table tr { display: block; width: 100%; }
    .table tr {
        margin-bottom: 12px; padding: 4px 14px;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
    }
    .table tbody tr:hover { background: var(--color-surface); }
    .table td {
        display: flex; align-items: center; justify-content: flex-end; gap: 16px;
        width: 100%; padding: 10px 0; text-align: right;
        border-bottom: 1px solid var(--color-border);
    }
    .table tr td:last-child { border-bottom: 0; }
    .table td[data-label]::before {
        content: attr(data-label); flex: none; text-align: left;
        font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
        color: var(--color-muted);
    }
    .table td[data-label] { justify-content: space-between; }
    .table td[colspan] { justify-content: flex-start; text-align: left; }
    .table td .cell { min-width: 0; overflow-wrap: anywhere; }
    .table tfoot td.total-label { justify-content: flex-end; }
    .table tfoot td { background: none; border-top: 0; }

    /* Number boxes inside cards */
    .table td .qty-input, .table td .cost-input { width: 120px; }
}

.setup { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
.setup .setup-search { grid-column: 1 / -1; }
.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1; min-width: 0; }
.search-row button { margin: 0; }

@media (max-width: 640px) {
    .setup { grid-template-columns: 1fr; }
    .search-row { flex-direction: column; }
}

.notice {
    background: #eff6ff; color: #1e40af;
    border: 1px solid #bfdbfe; border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: .92rem; margin-bottom: 16px;
}
.notice a { color: inherit; font-weight: 600; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 12px; }
.tabs a {
    padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--color-border); background: var(--color-surface);
    color: var(--color-text); font-size: .9rem; font-weight: 500; text-decoration: none;
}
.tabs a:hover { background: var(--color-bg); }
.tabs a.tab-on { background: var(--color-primary-soft); border-color: var(--color-primary-ink); color: var(--color-primary-ink); }

.table tr.row-focus td { background: var(--color-primary-soft); }
@media (max-width: 640px) {
    .table tr.row-focus { background: var(--color-primary-soft); }
    .table tr.row-focus td { background: none; }
}

/* ==========================================================
   12. Point of sale
   ========================================================== */
.pos { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
@media (max-width: 900px) { .pos { grid-template-columns: 1fr; } }

.pos-search input { font-size: 1.1rem; padding: 14px; }

.results { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 60vh; overflow-y: auto; }
.result {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; margin: 0; padding: 12px 14px; text-align: left;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    font-weight: 500;
}
.result:hover:not(:disabled) { background: var(--color-primary-soft); border-color: var(--color-primary-ink); }
.result:disabled, .result:disabled:hover { background: var(--color-bg); color: var(--color-muted); cursor: not-allowed; }
.result-main, .result-side { display: flex; flex-direction: column; min-width: 0; }
.result-main { overflow-wrap: anywhere; }
.result-side { text-align: right; flex: none; }

.cart-line {
    display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
    padding: 12px 0; border-bottom: 1px solid var(--color-border);
}
.cart-line:last-child { border-bottom: 0; }
.cart-name { font-weight: 600; overflow-wrap: anywhere; }
.cart-total { font-weight: 650; text-align: right; }
.cart-controls { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stepper { display: inline-flex; align-items: center; gap: 12px; }
.step-qty { min-width: 28px; text-align: center; font-weight: 650; font-size: 1.1rem; }

.step-btn {
    margin: 0; width: 44px; height: 44px; padding: 0; font-size: 1.4rem; line-height: 1;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border);
}
.step-btn:hover:not(:disabled) { background: var(--color-bg); }
.step-btn:disabled, .step-btn:disabled:hover { background: var(--color-bg); color: var(--color-muted); }
.step-remove { color: var(--color-danger); }

.cart-sums { display: grid; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.cart-sums .row { display: flex; justify-content: space-between; gap: 12px; }
.cart-sums .grand { font-size: 1.5rem; font-weight: 700; }

.cart-actions { display: flex; gap: 10px; margin-top: 16px; }
.cart-actions .btn { flex: 1 1 160px; }

#pin-input { margin-bottom: 12px; font-size: 1.2rem; text-align: center; }
#pin-error { margin-bottom: 12px; }

/* ==========================================================
   13. Point of sale screen
   ========================================================== */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The register has no permanent sidebar: the menu slides in when you press the menu button */
.pos-shell .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; height: auto; width: 270px;
    transform: translateX(-100%); transition: transform .2s; z-index: 30;
    box-shadow: var(--shadow-md);
}
body.nav-open .pos-shell .sidebar { transform: none; }
body.nav-open .pos-shell .overlay {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25;
}
.pos-shell .menu-btn { display: inline-flex; }

.pos-top {
    position: sticky; top: 0; z-index: 10; height: 56px;
    display: flex; align-items: center; gap: 12px; padding: 0 16px;
    background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.pos-top .spacer { flex: 1; }
.pos-title { display: inline-flex; align-items: center; gap: 8px; }
.pos-main { padding: 14px 16px 16px; }

.pos2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - 56px - 30px); }
.pane {
    display: flex; flex-direction: column; min-height: 0;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.pane-items { padding: 16px; }
.search-bar input { font-size: 1.15rem; padding: 14px; }
.pane-items #pos-msg { margin-top: 12px; }
.pane-items .results { flex: 1; max-height: none; overflow-y: auto; margin-top: 12px; }

.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px 10px; }
.ticket-head h2 { margin: 0; font-size: 1.1rem; margin-right: auto; }
.ticket-close { display: none; margin: 0; }
.ticket-lines { flex: 1; overflow-y: auto; padding: 0 16px; }
.empty-cart { padding: 20px 0; text-align: center; }
.ticket-lines { border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.ticket-foot { padding: 12px 16px 16px; }
.ticket-foot .cart-sums { margin-top: 0; padding-top: 0; border-top: 0; }
.ticket-foot .cart-actions .charge { flex: 1 1 100%; }

.qty-pill {
    margin: 0; display: inline-flex; align-items: center; gap: 10px;
    padding: 8px 14px; min-height: 44px;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); font-weight: 500;
}
.qty-pill span { color: var(--color-primary-ink); font-size: .85rem; font-weight: 600; }
.qty-pill:hover { background: var(--color-bg); }

.qty-big { font-size: 1.5rem; text-align: center; margin: 8px 0; }

.cart-bar { display: none; }

@media (max-width: 900px) {
    .pos2 { display: block; height: auto; padding-bottom: 84px; }
    .pane-items { min-height: calc(100vh - 56px - 110px); }

    .pane-ticket {
        display: none; position: fixed; top: 56px; right: 0; bottom: 0; left: 0; z-index: 15;
        border-radius: 0; border: 0;
    }
    .pos2.show-cart .pane-ticket { display: flex; }
    .ticket-close { display: inline-flex; }

    .cart-bar {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 12;
        margin: 0; padding: 16px 18px; border-radius: var(--radius);
        box-shadow: var(--shadow-md); font-size: 1rem;
    }
}

@media (max-width: 640px) {
    .pos-top .pos-title{display:none;}
}

/* ==========================================================
   14. Tiles, picker and scanner extras
   ========================================================== */
[hidden] { display: none !important; }

.items-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }
.seg-btn {
    margin: 0; border: 0; border-radius: 0; min-height: 44px; padding: 10px 18px;
    background: var(--color-surface); color: var(--color-text); font-weight: 500;
}
.seg-btn:hover { background: var(--color-bg); }
.seg-btn.on { background: var(--color-primary); color: var(--color-on-primary); }
.sound-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .85rem; color: var(--color-muted); cursor: pointer; }

.tiles-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 12px; }
.cat-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.cat-chip {
    margin: 0; flex: none; min-height: 40px; padding: 8px 16px; border-radius: 999px;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); font-weight: 500;
}
.cat-chip:hover { background: var(--color-bg); }
.cat-chip.on { background: var(--color-primary-soft); border-color: var(--color-primary-ink); color: var(--color-primary-ink); }

.tile-grid {
    flex: 1; overflow-y: auto; display: grid; gap: 10px; align-content: start; padding: 2px 2px 8px;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
.tile {
    margin: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
    gap: 8px; min-height: 108px; padding: 12px; text-align: left;
    color: var(--color-text); border: 1px solid var(--color-border); font-weight: 500;
}
.tile:hover:not(:disabled) { border-color: var(--color-primary-ink); box-shadow: var(--shadow-md); }
.tile:disabled { opacity: .5; cursor: not-allowed; }
.tile-initials {
    width: 36px; height: 36px; display: grid; place-items: center;
    border-radius: 10px; background: rgba(255, 255, 255, .75); font-weight: 700;
}
.tile-name { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.tile-price { font-size: .85rem; color: var(--color-muted); }
#tile-more { align-self: center; margin: 8px 0 0; }

#pick-dialog { width: min(94vw, 520px); }
.pick-label {
    margin: 14px 0 6px; font-size: .8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; color: var(--color-muted);
}
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
    margin: 0; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); font-weight: 500;
}
.opt small { color: var(--color-muted); font-size: .75rem; }
.opt:hover:not(:disabled) { background: var(--color-bg); }
.opt.on { background: var(--color-primary-soft); border-color: var(--color-primary-ink); color: var(--color-primary-ink); }
.opt:disabled { opacity: .45; cursor: not-allowed; }
.opt .swatch { margin-right: 0; }

/* ==========================================================
   15. Product photos
   ========================================================== */
.photo-current { display: flex; align-items: center; gap: 14px; margin: 6px 0 12px; }
.photo-current img { border-radius: var(--radius-sm); border: 1px solid var(--color-border); object-fit: cover; }
.photo-current .check { margin-top: 0; }

.name-cell { display: flex; align-items: center; gap: 12px; }
.thumb {
    flex: none; width: 40px; height: 40px; border-radius: 8px; object-fit: cover;
    border: 1px solid var(--color-border); background: var(--color-bg);
}

/* Register tiles: photo on top, name and price below */
.tile { padding: 0; min-height: 0; gap: 0; overflow: hidden; background: var(--color-surface); align-items: stretch; justify-content: flex-start; }
.tile-img { display: block; width: 100%; aspect-ratio: 1 / 1; background: var(--color-bg); }
.tile-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }

.ph { display: grid; place-items: center; color: var(--color-muted); }
.tile-img.ph svg { width: 34%; height: 34%; }

/* Register search results: small photo on the left */
.result-img { flex: none; width: 48px; height: 48px; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-bg); }
.result-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.result-img.ph svg { width: 55%; height: 55%; }
.result-main { flex: 1; }

/* Light buttons keep a light background on hover, whatever the theme color is */
.tile:hover:not(:disabled) { background: var(--color-primary-soft); }
.tile:disabled, .tile:disabled:hover { background: var(--color-surface); }
.opt:disabled, .opt:disabled:hover { background: var(--color-surface); }

.btn-secondary.is-danger { color: var(--color-danger); border-color: #fecaca; background: var(--color-danger-soft); }
.btn-secondary.is-danger:hover { background: #fee2e2; }

/* ==========================================================
   16. Payment screen and receipt
   ========================================================== */
#pay-dialog { width: min(94vw, 520px); max-height: 94vh; overflow-y: auto; }
.pay-total { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 14px; }
.pay-total strong { font-size: 2rem; }
.pay-methods { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pay-method { min-height: 44px; }

.pay-line {
    display: grid; gap: 8px; margin-bottom: 10px; padding: 10px 12px;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
}
.pay-line-head { display: flex; align-items: center; justify-content: space-between; }
.pay-amount { font-size: 1.3rem; }

.pay-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px; }
.quick {
    margin: 0; min-height: 44px; padding: 8px 14px;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); font-weight: 500;
}
.quick:hover { background: var(--color-primary-soft); border-color: var(--color-primary-ink); }

.pay-sums { display: grid; gap: 6px; margin: 12px 0; padding-top: 12px; border-top: 1px solid var(--color-border); }
.pay-sums .row { display: flex; justify-content: space-between; gap: 12px; }
.pay-sums .big { font-size: 1.4rem; font-weight: 700; }

.receipt-wrap { max-width: 440px; margin: 0 auto; }
.receipt { padding: 22px; font-variant-numeric: tabular-nums; }
.r-head { text-align: center; margin-bottom: 14px; }
.r-shop { font-size: 1.2rem; }
.r-meta { display: grid; gap: 2px; padding: 10px 0; border-top: 1px dashed var(--color-border); border-bottom: 1px dashed var(--color-border); font-size: .92rem; }
.r-lines { margin: 8px 0; }
.r-line { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 6px 0; border-bottom: 1px dashed var(--color-border); }
.r-desc { font-weight: 600; overflow-wrap: anywhere; }
.r-amt { text-align: right; font-weight: 600; }
.r-sub { grid-column: 1 / -1; color: var(--color-muted); font-size: .82rem; }
.r-sums { margin-top: 8px; }
.r-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.r-total { font-size: 1.25rem; font-weight: 700; padding: 8px 0; border-top: 1px solid var(--color-border); margin-top: 6px; }
.r-foot { text-align: center; margin-top: 14px; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.receipt-actions .btn { flex: 1 1 160px; min-height: 44px; }
#pay-error { margin-bottom: 12px; }

@media print {
    .pos-top, .sidebar, .overlay, .no-print { display: none !important; }
    body, .pos-body { background: #fff; }
    .pos-main { padding: 0; }
    .receipt-wrap { max-width: none; margin: 0; }
    .receipt { border: 0; box-shadow: none; padding: 0; }
}

/* ==========================================================
   17. Customer on a sale
   ========================================================== */
.cust-row { display: flex; align-items: center; gap: 8px; padding: 6px 16px 10px; }
.cust-btn {
    margin: 0; flex: 1; justify-content: flex-start; gap: 10px; min-height: 48px; padding: 8px 14px;
    background: var(--color-surface); color: var(--color-text);
    border: 1px dashed var(--color-border); font-weight: 500; text-align: left;
}
.cust-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-btn:hover { background: var(--color-bg); color: var(--color-text); }
.cust-btn.has, .cust-btn.has:hover {
    border-style: solid; background: var(--color-primary-soft);
    border-color: var(--color-primary-ink); color: var(--color-primary-ink);
}

#cust-dialog { width: min(94vw, 480px); }
.cust-results { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; max-height: 40vh; overflow-y: auto; }
.cust-pick {
    margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    width: 100%; padding: 12px 14px; text-align: left;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); font-weight: 500;
}
.cust-pick:hover { background: var(--color-primary-soft); color: var(--color-text); border-color: var(--color-primary-ink); }
#cust-new-toggle { margin-top: 4px; }
#cust-error, #cust-phone { margin-bottom: 12px; }

/* ==========================================================
   18. Thermal receipt (58 / 80 mm paper)
   ========================================================== */
.form-section { margin: 28px 0 0; padding-top: 18px; border-top: 1px solid var(--color-border); font-size: 1.05rem; }

.tr-page { display: grid; gap: 14px; max-width: 420px; margin: 0 auto; }
.tr {
    margin: 0 auto; padding: 14px 12px; background: #fff; color: #000;
    border: 1px solid var(--color-border); border-radius: 6px; box-shadow: var(--shadow-sm);
    font-size: 12px; line-height: 1.35; font-weight: 500; font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.tr-80 { width: 302px; max-width: 100%; }
.tr-58 { width: 220px; max-width: 100%; font-size: 11px; }

.tr-center { text-align: center; }
.tr-shop { font-size: 1.25em; font-weight: 800; }
.tr-title { margin: 8px 0 2px; text-align: center; font-weight: 800; letter-spacing: .06em; }
.tr-reprint { display: none; text-align: center; font-weight: 800; margin-bottom: 4px; }
.tr-reprint.on, .printed .tr-reprint { display: block; }
.tr-rule { border: 0; border-top: 1px dashed #000; margin: 8px 0; }
.tr-row { display: flex; justify-content: space-between; gap: 8px; }
.tr-item { margin-bottom: 5px; }
.tr-desc { font-weight: 700; overflow-wrap: anywhere; }
.tr-calc { display: flex; justify-content: space-between; gap: 8px; padding-left: 8px; }
.tr-row > :nth-child(2), .tr-calc > :nth-child(2) { flex-shrink: 0; max-width: 68%; text-align: right; }
.tr-total { font-size: 1.35em; font-weight: 800; padding: 4px 0; }
.tr-foot { margin-top: 10px; text-align: center; }

@media print {
    .tr-page { display: block; max-width: none; }
    .tr { width: 100%; margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
    /* Leave roll length to the printer. Keep the ticket within the paper margins. */
    .tr-58 { max-width: 52mm; }
    .tr-80 { max-width: 74mm; }
    .tr-item, .tr-row { break-inside: avoid; }
}

/* ==========================================================
   19. Discounts on the ticket
   ========================================================== */
.disc-row { display: flex; gap: 8px; margin-bottom: 10px; }
.disc-row button { flex: 1; margin: 0; min-height: 44px; }

.cart-disc {
    grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    color: var(--color-success); font-size: .88rem; font-weight: 600;
}
.link-x {
    margin: 0; padding: 0 8px; min-height: 32px; background: none; border: 0;
    color: var(--color-danger); font-size: 1.2rem; line-height: 1;
}
.link-x:hover { background: none; color: var(--color-danger); text-decoration: underline; }

.ctl-right { display: inline-flex; gap: 8px; }

.cart-sums .row.disc { color: var(--color-success); font-weight: 600; }
.disc-amt { display: inline-flex; align-items: center; }

#disc-dialog .seg { margin-bottom: 12px; }
#disc-quick { margin: 6px 0 4px; }
#coupon-error { margin-bottom: 12px; }

/* ==========================================================
   20. Points at the register
   ========================================================== */
.pts-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px 10px; }
.pts-info { min-width: 0; }
.pts-row .btn-secondary { margin: 0; min-height: 44px; }
.pts-warn { color: #92400e; font-size: .82rem; font-weight: 600; }
#points-dialog { width: min(94vw, 460px); }

/* ==========================================================
   21. The cart: one row per item, chips, compact size
   ========================================================== */
.ticket-head { gap: 6px; padding-bottom: 4px; }
.ticket-head h2 { margin: 0 auto 0 0; font-size: 1.1rem; }
.icon-btn:disabled, .icon-btn:disabled:hover { opacity: .4; cursor: not-allowed; background: var(--color-surface); }

.cust-row { gap: 6px; }
.cust-btn { min-width: 0; }
.pts-btn {
    position: relative; margin: 0; min-height: 48px; padding: 8px 12px; gap: 6px; flex: none;
    background: var(--color-surface); color: var(--color-text);
    border: 1px solid var(--color-border); font-weight: 650;
}
.pts-btn:hover { background: var(--color-primary-soft); color: var(--color-text); border-color: var(--color-primary-ink); }
.pts-dot {
    position: absolute; top: 5px; right: 5px; width: 10px; height: 10px; border-radius: 50%;
    background: #f59e0b; border: 2px solid var(--color-surface);
}

/* One row per item: [qty] name and code ... total and menu */
.cart-line {
    position: relative; grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center; gap: 2px 10px; padding: 10px 0;
}
.qty-pill {
    width: 44px; min-height: 44px; padding: 0; justify-content: center;
    font-size: 1.05rem; font-weight: 700;
}
.cart-info { min-width: 0; }
.cart-name { font-size: 1rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.cart-meta { margin-top: 1px; font-size: .8rem; color: var(--color-muted); }
.cart-right { display: flex; align-items: center; gap: 2px; }
.cart-total { font-weight: 650; white-space: nowrap; }
.cart-disc { grid-column: 1 / -1; padding-left: 54px; }

.more-btn {
    margin: 0; width: 36px; min-height: 44px; padding: 0;
    background: none; color: var(--color-muted); border: 0; font-size: 1.4rem; line-height: 1;
}
.more-btn:hover { background: var(--color-bg); color: var(--color-text); }

.line-menu {
    position: absolute; right: 0; top: calc(100% - 8px); z-index: 6;
    display: flex; flex-direction: column; min-width: 200px; padding: 4px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
.line-menu button {
    margin: 0; width: 100%; min-height: 44px; padding: 10px 12px; justify-content: flex-start;
    background: transparent; color: var(--color-text); border: 0; font-weight: 500;
}
.line-menu button:hover { background: var(--color-bg); color: var(--color-text); }
.line-menu .danger, .line-menu .danger:hover { color: var(--color-danger); }

/* Discounts on the whole sale: small chips in one wrapping row */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips:empty { display: none; }
.chip-d {
    display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px;
    border: 1px solid #bbf7d0; border-radius: 999px;
    background: var(--color-success-soft); color: #166534; font-size: .8rem; font-weight: 600;
}

.cart-sums .row.sub { font-size: .85rem; }
.cart-sums .grand { font-size: 1.25rem; }

/* Compact cart: tighter spacing, same readable type, buttons never below 40px */
.pos2.compact .ticket-head { padding-top: 10px; padding-bottom: 2px; }
.pos2.compact .cust-row { padding-top: 2px; padding-bottom: 6px; }
.pos2.compact .cust-btn, .pos2.compact .pts-btn { min-height: 40px; }
.pos2.compact .cart-line { padding: 6px 0; gap: 0 8px; }
.pos2.compact .qty-pill { width: 40px; min-height: 40px; font-size: 1rem; }
.pos2.compact .cart-name {
    font-size: .92rem; line-height: 1.2;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pos2.compact .cart-meta { font-size: .78rem; }
.pos2.compact .cart-total { font-size: .95rem; }
.pos2.compact .more-btn { min-height: 40px; }
.pos2.compact .cart-disc { padding-left: 48px; font-size: .82rem; }
.pos2.compact .ticket-foot { padding: 8px 16px 12px; }
.pos2.compact .chips { margin-bottom: 6px; }
.pos2.compact .cart-sums { gap: 2px; }
.pos2.compact .ticket-foot .cart-actions { margin-top: 8px; }
.pos2.compact .ticket-foot .cart-actions .charge { padding: 12px; }

.ret-summary { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 4px; font-size: 1.3rem; font-weight: 700; }
.notice.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.disc-note { margin-top: 2px; color: var(--color-success); font-size: .82rem; font-weight: 600; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.plain-list { margin: 6px 0 0; padding-left: 20px; }

.tr-sign { margin-top: 26px; padding-top: 2px; border-top: 1px solid #000; font-size: .9em; text-align: center; }

/* ==========================================================
   22. Exchange on the register
   ========================================================== */
.ex-block {
    margin: 0 16px 8px; padding: 8px 10px; font-size: .85rem;
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius-sm); color: #1e3a8a;
}
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ex-line { display: flex; justify-content: space-between; gap: 8px; padding-left: 14px; font-size: .82rem; }
.ex-sum { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-weight: 700; }
.ex-note { margin-top: 4px; font-size: .78rem; color: #92400e; }
.pos2.compact .ex-block { margin-bottom: 4px; padding: 6px 8px; }

.pay-ex {
    display: grid; gap: 4px; margin: 4px 0 10px; padding: 8px 10px; font-size: .9rem;
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius-sm); color: #1e3a8a;
}
.pay-ex .row { display: flex; justify-content: space-between; gap: 12px; }
#pay-payout select { margin-bottom: 8px; }

.tr-void {
    margin: 6px 0; padding: 4px; text-align: center; font-size: 1.3em; font-weight: 800;
    border: 2px solid #000; letter-spacing: .08em;
}
.is-danger-solid { background: var(--color-danger); color: #fff; border-color: transparent; }
.is-danger-solid:hover { background: color-mix(in srgb, var(--color-danger) 85%, black); }

.struck { text-decoration: line-through; color: var(--color-muted); }

/* ==========================================================
   23. Reports
   ========================================================== */
.stat-sub { margin-top: 2px; font-size: .78rem; color: var(--color-muted); }

.bar-chart { display: block; width: 100%; height: auto; }
.bar-chart .bar { fill: var(--color-primary); }
.bar-chart .bar:hover { fill: var(--color-primary-hover); }
.bar-chart .bar-axis { stroke: var(--color-border); stroke-width: 1; }
.bar-chart .bar-label { font-size: 11px; fill: var(--color-muted); }

.table tr.zero-row td { color: var(--color-muted); }

.report-grid { display: grid; gap: 14px; margin-bottom: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.report-card {
    display: flex; flex-direction: column; gap: 6px; padding: 18px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    color: var(--color-text); text-decoration: none;
}
.report-card:hover { border-color: var(--color-primary-ink); box-shadow: var(--shadow-md); }
.report-icon { color: var(--color-primary-ink); }

.day-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.day-nav .btn { margin: 0; }

.cash-box { max-width: 560px; }
.cash-line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.cash-line.final { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--color-border); font-size: 1.2rem; font-weight: 700; }

/* Dashboard */
.dashboard .dashboard-head {
    display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
    gap: 16px; margin-bottom: 20px;
}
.dashboard .dashboard-head h1 { margin: 0; }
.dashboard .dashboard-context { margin: 4px 0 0; }
.dashboard .dashboard-branch-form { display: flex; align-items: end; gap: 8px; }
.dashboard .dashboard-branch-form div { min-width: 0; }
.dashboard .dashboard-branch-form label { display: block; margin: 0 0 4px; }
.dashboard .dashboard-branch-form select { min-width: 180px; max-width: 280px; margin: 0; }
.dashboard .dashboard-branch-form button { flex: none; }

.dashboard .dashboard-metrics {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr));
    gap: 14px; margin-bottom: 20px;
}
.dashboard .dashboard-metrics-single { max-width: 310px; }
.dashboard .dashboard-metric {
    display: flex; flex-direction: column; min-width: 0; padding: 15px 16px;
    color: var(--color-text); text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}
.dashboard .dashboard-metric:hover { border-color: var(--color-primary-ink); box-shadow: var(--shadow-md); }
.dashboard .dashboard-metric-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dashboard .dashboard-metric-label { font-size: .86rem; font-weight: 600; }
.dashboard .dashboard-metric-icon {
    display: grid; place-items: center; flex: none; width: 34px; height: 34px;
    border-radius: var(--radius-sm); color: var(--color-primary-ink); background: var(--color-primary-soft);
}
.dashboard .dashboard-metric-icon .icon { width: 18px; height: 18px; }
.dashboard .dashboard-metric-value {
    margin-top: 8px; font-size: clamp(1.25rem, 2vw, 1.66rem); font-weight: 700;
    font-variant-numeric: tabular-nums; line-height: 1.3; overflow-wrap: anywhere;
}
.dashboard .dashboard-metric .stat-sub { margin-top: 4px; }

.dashboard .dashboard-with-register {
    display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(200px, 1fr);
    align-items: start; gap: 14px;
}
.dashboard .dashboard-activity, .dashboard .dashboard-register { min-width: 0; padding: 18px; }
.dashboard .dashboard-activity h2, .dashboard .dashboard-register h2 { margin: 0; font-size: 1.08rem; }
.dashboard .dashboard-activity-list { list-style: none; margin: 8px 0 0; padding: 0; }
.dashboard .dashboard-activity-item {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px;
    padding: 11px 0; border-bottom: 1px solid var(--color-border);
}
.dashboard .dashboard-activity-item:last-child { border-bottom: 0; padding-bottom: 0; }
.dashboard .dashboard-activity-detail, .dashboard .dashboard-activity-meta { display: grid; gap: 2px; align-content: start; }
.dashboard .dashboard-activity-detail { min-width: 0; overflow-wrap: anywhere; }
.dashboard .dashboard-activity-label { color: var(--color-text); font-weight: 650; }
.dashboard a.dashboard-activity-label { text-decoration: none; }
.dashboard a.dashboard-activity-label:hover { color: var(--color-primary-ink); text-decoration: underline; }
.dashboard .dashboard-activity-detail .muted, .dashboard .dashboard-activity-meta .muted { font-size: .82rem; }
.dashboard .dashboard-activity-meta { text-align: right; font-variant-numeric: tabular-nums; }
.dashboard .dashboard-activity-meta strong { font-size: .9rem; }
.dashboard .dashboard-register-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dashboard .dashboard-register > .btn { margin-top: 12px; }
.dashboard .dashboard-register p { margin: 8px 0 0; }
.dashboard .dashboard-activity .dashboard-empty { margin: 12px 0 0; }

@media (max-width: 760px) {
    .dashboard .dashboard-with-register { grid-template-columns: minmax(0, 1fr); }
    .dashboard .dashboard-with-register .dashboard-register { grid-row: 1; }
}
@media (max-width: 520px) {
    .dashboard .dashboard-branch-form { width: 100%; }
    .dashboard .dashboard-branch-form div { flex: 1; }
    .dashboard .dashboard-branch-form select { min-width: 0; max-width: none; width: 100%; }
    .dashboard .dashboard-metrics-single { max-width: none; }
}
