/* Café Manager — mobile-first stylesheet. White, minimal theme; all colours are tokens below. */
:root {
    --c-bg: #ffffff;
    --c-surface: #ffffff;
    --c-surface-2: #f6f7f9;     /* subtle fills: hover, inputs groups, timeline */
    --c-border: #e6e8ec;
    --c-border-strong: #d4d8de;
    --c-text: #16181d;
    --c-muted: #6b7280;
    --c-primary: #16181d;       /* primary actions: near-black on white */
    --c-primary-hover: #000000;
    --c-primary-ink: #ffffff;
    --c-accent-soft: #f1f3f5;   /* selected chips / radios */
    --c-ok: #15803d;
    --c-ok-soft: #ecfdf3;
    --c-warn: #b45309;
    --c-warn-soft: #fffbeb;
    --c-danger: #dc2626;
    --c-danger-soft: #fef2f2;
    --c-info: #1d4ed8;
    --c-info-soft: #eff6ff;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
    --focus: 0 0 0 3px rgba(22, 24, 29, .18);
    --tap: 44px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bottom-nav-h: 62px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; overflow-x: hidden; font: 16px/1.5 var(--font); background: var(--c-bg); color: var(--c-text); overscroll-behavior-y: none; }
a { color: var(--c-text); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.2rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .98rem; margin-top: 1.2em; }
small { font-size: .82em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
pre { white-space: pre-wrap; word-break: break-word; margin: .3em 0; background: var(--c-surface-2); padding: .5em; border-radius: var(--radius-sm); max-height: 260px; overflow: auto; }
[hidden] { display: none !important; }
.muted { color: var(--c-muted); }
.center { text-align: center; }
.neg { color: var(--c-danger); }
.positive { color: var(--c-ok); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eyebrow { margin: 0 0 2px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); }
.small-note { font-size: .85rem; margin: 10px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.main { min-width: 0; padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: calc(6px + var(--safe-top)) 12px 6px; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--c-border); }
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title h1 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.05rem; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.brand-mobile img { display: block; border-radius: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; min-height: var(--tap); }
.user-chip-text { display: none; line-height: 1.15; font-size: .9rem; }
.user-chip-text small { display: block; color: var(--c-muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--c-surface-2); border: 1px solid var(--c-border); font-weight: 700; font-size: .9rem; }
.logout-form { display: none; }
.content { padding: 12px; max-width: 1200px; margin: 0 auto; }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--c-border); padding-bottom: var(--safe-bottom); }
.bottom-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--bottom-nav-h);
    color: var(--c-muted); text-decoration: none; font-size: .72rem; font-weight: 600; position: relative; }
.bottom-link.is-active { color: var(--c-text); }
.bottom-link.is-active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--c-text); }
.bottom-link.is-active .icon { stroke-width: 2.3; }

.shift-banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--c-warn-soft); color: var(--c-warn); font-size: .88rem; font-weight: 600; border-bottom: 1px solid var(--c-border); }
.shift-banner.is-mine { background: var(--c-ok-soft); color: var(--c-ok); }
.shift-banner a { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shift-banner .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .shift-banner .dot { animation: none; } * { transition: none !important; } }
.offline-banner { padding: 8px 12px; background: var(--c-text); color: #fff; font-weight: 600; text-align: center; font-size: .9rem; }

@media (min-width: 900px) {
    .app { display: grid; grid-template-columns: 236px 1fr; }
    .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--c-surface); border-right: 1px solid var(--c-border); padding: 14px 10px; }
    .brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; font-size: 1.05rem; padding: 6px 10px 18px; }
    .brand img { border-radius: 8px; }
    .side-nav { display: flex; flex-direction: column; gap: 2px; }
    .side-link { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--c-muted); text-decoration: none; font-weight: 500; }
    .side-link:hover { background: var(--c-surface-2); color: var(--c-text); }
    .side-link.is-active { background: var(--c-surface-2); color: var(--c-text); font-weight: 650; }
    .bottom-nav, .brand-mobile { display: none; }
    .main { padding-bottom: 24px; }
    .content { padding: 20px 28px; }
    .user-chip-text { display: block; }
    .logout-form { display: block; }
    .topbar { padding: 10px 28px; }
}

/* ---------- Cards / alerts ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card-accent { border-color: #b9bec7; }
.card-danger { border-color: #fecaca; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head p { margin: 0; }
.narrow { max-width: 420px; margin: 0 auto; }
.narrow-lg { max-width: 820px; margin-left: auto; margin-right: auto; }
@media (min-width: 640px) { .card { padding: 18px 20px; } }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin: 0 0 12px; font-weight: 500; border: 1px solid transparent; font-size: .95rem; transition: opacity .4s, transform .4s; }
.alert.is-hiding { opacity: 0; transform: translateY(-4px); }
.alert-success { background: var(--c-ok-soft); color: var(--c-ok); border-color: #bbf7d0; }
.alert-error { background: var(--c-danger-soft); color: var(--c-danger); border-color: #fecaca; }
.alert-warn { background: var(--c-warn-soft); color: var(--c-warn); border-color: #fde68a; }
.alert-info { background: var(--c-info-soft); color: var(--c-info); border-color: #bfdbfe; }
.alert a { color: inherit; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--c-border-strong); background: var(--c-surface); color: var(--c-text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
    touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: background .15s, border-color .15s, transform .06s; }
.btn:hover { background: var(--c-surface-2); }
.btn:active { transform: scale(.98); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible, .product-tile:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn.is-busy { opacity: .7; pointer-events: none; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-primary-ink); }
.btn-primary:hover { background: var(--c-primary-hover); }
.btn-danger { background: var(--c-surface); border-color: #fca5a5; color: var(--c-danger); }
.btn-danger:hover { background: var(--c-danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn-lg { min-height: 52px; font-size: 1.02rem; padding: 0 22px; }
.btn-block { width: 100%; }
.btn-icon { display: grid; place-items: center; width: var(--tap); height: var(--tap); border: 0; background: transparent; color: var(--c-muted); border-radius: 50%; cursor: pointer; }
.btn-icon:hover { background: var(--c-surface-2); color: var(--c-text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.quick-actions .btn { padding: 0 8px; }
summary { cursor: pointer; }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }

.lang-switch { display: inline-flex; border: 1px solid var(--c-border); border-radius: 999px; padding: 2px; background: var(--c-surface-2); }
.lang-switch button { border: 0; background: transparent; color: var(--c-muted); font: inherit; font-size: .78rem; font-weight: 700; min-height: 32px; min-width: 38px; padding: 0 10px; border-radius: 999px; cursor: pointer; }
.lang-switch button.is-active { background: var(--c-surface); color: var(--c-text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.center-row { display: flex; justify-content: center; margin: 16px auto 0; width: max-content; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 12px; }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: 1 / -1; } }
.field { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; margin: 0; border: 0; padding: 0; min-width: 0; }
.field > span, .field legend { color: var(--c-muted); }
.field legend { padding: 0; margin-bottom: 4px; }
.field-inline { display: inline-grid; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
    width: 100%; min-height: var(--tap); padding: 9px 12px; font: inherit; font-size: 16px; /* 16px: no iOS zoom on focus */ font-weight: 400; color: var(--c-text);
    background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--c-muted) 50%), linear-gradient(135deg, var(--c-muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type=search] { -webkit-appearance: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--c-text); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--c-primary); }
.input-sm { max-width: 100px; }
.input-lg { font-size: 1.25rem !important; font-weight: 600 !important; min-height: 52px !important; }
.select-sm { min-height: 40px !important; padding: 6px 30px 6px 10px !important; font-size: .9rem !important; width: auto !important; max-width: 170px; }
.input-pair { display: flex; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); font-weight: 500; cursor: pointer; margin-right: 10px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 12px; }
.field-error { color: var(--c-danger); font-size: .85rem; margin: 0; font-weight: 500; }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--c-danger); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px); z-index: 5; margin-bottom: 12px; }
@media (min-width: 900px) { .sticky-actions { bottom: 12px; } }
.filter-form, .range-form, .inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filter-form > input, .filter-form > select { flex: 1 1 150px; width: auto; }
.inline-form > input { flex: 1 1 140px; width: auto; }
.inline-form > .input-sm { flex: 0 0 90px; }
.range-form { margin-bottom: 12px; }
.range-form .field-inline { flex: 1 1 130px; }
.cat-list { display: grid; gap: 10px; }
.cat-row { padding-bottom: 10px; border-bottom: 1px solid var(--c-border); }

.switch { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; cursor: pointer; margin-right: 18px; }
.toggle-row { display: flex; flex-wrap: wrap; margin-bottom: 8px; }
.segmented, .chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 4px; margin-bottom: 12px; }
.segmented::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.segmented a { flex: none; padding: 0 14px; min-height: 38px; display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--c-border); text-decoration: none; color: var(--c-muted); font-weight: 600; font-size: .88rem; }
.segmented a.is-active { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-primary-ink); }
.segmented-radio { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.segmented-radio label { position: relative; }
.segmented-radio input { position: absolute; opacity: 0; }
.segmented-radio span { display: flex; justify-content: center; align-items: center; min-height: var(--tap); border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; }
.segmented-radio input:checked + span { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-primary-ink); }
.segmented-radio input:focus-visible + span { box-shadow: var(--focus); }

/* ---------- Tables (→ cards on small screens) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: top; }
.table th { color: var(--c-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.table th.num, .table td.num { text-align: right; }
.table tfoot th { color: var(--c-text); font-size: .93rem; text-transform: none; letter-spacing: 0; border-top: 1px solid var(--c-border-strong); border-bottom: 0; }
.table .empty { text-align: center; color: var(--c-muted); padding: 24px; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.row-inactive { opacity: .5; }
.row-reversal td { background: var(--c-warn-soft); }
.row-reversed td:first-child a { text-decoration: line-through; }
.row-strong th, .row-strong td { font-size: 1.05rem; }
.recon th { text-transform: none; font-size: .93rem; color: var(--c-text); letter-spacing: 0; font-weight: 500; }
@media (max-width: 719px) {
    .table.responsive thead { display: none; }
    .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td, .table.responsive tfoot, .table.responsive tfoot th { display: block; width: 100%; }
    .table.responsive tr { border: 1px solid var(--c-border); border-radius: var(--radius-sm); margin-bottom: 8px; padding: 6px 12px; background: var(--c-surface); }
    .table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 5px 0; text-align: right; }
    .table.responsive td[data-label]::before { content: attr(data-label); color: var(--c-muted); font-weight: 600; font-size: .8rem; text-align: left; flex: none; max-width: 45%; }
    .table.responsive td:not([data-label]) { justify-content: flex-end; }
    .table.responsive td.empty { justify-content: center; }
    .table.responsive tfoot tr { background: var(--c-surface-2); }
    .table.responsive tfoot th { border: 0; padding: 4px 0; text-align: right; }
    .table.responsive tfoot th:empty { display: none; }
}

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; background: var(--c-surface-2); color: var(--c-muted); vertical-align: middle; border: 1px solid var(--c-border); }
.badge-ok, .badge-validated { background: var(--c-ok-soft); color: var(--c-ok); border-color: #bbf7d0; }
.badge-warn, .badge-closed { background: var(--c-warn-soft); color: var(--c-warn); border-color: #fde68a; }
.badge-danger { background: var(--c-danger-soft); color: var(--c-danger); border-color: #fecaca; }
.badge-opened { background: var(--c-info-soft); color: var(--c-info); border-color: #bfdbfe; }
.badge-muted { background: var(--c-surface-2); color: var(--c-muted); }
.badge-role-superadmin { background: var(--c-primary); color: var(--c-primary-ink); border-color: var(--c-primary); }
.badge-role-admin { background: var(--c-surface-2); color: var(--c-text); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 12px; } }
.stats-compact { margin: 12px 0; grid-template-columns: repeat(3, 1fr); }
.stats-compact .stat { padding: 10px; }
.stats-compact .stat-value { font-size: 1.1rem; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); text-decoration: none; color: inherit; min-width: 0; }
a.stat:hover { border-color: var(--c-border-strong); }
.stat-label { color: var(--c-muted); font-size: .78rem; font-weight: 600; }
.stat-value { font-size: 1.4rem; font-variant-numeric: tabular-nums; line-height: 1.15; font-weight: 700; overflow-wrap: anywhere; }
.stat-small { font-size: 1.02rem; }
.stat-sub { font-size: .8rem; color: var(--c-muted); }
.stat-warn .stat-value { color: var(--c-warn); }
.stat-danger .stat-value { color: var(--c-danger); }
.share { display: inline-flex; align-items: center; gap: 6px; }
.share meter { width: 64px; height: 8px; }

.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 16px; margin: 0 0 14px; }
.meta dt { color: var(--c-muted); font-size: .78rem; font-weight: 600; }
.meta dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.timeline li { padding: 8px 12px; border-left: 2px solid var(--c-border-strong); background: var(--c-surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: .93rem; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; }
.diff { display: grid; gap: 8px; text-align: left; }
@media (min-width: 900px) { .diff { grid-template-columns: 1fr 1fr; min-width: 380px; } }
.audit-table td { word-break: break-word; }

/* ---------- Lists, shift board, stock ---------- */
.list { display: grid; border: 1px solid var(--c-border); border-radius: var(--radius-sm); overflow: hidden; }
.list > .empty { padding: 20px; margin: 0; text-align: center; color: var(--c-muted); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; min-height: 56px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--c-border); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--c-surface-2); }
.list-row > span { display: grid; min-width: 0; }
.board { display: grid; gap: 8px; }
.board-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); }
.board-item.is-open { border-color: #bfdbfe; background: var(--c-info-soft); }
.board-main { display: grid; gap: 2px; min-width: 0; }
.board-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.board-title strong { font-size: 1.02rem; }
.board-action { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.start-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 480px) {
    .board-action, .start-form { width: 100%; }
    .start-form .btn { flex: 1; }
    .start-form .select-sm { flex: 1; max-width: none; }
}
.stock-list { display: grid; gap: 8px; }
.stock-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--c-border); border-radius: var(--radius-sm); }
.stock-item.is-low { border-color: #fecaca; }
.stock-info { display: grid; min-width: 0; }
.stock-adjust { grid-column: 1 / -1; }
.stock-adjust[open] summary { margin-bottom: 10px; }
.adjust-form { padding: 12px; background: var(--c-surface-2); border-radius: var(--radius-sm); }
@media (min-width: 900px) { .stock-list { grid-template-columns: repeat(2, 1fr); } }
.close-shift, .inline-details { margin-top: 12px; }
.close-shift[open] > summary, .inline-details[open] > summary { margin-bottom: 12px; }
.more-menu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 640px) { .more-menu { grid-template-columns: repeat(4, 1fr); } }
.more-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 92px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); text-decoration: none; color: var(--c-text); font-weight: 600; text-align: center; padding: 10px; font-size: .92rem; }
.more-link:active { background: var(--c-surface-2); }
.more-link .icon { width: 26px; height: 26px; }
.tips-preview { margin: 0; font-weight: 600; }
.install-card .btn { margin-top: 8px; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pos-catalog { min-width: 0; }
.pos.is-disabled .pos-catalog { opacity: .5; }
.pos-tools { position: sticky; top: calc(57px + var(--safe-top)); z-index: 10; background: var(--c-bg); margin: -12px -12px 0; padding: 10px 12px 2px; }
.pos-search input { min-height: 46px; border-radius: 999px; padding-left: 16px; background: var(--c-surface-2); border-color: var(--c-surface-2); }
.chips { margin: 10px 0 6px; }
.chip { flex: none; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-muted); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.chip.is-active { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-primary-ink); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
@media (max-width: 340px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }
.product-tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 92px; padding: 10px; text-align: left;
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-sm); color: var(--c-text); font: inherit; cursor: pointer; touch-action: manipulation;
    transition: transform .06s, border-color .15s; -webkit-user-select: none; user-select: none; }
.product-tile:active { transform: scale(.96); background: var(--c-surface-2); }
.product-tile:disabled { cursor: not-allowed; opacity: .45; }
.product-tile.is-low .tile-stock { color: var(--c-warn); font-weight: 700; }
.product-tile.is-out { background: var(--c-surface-2); }
.product-tile .tile-name { font-weight: 600; font-size: .9rem; line-height: 1.2; overflow-wrap: anywhere; hyphens: auto; }
.product-tile .tile-price { font-weight: 750; }
.product-tile .tile-stock { font-size: .74rem; color: var(--c-muted); }
.product-tile.in-cart { border-color: var(--c-text); box-shadow: inset 0 0 0 1px var(--c-text); }
.product-tile[data-count] .tile-name { padding-right: 24px; }
.product-tile[data-count]::after { content: attr(data-count); position: absolute; top: 6px; right: 6px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
    background: var(--c-primary); color: var(--c-primary-ink); font-size: .78rem; font-weight: 800; display: grid; place-items: center; }

.cart-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(16, 24, 40, .35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.cart-backdrop.is-open { opacity: 1; pointer-events: auto; }
.pos-cart { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column;
    background: var(--c-surface); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg);
    transform: translateY(105%); transition: transform .22s ease; padding: 8px 14px calc(12px + var(--safe-bottom)); }
.pos-cart.is-open { transform: none; }
.pos-cart::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--c-border-strong); margin: 0 auto 8px; }
.cart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cart-head h2 { margin: 0; }
.cart-head .btn-row { gap: 4px; }
.cart-lines { list-style: none; margin: 8px 0; padding: 0; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.cart-lines .empty { color: var(--c-muted); text-align: center; padding: 20px 0; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--c-border); align-items: center; }
.cart-line .name { font-weight: 600; }
.cart-line .line-total { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button { width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--c-border-strong); background: var(--c-surface); color: var(--c-text); font-size: 1.3rem; font-weight: 600; cursor: pointer; touch-action: manipulation; line-height: 1; }
.qty-ctrl button:active { background: var(--c-surface-2); }
.qty-ctrl input { width: 64px !important; text-align: center; min-height: 40px !important; padding: 4px !important; }
.cart-foot { display: grid; gap: 10px; padding-top: 8px; }
.cart-total { display: flex; justify-content: space-between; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pay-method { position: relative; }
.pay-method input { position: absolute; opacity: 0; }
.pay-method span { display: flex; align-items: center; justify-content: center; min-height: var(--tap); border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; }
.pay-method input:checked + span { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-primary-ink); }
.pay-method input:focus-visible + span { box-shadow: var(--focus); }
.cart-error { color: var(--c-danger); font-weight: 600; margin: 0; }
.cart-bar { position: fixed; left: 10px; right: 10px; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px); z-index: 24; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 54px; padding: 0 18px; border-radius: 14px; border: 0; background: var(--c-primary); color: var(--c-primary-ink); font: inherit; font-weight: 700;
    box-shadow: var(--shadow-lg); cursor: pointer; transition: transform .15s; }
.cart-bar.is-empty { transform: translateY(160%); }
.cart-bar .cart-bar-count { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; background: rgba(255, 255, 255, .18); font-size: .9rem; }
.pos .product-grid { padding-bottom: 72px; }
@media (min-width: 900px) {
    .pos { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
    .pos-tools { position: static; margin: 0; padding: 0; }
    .pos-cart { position: sticky; top: 80px; transform: none; border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow); max-height: calc(100vh - 100px); padding: 14px; z-index: 1; }
    .pos-cart::before, .cart-bar, .cart-backdrop, [data-cart-close] { display: none !important; }
    .pos .product-grid { padding-bottom: 0; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ---------- Public pages ---------- */
.public-wrap { min-height: 100vh; min-height: 100dvh; display: grid; align-content: center; padding: calc(20px + var(--safe-top)) 16px calc(20px + var(--safe-bottom)); background: var(--c-surface-2); }
.public .card { width: 100%; }
.login-head { text-align: center; margin-bottom: 16px; }
.login-head img { border-radius: 14px; }
.login-head h1 { margin: 10px 0 4px; font-size: 1.35rem; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--c-border-strong); margin: 0; }
.checklist { list-style: none; padding: 0; display: grid; gap: 4px; font-size: .9rem; }
.checklist .ok { color: var(--c-ok); }
.checklist .ko { color: var(--c-danger); font-weight: 700; }

/* ---------- Receipt / print ---------- */
.print-body { background: var(--c-surface-2); padding: 16px; }
.receipt { max-width: 340px; margin: 0 auto; background: #fff; color: #000; padding: 18px 16px; font: 14px/1.4 ui-monospace, Menlo, monospace; border-radius: 8px; border: 1px solid var(--c-border); }
.receipt-head { text-align: center; border-bottom: 1px dashed #000; padding-bottom: 8px; margin-bottom: 8px; }
.receipt-head strong { font-size: 1.1rem; }
.receipt-meta { font-size: .85rem; margin: 6px 0; }
.receipt-lines { width: 100%; border-collapse: collapse; margin: 8px 0; }
.receipt-lines td { padding: 4px 0; vertical-align: top; border-bottom: 1px dotted #999; }
.receipt-total { display: flex; justify-content: space-between; font-size: 1.15rem; border-top: 1px dashed #000; padding-top: 8px; }
.receipt-foot { text-align: center; margin-top: 12px; font-size: .85rem; }
.receipt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px auto; max-width: 340px; padding-bottom: var(--safe-bottom); }
.receipt-actions .btn-primary { grid-column: 1 / -1; }
@media print {
    @page { margin: 4mm; }
    .no-print, .bottom-nav, .sidebar, .topbar { display: none !important; }
    .print-body { background: #fff; padding: 0; }
    .receipt { border: 0; max-width: 80mm; padding: 0; }
}

/* Installed app (standalone): no browser chrome, so keep content clear of the notch */
@media (display-mode: standalone) {
    .public-wrap { padding-top: calc(28px + var(--safe-top)); }
}
