/* Advance Ledger — interface styles. Mobile first; drawer navigation on every screen size. */
:root {
    /* --brand: accent as text and lines (readable on the page); --brand-fill: accent as a solid background, with --brand-ink on it */
    --brand: #b45410; --brand-fill: #f97316; --brand-ink: #111111; --brand-soft: #feeee3; --brand-strong: #8f420c;
    --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f7f9fc; --line: #e2e7ef; --line-strong: #cbd3df;
    --text: #0f172a; --muted: #475569; --faint: #7c889b;
    --green: #0f7a55; --green-bg: #e2f5ec; --amber: #a55a05; --amber-bg: #fdf0d9; --red: #c22f2f; --red-bg: #fde7e7;
    --blue: #1d4ed8; --blue-bg: #dbeafe; --gray-bg: #e9edf3;
    --side: #111111; --side-2: #2e2e2e; --side-line: #262626; --side-text: #c9cbd1; --side-strong: #ffffff;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .05);
    --radius: 12px; --drawer-w: 264px; --rail-w: 68px; --topbar-h: 58px;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
    color-scheme: light;
}
[data-theme="dark"] {
    --brand: #f97316; --brand-fill: #f97316; --brand-ink: #111111; --brand-soft: #40281a; --brand-strong: #fa8431;
    --bg: #0e0e10; --surface: #18181b; --surface-2: #202024; --line: #2e2e34; --line-strong: #3f3f46;
    --text: #ececef; --muted: #b8b8c0; --faint: #8a8a94;
    --green: #3fc28f; --green-bg: #12322a; --amber: #f0b23f; --amber-bg: #3a2c10; --red: #f07a7a; --red-bg: #3c1b1e;
    --blue: #7ab0ff; --blue-bg: #14274a; --gray-bg: #26262b;
    --side: #0c0c0c; --side-2: #292929; --side-line: #1f1f22; --side-text: #c9cbd1; --side-strong: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .8em; }
small { font-size: .85em; }
code, .mono { font-family: var(--mono); font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.ic { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.neg { color: var(--red); } .pos { color: var(--green); }
.hide { display: none !important; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.drawer {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(var(--drawer-w), 86vw); display: flex; flex-direction: column;
    background: var(--surface); border-right: 1px solid var(--line); transform: translateX(-102%); transition: transform .22s ease, width .18s ease;
    padding-left: env(safe-area-inset-left);
}
.drawer-open .drawer { transform: none; box-shadow: var(--shadow); }
.backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(8, 14, 13, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-open .backdrop { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: var(--topbar-h); padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.05rem; min-width: 0; }
.brand:hover { text-decoration: none; }
.app-logo { flex: none; object-fit: contain; border-radius: 22%; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; overscroll-behavior: contain; }
.nav-group { margin: 14px 10px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 9px; color: var(--muted); font-weight: 550; min-height: 40px; }
.nav-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--brand-soft); color: var(--brand-strong); }
[data-theme="dark"] .nav-link.active { color: var(--brand); }
.drawer-foot { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); flex: none; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); }
.me:hover { text-decoration: none; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text strong, .me-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-fill); color: var(--brand-ink); font-weight: 700; }
.main { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 12px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
    padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right));
}
.topbar-title { font-size: 1.05rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.co-switch { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 0 4px 0 10px; height: 38px; color: var(--muted); background: var(--surface); }
.co-switch select { border: 0; background: transparent; padding: 0 22px 0 0; height: 36px; max-width: 34vw; font-weight: 600; color: var(--text); box-shadow: none; min-height: 0; }
/* the open list does not inherit a transparent background: give its rows real colours in both themes */
select option, select optgroup { background: var(--surface); color: var(--text); }
.co-switch select:focus { outline: none; box-shadow: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
[data-theme="dark"] .t-dark, [data-theme="light"] .t-light, html:not([data-theme]) .t-light { display: none; }
@media (max-width: 479px) { .co-switch > .ic { display: none; } .co-switch { padding-left: 8px; } .co-switch select { max-width: 30vw; } }
@media (max-width: 719px) { #installBtn span { display: none; } #installBtn { padding: 4px 9px; } }
.content { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 16px 12px 28px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.foot { padding: 14px 16px 18px; text-align: center; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.foot-ver { display: block; color: var(--faint); margin-top: 2px; }

/* Desktop and landscape tablets: the drawer is docked; the menu button folds it to an icon rail */
@media (min-width: 1024px) {
    .drawer { transform: none; }
    .backdrop, .drawer-close { display: none; }
    .main { margin-left: var(--drawer-w); transition: margin-left .18s ease; }
    .rail .drawer { width: var(--rail-w); }
    .rail .main { margin-left: var(--rail-w); }
    .rail .brand-text, .rail .nav-link span, .rail .me-text, .rail .drawer-foot .icon-btn { display: none; }
    .rail .nav-group { height: 1px; margin: 10px 8px; background: var(--line); overflow: hidden; color: transparent; display: block; }
    .rail .nav-link { justify-content: center; padding: 5px 0; }
    .rail .drawer-head { padding: 0; justify-content: center; }
    .rail .drawer-foot { justify-content: center; }
    .rail .me { flex: none; }
    .content { padding: 22px 26px 36px; }
}

/* ---------- Page pieces ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.actions, .btn-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid > * { min-width: 0; }
.grid .card { margin-bottom: 0; }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 16px; }
@media (min-width: 640px) { .cols-2, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.stack > * + * { margin-top: 16px; }
.stack > .card { margin-bottom: 0; }

.kpi { padding: 14px 16px; }
.kpi .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.kpi .value { font-size: 1.5rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .sub { color: var(--muted); font-size: .85rem; }

/* ---------- Buttons and forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 14px; border-radius: 9px;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
[data-theme="dark"] .btn-danger { color: #1b0606; }
.btn-danger:hover { filter: brightness(.92); background: var(--red); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.inline { display: inline; }
label, .label { display: block; font-weight: 600; font-size: .88rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time], input[type=url], input[type=search], input[type=tel], input[type=datetime-local], select, textarea {
    width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
@media (min-width: 1024px) { input, select, textarea { font-size: 15px !important; } }
.pw-wrap { position: relative; display: block; flex: 1; min-width: 0; }
.pw-wrap > input { padding-right: 44px; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 40px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--brand); }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
input[readonly] { background: var(--surface-2); }
input[type=file] { width: 100%; padding: 7px; border: 1px dashed var(--line-strong); border-radius: 9px; background: var(--surface-2); color: var(--text); font: inherit; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: .95rem; margin: 0; cursor: pointer; }
.field { margin-bottom: 14px; }
.field small { display: block; color: var(--muted); margin-top: 3px; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } .form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } .span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; } }
@media (min-width: 640px) and (max-width: 899px) { .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.toolbar .field { margin: 0; flex: 1 1 140px; min-width: 0; }
.toolbar .field.grow { flex: 3 1 220px; }
.join { display: flex; gap: 6px; }
.join > input, .join > select { flex: 1; min-width: 0; }

/* Drop-down menu on a button (Export) */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--surface-2); }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); }
.menu-list a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 7px; color: var(--text); font-weight: 600; white-space: nowrap; }
.menu-list a:hover, .menu-list a:focus-visible { background: var(--brand-soft); text-decoration: none; }
@media (max-width: 479px) { .page-head .menu-list { right: auto; left: 0; } }

.nav-link[data-g="pos"] { --g: #e34948; }
[data-theme="dark"] .nav-link[data-g="pos"] { --g: #e66767; }
/* Till receipts and shift readings: an 80 mm slip on screen and on paper */
.slip { width: min(100%, 320px); margin: 0 auto 16px; padding: 16px 14px; background: #fff; color: #111; border: 1px solid #dfe5e3; border-radius: 8px; font: 13px/1.45 ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace; box-shadow: var(--shadow); }
.slip hr { border: 0; border-top: 1px dashed #777; margin: 8px 0; }
.slip-c { text-align: center; }
.slip-r { display: flex; justify-content: space-between; gap: 10px; }
.slip-r span:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.slip-big { font-size: 1.2em; font-weight: 800; margin: 3px 0; }
@media print { @page slip { size: 80mm auto; margin: 3mm; } .slip { page: slip; width: 100%; border: 0; box-shadow: none; margin: 0; padding: 0; font-size: 11.5px; } }

/* Welcome banner after signing in */
.welcome { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius); color: #fff;
    background: linear-gradient(120deg, var(--brand-print, #b45410), color-mix(in srgb, var(--brand-print, #b45410) 70%, #111111)); box-shadow: var(--shadow); animation: welcome-in .45s ease both; }
.welcome-mark { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: rgba(255, 255, 255, .16); }
.welcome-mark svg rect { fill: transparent; }
.welcome-text { flex: 1; min-width: 0; }
.welcome-text strong { display: block; font-size: 1.15rem; }
.welcome-text span { opacity: .92; font-size: .93rem; }
.welcome .icon-btn { color: #fff; }
.welcome .icon-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }
@keyframes welcome-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Loading: spinner overlay for forms, progress bar for page changes, spinner inside busy buttons */
.spin-wrap { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.spin-wrap .spinner { position: absolute; inset: 0; width: 64px; height: 64px; }
.loader-pct { position: relative; font-size: .92rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid color-mix(in srgb, var(--brand) 22%, transparent); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .18s; }
.loader.on { opacity: 1; pointer-events: auto; }
.loader-box { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: min(280px, 100%); max-width: 360px; padding: 26px 28px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.loader-title { font-size: 1.08rem; }
.loader-detail { color: var(--muted); font-size: .9rem; }
.loadbar { position: fixed; left: 0; top: 0; z-index: 95; height: 3px; width: 0; background: var(--brand-fill); opacity: 0; box-shadow: 0 0 8px var(--brand-fill); }
.loadbar.on { opacity: 1; animation: loadbar 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes loadbar { 0% { width: 0; } 20% { width: 45%; } 60% { width: 80%; } 100% { width: 96%; } }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2.5px solid currentColor; border-top-color: transparent; color: var(--text); animation: spin .7s linear infinite; }
.btn-primary.is-busy::after, .btn-danger.is-busy::after { color: #fff; }
@media (prefers-reduced-motion: reduce) { .spinner, .btn.is-busy::after { animation-duration: 2.4s !important; } .loadbar.on { animation: none; width: 70%; } .welcome { animation: none; } }
@media print { .loader, .loadbar, .welcome { display: none !important; } }

/* Notifications bell */
.bell > summary { position: relative; }
.bell-n { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: .68rem; font-weight: 800; line-height: 17px; text-align: center; }
[data-theme="dark"] .bell-n { color: #1b0606; }
.bell.seen .bell-n { background: var(--line-strong); color: var(--text); }
.bell-list { width: min(360px, calc(100vw - 20px)); padding: 0; max-height: min(70vh, 520px); overflow: auto; }
.bell-head { padding: 12px 14px 8px; font-weight: 700; border-bottom: 1px solid var(--line); }
.bell-empty { padding: 22px 14px; color: var(--muted); text-align: center; }
.menu-list a.bell-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 0; border-bottom: 1px solid var(--line); white-space: normal; font-weight: 400; }
.menu-list a.bell-item:last-child { border-bottom: 0; }
.bell-item strong { display: block; } .bell-item small { display: block; color: var(--muted); }
.bell-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; }
.bt-red .bell-ic { background: var(--red-bg); color: var(--red); } .bt-amber .bell-ic { background: var(--amber-bg); color: var(--amber); } .bt-blue .bell-ic { background: var(--blue-bg); color: var(--blue); }
@media (max-width: 479px) { .bell-list { position: fixed; right: 10px; top: calc(var(--topbar-h) + 4px); } }

/* ---------- Tabs, badges, alerts ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 9px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.b-green { background: var(--green-bg); color: var(--green); } .b-amber { background: var(--amber-bg); color: var(--amber); }
.b-red { background: var(--red-bg); color: var(--red); } .b-blue { background: var(--blue-bg); color: var(--blue); } .b-gray { background: var(--gray-bg); color: var(--muted); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid transparent; }
.alert .ic { margin-top: 2px; }
.alert-success { background: var(--green-bg); color: var(--green); } .alert-error { background: var(--red-bg); color: var(--red); }
.alert-info { background: var(--blue-bg); color: var(--blue); } .alert-warn { background: var(--amber-bg); color: var(--amber); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); white-space: nowrap; font-weight: 700; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td, .table tfoot tr:last-child td { border-bottom: 0; }
.table tfoot td, .table .total td { font-weight: 700; background: var(--surface-2); }
.table .section td { font-weight: 700; background: var(--surface-2); color: var(--muted); text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }
.table .indent { padding-left: 30px; }
.table td.actions-cell { white-space: nowrap; text-align: right; }
.table-compact th, .table-compact td { padding: 7px 10px; }
/* Phones: list tables become stacked cards (labels are added by app.js) */
@media (max-width: 719px) {
    .table.stackable thead { display: none; }
    .table.stackable, .table.stackable tbody, .table.stackable tr, .table.stackable td { display: block; width: 100%; }
    .table.stackable tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
    .table.stackable tbody tr:last-child { border-bottom: 0; }
    .table.stackable td { display: block; overflow: hidden; padding: 3px 0; border: 0; text-align: right; white-space: normal; overflow-wrap: anywhere; }
    .table.stackable td::before { content: attr(data-label); float: left; margin-right: 14px; font-weight: 600; color: var(--muted); font-size: .82rem; text-align: left; max-width: 45%; }
    .table.stackable td:first-child { font-weight: 700; font-size: 1rem; }
    .table.stackable td.actions-cell { padding-top: 8px; }
    .table.stackable td.actions-cell::before, .table.stackable td[data-label=""]::before { display: none; }
    .table.stackable td:empty { display: none; }
    .table.stackable tfoot { display: block; } .table.stackable tfoot tr { background: var(--surface-2); }
}
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pg { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); font-weight: 600; }
.pg.off { border-color: transparent; color: var(--muted); font-weight: 500; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow-wrap: anywhere; }
.list-item .sub { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.dl { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; font-size: .88rem; } .dl dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Line editor (documents, journal) ---------- */
.lines { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.line-head { display: none; }
.line { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 12px; border-bottom: 1px solid var(--line); position: relative; }
.line .f-wide { grid-column: 1 / -1; }
.line label { font-size: .78rem; margin-bottom: 2px; }
.line output { display: block; min-height: 40px; padding: 8px 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.line .line-del { grid-column: 1 / -1; justify-self: end; }
.doc-lines .line .line-del { grid-column: auto; align-self: end; }
.lines-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--surface-2); }
@media (min-width: 900px) {
    .line-head, .line { display: grid; grid-template-columns: var(--cols); gap: 8px; align-items: center; padding: 8px 10px; }
    .line-head { background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
    .line label { display: none; }
    .line .f-wide, .line .line-del { grid-column: auto; }
    .line input, .line select { min-height: 36px; padding: 6px 9px; }
    .doc-lines { --cols: minmax(0, 1.5fr) minmax(0, 2fr) 76px 96px 110px minmax(0, 1.4fr) 104px 112px 36px; }
    .je-lines { --cols: minmax(0, 2.2fr) 140px 140px minmax(0, 2fr) 36px; }
    .line output { padding: 0; min-height: 0; }
}
.totals { margin-left: auto; width: min(100%, 340px); }
.totals div { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 2px solid var(--line-strong); margin-top: 4px; padding-top: 9px; font-size: 1.15rem; font-weight: 700; }

/* ---------- Charts ----------
   Series colours are a validated categorical set (colour-blind safe, fixed order): 1 blue, 2 orange, 3 aqua,
   4 yellow, 5 magenta, 7 violet; k0 is the neutral "Other". Each has its own step for the dark theme. */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s0: #9aa5a2; --grid: #e6ebe9; }
[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #2f9a2f; --s7: #9085e9; --s0: #5d6b68; --grid: #26312f; }
.k1 { background: var(--s1); } .k2 { background: var(--s2); } .k3 { background: var(--s3); } .k4 { background: var(--s4); } .k5 { background: var(--s5); } .k0 { background: var(--s0); }
.viz { margin-top: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--muted); }
.legend i, .mix i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; flex: none; }
.plot { display: flex; gap: 8px; height: 200px; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: .72rem; color: var(--faint); font-variant-numeric: tabular-nums; min-width: 34px; margin: -7px 0; }
.plot-area { position: relative; flex: 1; min-width: 0; border-bottom: 1px solid var(--line-strong);
    background: linear-gradient(var(--grid), var(--grid)) 0 0 / 100% 1px no-repeat, linear-gradient(var(--grid), var(--grid)) 0 50% / 100% 1px no-repeat; }
.xaxis { display: flex; margin: 6px 0 0 42px; font-size: .75rem; color: var(--muted); }
.xaxis span { flex: 1; text-align: center; min-width: 0; }
.bars { display: flex; height: 100%; }
.bars .col { flex: 1; min-width: 0; height: 100%; }
.bars .pair { height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bars .bar { width: 38%; max-width: 22px; min-height: 2px; border-radius: 4px 4px 0 0; cursor: default; transition: filter .12s; }
.bars .bar:hover, .bars .bar:focus-visible, .stackbar span:hover, .stackbar span:focus-visible { filter: brightness(1.12) saturate(1.15); outline: none; }
.line-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.line-svg .line { fill: none; stroke: var(--s1); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.line-svg .area { fill: var(--s1); opacity: .12; }
.dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--s1); box-shadow: 0 0 0 2px var(--surface); cursor: default; }
.dot::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; }          /* a larger area to point at */
.dot:hover, .dot:focus-visible { transform: scale(1.3); outline: none; }
.stackbar { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; }
.stackbar span { min-width: 3px; }
.mix { list-style: none; margin: 14px 0 0; padding: 0; }
.mix li { display: flex; align-items: center; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mix li:last-child { border: 0; }
.mix span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mix strong { font-variant-numeric: tabular-nums; }
.mix small { width: 52px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.tip { position: fixed; z-index: 80; pointer-events: none; max-width: 240px; padding: 7px 10px; border-radius: 8px; background: #111a19; color: #f1f6f5; font-size: .82rem; line-height: 1.4; white-space: pre-line; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .tip { background: #eef3f2; color: #101716; }

/* Stat tiles: a tinted icon chip and a coloured top edge per topic */
.kpi { position: relative; overflow: hidden; }
.kpi .chip { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--tone, var(--brand)); background: color-mix(in srgb, var(--tone, var(--brand)) 15%, transparent); }
.kpi[class*="tone-"]::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tone); }
.tone-1 { --tone: var(--s1); } .tone-2 { --tone: var(--s2); } .tone-3 { --tone: var(--s3); } .tone-4 { --tone: var(--s4); } .tone-5 { --tone: var(--s5); } .tone-7 { --tone: var(--s7); }

/* Menu: every section has its own colour on the icons */
.nav-link .ic { width: 30px; height: 30px; padding: 6px; border-radius: 9px; color: var(--g, var(--muted)); background: color-mix(in srgb, var(--g, var(--muted)) 14%, transparent); }
.nav-link:hover .ic { background: color-mix(in srgb, var(--g, var(--muted)) 24%, transparent); }
.nav-link.active { box-shadow: inset 3px 0 0 var(--g, var(--brand)); }
.nav-link.active .ic { color: #fff; background: var(--g, var(--brand)); }
.nav-link { --g: var(--brand); }
.nav-link[data-g="sales"] { --g: var(--s1); } .nav-link[data-g="purchases"] { --g: var(--s2); } .nav-link[data-g="inventory"] { --g: var(--s3); }
.nav-link[data-g="accounting"] { --g: var(--s7); } .nav-link[data-g="payroll"] { --g: var(--s5); } .nav-link[data-g="setup"] { --g: var(--s4); }
.nav-link[data-g="system"] { --g: #64748b; } .nav-link[data-g="support"] { --g: var(--s6); }
[data-theme="dark"] .nav-link[data-g="system"] { --g: #94a3b8; }
.nav-group { display: flex; align-items: center; gap: 8px; }
.nav-group::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Misc ---------- */
.log-box { font-family: var(--mono); font-size: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; background: #0b1211; color: #cfe6e1; border-radius: 10px; padding: 12px 14px; max-height: 320px; overflow: auto; }
.diff-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); font-size: .84rem; }
.diff-list li { padding: 5px 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.diff-list li:last-child { border: 0; }
.tag { display: inline-block; min-width: 68px; margin-right: 8px; padding: 0 6px; border-radius: 5px; font-size: .72rem; font-weight: 700; text-align: center; }
.tag-new { background: var(--green-bg); color: var(--green); } .tag-changed { background: var(--amber-bg); color: var(--amber); } .tag-deleted { background: var(--red-bg); color: var(--red); }
.dialog { border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(460px, calc(100vw - 28px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(8, 14, 13, .55); }
.dialog h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.doc { line-height: 1.65; }
.doc h3 { margin: 26px 0 8px; padding-top: 6px; } .doc h4 { margin: 18px 0 6px; }
.doc ol, .doc ul { padding-left: 22px; margin: 0 0 12px; } .doc li { margin-bottom: 5px; }
.doc table { margin-bottom: 14px; }
.doc .table th { white-space: normal; }
.doc .table td { overflow-wrap: anywhere; }
.doc .table th, .doc .table td { padding-left: 8px; padding-right: 8px; }
.doc code { overflow-wrap: anywhere; }
.doc pre { background: #0b1211; color: #cfe6e1; border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: .84rem; }
.toc { list-style: none; padding: 0; margin: 0; } .toc li { margin: 0; } .toc a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-weight: 550; }
.toc a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
@media (min-width: 1100px) { .sticky { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px); overflow: auto; } }
details.faq { border-bottom: 1px solid var(--line); } details.faq:last-child { border: 0; }
details.faq summary { cursor: pointer; padding: 13px 16px; font-weight: 600; list-style-position: outside; }
details.faq div { padding: 0 16px 14px; color: var(--muted); }

/* ---------- Sign-in / installer ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px 14px; }
.auth-card { width: min(100%, 420px); }
.auth-card.wide { width: min(100%, 640px); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; margin-bottom: 18px; }
.auth-brand h1 { font-size: 1.4rem; }
.auth-foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 14px; }

/* ---------- Printed documents and reports ----------
   .paper is the sheet for invoices, receipts and payslips: always white, in every theme, so the screen matches the print. */
:root { --brand-print: #b45410; }
.paper { --brand: var(--brand-print); --line: #dfe5e3; --line-strong: #c5cfcc; --muted: #555f5c; --surface-2: #f5f7f6; --text: #111; --surface: #fff;
    background: #fff; color: #111; border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 32px; box-shadow: var(--shadow); margin-bottom: 16px; }
.paper a { color: inherit; }
.lh { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 28px; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 3px solid var(--brand-print); }
.lh-co { display: flex; gap: 14px; align-items: flex-start; min-width: 0; flex: 1 1 260px; }
.lh-co img { width: 68px; height: 68px; object-fit: contain; flex: none; }
.lh-co strong { display: block; font-size: 1.2rem; line-height: 1.25; }
.lh-co span { display: block; font-size: .86rem; color: var(--muted); overflow-wrap: anywhere; }
.lh-doc { text-align: right; flex: 0 1 auto; margin-left: auto; }
.lh-doc h2 { font-size: 1.45rem; letter-spacing: .06em; color: var(--brand-print); margin-bottom: 6px; }
.lh-meta { margin-left: auto; border-collapse: collapse; font-size: .9rem; }
.lh-meta th { text-align: right; font-weight: 600; color: var(--muted); padding: 1px 10px 1px 0; white-space: nowrap; }
.lh-meta td { text-align: right; padding: 1px 0; font-variant-numeric: tabular-nums; }
.lh-meta th:empty { padding: 0; }
.stamp { display: inline-block; margin-top: 8px; padding: 2px 12px; border: 2.5px solid currentColor; border-radius: 6px; font-weight: 800; letter-spacing: .14em; transform: rotate(-4deg); color: #6b7280; }
.stamp-void { color: #b91c1c; } .stamp-paid { color: #15803d; }
.parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.party { border: 1px solid var(--line); border-left: 3px solid var(--brand-print); border-radius: 6px; padding: 10px 14px; max-width: 460px; }
.party .label { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; margin-bottom: 2px; }
.party strong { display: block; font-size: 1.02rem; }
.party span:not(.label) { display: block; font-size: .88rem; color: var(--muted); }
.doc-table th { background: var(--brand-print); color: #fff; border-bottom: 0; }
.doc-table td { border-bottom: 1px solid var(--line); }
.paper .table tbody tr:hover { background: transparent; }
.doc-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 32px; margin-top: 16px; }
.doc-notes { flex: 1 1 260px; min-width: 0; }
.doc-notes .label { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
.doc-notes p { margin: 0 0 10px; }
.doc-foot .totals { flex: 0 1 320px; margin: 0; }
.totals .due { font-weight: 700; }
.sigs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 28px; margin-top: 52px; }
.sigs div { border-top: 1px solid #6b7280; padding-top: 5px; text-align: center; }
.sigs span { display: block; font-weight: 600; font-size: .86rem; }
.sigs small { display: block; color: #6b7280; font-size: .72rem; }
.print-foot { margin: 22px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: .74rem; color: #6b7280; text-align: center; }
.payslip { break-inside: avoid; }
.print-only { display: none; }
.rpt-head .lh { margin-bottom: 0; }
.rpt .total:last-child td, .rpt tfoot tr:last-child td { border-bottom: 3px double var(--line-strong); }
@media (max-width: 639px) { .paper { padding: 16px; } .lh-doc { text-align: left; margin-left: 0; } .lh-meta { margin-left: 0; } .lh-meta th, .lh-meta td { text-align: left; } .sigs { margin-top: 36px; } }

@media print {
    @page { size: A4; margin: 14mm 12mm 16mm;
        @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8.5pt "Segoe UI", Arial, sans-serif; color: #6b7280; } }
    @page wide { size: A4 landscape; }
    .rpt-wide { page: wide; }
    /* print in the light colours whatever theme is on screen */
    :root, [data-theme="dark"] { --bg: #fff; --surface: #fff; --surface-2: #f5f7f6; --line: #d5dbd9; --line-strong: #9aa5a2; --text: #111; --muted: #555f5c; --faint: #7b8794;
        --brand: var(--brand-print); --red: #b91c1c; --green: #15803d; color-scheme: light; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    html, body { background: #fff; color: #111; }
    body { font-size: 10.5pt; line-height: 1.4; }
    .drawer, .backdrop, .topbar, .foot, .no-print, .alert, .tabs, .toolbar, .pager, .page-head .actions, .menu, .tip, dialog { display: none !important; }
    .print-only { display: block; }
    .main { margin: 0 !important; } .content { padding: 0; max-width: none; }
    .card, .paper { border: 0; box-shadow: none; border-radius: 0; margin: 0 0 10px; padding: 0; background: #fff; }
    .card-body { padding: 0 0 8px; } .card-head { padding: 0 0 6px; border: 0; }
    .table-wrap { overflow: visible; }
    .table { font-size: 9.5pt; }
    .table th, .table td { padding: 4px 8px; }
    .table th { background: #eef2f1; color: #222; border-bottom: 1.2pt solid #333; }
    .doc-table th { background: var(--brand-print); color: #fff; border-bottom: 0; }
    .table td { border-bottom: .5pt solid #d5dbd9; }
    .table .total td, .table tfoot td { background: none; border-top: .8pt solid #333; }
    .table .section td { background: #f5f7f6; }
    .table.stackable thead { display: table-header-group; }
    thead { display: table-header-group; } tr, .party, .totals, .sigs, .doc-foot { break-inside: avoid; }
    .payslip { break-inside: avoid; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px dashed #9aa5a2; }
    .payslip .print-foot { display: none; }
    h2, h3 { break-after: avoid; }
    a { color: inherit; text-decoration: none; }
    .badge { border: .6pt solid currentColor; background: none !important; }
    .neg { color: #b91c1c; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* search boxes for customers and vendors of big companies (select[data-lookup]) */
.lookup { position: relative; }
.lookup-select { position: absolute !important; opacity: 0; pointer-events: none; width: 1px !important; height: 1px !important; overflow: hidden; }
.lookup-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 320px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); }
.lookup-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.lookup-list li.on, .lookup-list li:hover { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.lookup-list li.none { color: var(--muted); cursor: default; }

/* Dashboard cards that open their breakdown */
.kpi-open { cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.kpi-open:hover { border-color: var(--tone, var(--brand)); transform: translateY(-1px); }
.kpi-open:focus-visible { outline: 2px solid var(--tone, var(--brand)); outline-offset: 2px; }
.kpi-open::after { content: "Details ›"; position: absolute; right: 14px; bottom: 12px; font-size: .75rem; font-weight: 600; color: var(--muted); opacity: .75; }
.kpi-open:hover::after { color: var(--tone, var(--brand)); opacity: 1; }
.kpi-dialog { width: min(640px, calc(100vw - 28px)); max-height: min(86vh, 900px); overflow: auto; padding: 18px 20px 20px; }
.kpi-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px -6px 8px 0; }
.kpi-dialog-head h3 { margin: 0; }
.kpi-loading { display: flex; align-items: center; gap: 10px; padding: 26px 4px; color: var(--muted); }
.kpi-loading .spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: kpispin .8s linear infinite; }
@keyframes kpispin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .kpi-loading .spinner { animation-duration: 2.4s; } .kpi-open, .kpi-open:hover { transition: none; transform: none; } }
.dd-table { font-size: .92rem; }
.dd-table td, .dd-table th { padding: 7px 10px; }
.dd-table tfoot td, .dd-table .dd-strong td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.dd-h { margin: 16px 0 6px; font-size: .95rem; }
.dd-note { margin: 8px 0 0; font-size: .88rem; }
.dd-names { margin: 0; color: var(--text); line-height: 1.6; }
.dd-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- Point of Sale (pos.php, assets/js/pos.js) ---------- */
.pos { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
    .pos { grid-template-columns: minmax(0, 1fr) 390px; align-items: start; }
    .pos-cart { position: sticky; top: calc(var(--topbar-h) + 14px); max-height: calc(100vh - var(--topbar-h) - 28px); display: flex; flex-direction: column; }
    .pos-lines { flex: 1; overflow: auto; min-height: 120px; }
    .pos-cartbar, .cart-close { display: none !important; }
}
.pos-gate { max-width: 460px; margin: 4vh auto; }
.pos-gate h3 { display: flex; gap: 8px; align-items: center; }
.pos-bar { display: flex; gap: 8px; align-items: center; }
.pos-search { flex: 1; }
.pos-search input { min-height: 48px; font-size: 1.05rem; }
.pos-sound .mute { display: none; }
.pos-sound.muted .mute { display: inline; }
.pos-sound.muted .wave { display: none; }
.pos-cats { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chipbtn { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 14px; font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chipbtn.on { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--brand-ink); }
.pos-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-top: 12px; }
.pos-item { position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left; min-height: 96px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; box-shadow: var(--shadow); }
.pos-item:hover, .pos-item:focus-visible { border-color: var(--brand); }
.pos-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; margin-bottom: 2px; background: var(--surface-2); }
.pos-noimg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; margin-bottom: 2px; background: hsl(var(--h) 55% 93%); color: hsl(var(--h) 45% 32%); font-style: normal; }
.pos-noimg b { font-size: 1.7rem; font-weight: 800; letter-spacing: .02em; line-height: 1; }
.pos-noimg svg { opacity: .55; }
[data-theme="dark"] .pos-noimg { background: hsl(var(--h) 30% 20%); color: hsl(var(--h) 60% 78%); }
.pos-item strong { font-size: .95rem; line-height: 1.25; overflow-wrap: anywhere; flex: 1; }
.pos-item .p-price { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.pos-item small { color: var(--muted); }
.pos-item small.neg { color: var(--red); }
.pos-item small.warn { color: var(--amber); }
.pos-item .p-tag { position: absolute; top: 14px; left: 16px; font-style: normal; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--blue-bg); color: var(--blue); }
.pos-item.out { opacity: .5; }
.pos-cart-head { gap: 8px; }
.pos-cart-head h3 { flex: 1; }
.order-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.order-title small { color: var(--muted); }
.pos-shift { display: flex; align-items: center; gap: 6px; padding: 6px 14px; font-size: .85rem; color: var(--green); background: var(--green-bg); }
.pos-customer { display: flex; gap: 10px; align-items: flex-end; padding: 10px 14px 0; flex-wrap: wrap; }
.pos-customer .field { flex: 1; min-width: 180px; margin: 0; }
.level-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; margin-bottom: 2px; }
.level-switch button { border: 0; background: var(--surface); color: var(--text); padding: 9px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.level-switch button.on { background: var(--brand-fill); color: var(--brand-ink); }
.pos-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pos-line .nm { font-weight: 600; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; }
.pos-line .nm small { font-weight: 400; color: var(--muted); }
.pos-line .line-note { font-weight: 400; font-size: .85rem; color: var(--amber); }
.pos-line .amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.pos-line .qtyc { display: flex; align-items: center; gap: 6px; }
.pos-line .qtyc button:not(.icon-btn) { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 1.15rem; font-weight: 700; cursor: pointer; }
.pos-line .qtyc input { width: 66px; min-height: 38px; padding: 4px 6px; text-align: center; }
.pos-line .rm { justify-self: end; }
.pos-foot { padding: 12px 14px; border-top: 1px solid var(--line); }
.disc-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px; gap: 8px; margin-bottom: 6px; }
.pos-buttons { display: grid; grid-template-columns: auto 1fr; gap: 8px; margin-top: 10px; }
.pos-buttons.rest { grid-template-columns: auto auto 1fr; }
.pos-buttons .btn { min-height: 52px; }
.pos-buttons .btn-primary { font-size: 1.05rem; }
.pos-cartbar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 14px 18px; border: 0; border-radius: 14px; background: var(--brand-fill); color: var(--brand-ink); font: inherit; font-weight: 700; font-size: 1.05rem; box-shadow: var(--shadow); cursor: pointer; }
.pos-cartbar .grow, .floor-bar .grow { flex: 1; }
@media (max-width: 899px) {
    .pos-cart { position: fixed; inset: 0; z-index: 40; border-radius: 0; display: none; flex-direction: column; overflow: auto; margin: 0; }
    .pos-cart.open { display: flex; }
    .pos-lines { flex: 1; }
    .pos-items { padding-bottom: 76px; }
    .hide-sm { display: none; }
}
.pos-toast { position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 90; max-width: 92vw; box-shadow: var(--shadow); }
.pos-dialog { width: min(540px, calc(100vw - 20px)); }
.pos-dialog .center { text-align: center; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.dlg-head h3 { margin: 0; }
.pay-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 8px; }
.pay-row label { margin: 0; color: var(--text); font-size: .95rem; display: flex; align-items: center; gap: 6px; }
.link-btn { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--brand); border-radius: 6px; font: inherit; font-size: .72rem; font-weight: 700; padding: 1px 6px; cursor: pointer; }
.quick-cash { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.qr-pay { display: flex; gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.qr-pay img { width: 120px; height: 120px; object-fit: contain; background: #fff; border-radius: 8px; flex: none; }
.qr-pay p { margin: 4px 0 8px; font-size: .85rem; }
.customer-display { width: min(460px, calc(100vw - 20px)); }
.cd-company { font-weight: 700; font-size: 1.1rem; }
.cd-amount { margin: 10px 0; }
.cd-amount small { display: block; color: var(--muted); }
.cd-amount strong { font-size: 2.2rem; font-variant-numeric: tabular-nums; }
.customer-display img { width: min(320px, 70vw); aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 12px; padding: 8px; }
.cd-method { margin: 10px 0 14px; font-weight: 600; }
.done-mark { width: 64px; height: 64px; margin: 4px auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--green-bg); color: var(--green); }
.done-change { font-size: 1.4rem; margin: 6px 0 12px; }
.done-change strong { font-size: 1.8rem; }
.note-chips, .guest-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.guest-chips .btn { min-width: 56px; min-height: 52px; font-size: 1.1rem; }
.stack { display: grid; gap: 8px; }
/* restaurant floor */
.pos-restaurant.show-floor { grid-template-columns: minmax(0, 1fr); }
.pos-restaurant.show-floor .pos-items, .pos-restaurant.show-floor .pos-cart, .pos-restaurant.show-floor .pos-cartbar { display: none !important; }
.pos-restaurant:not(.show-floor) .floor { display: none; }
.floor { grid-column: 1 / -1; }
.floor-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.floor-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.floor-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0 4px; color: var(--muted); font-size: .85rem; }
.floor-legend .lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.lg-dot.free { background: var(--surface); border: 2px solid var(--line-strong); }
.lg-dot.busy { background: var(--brand-fill); }
.lg-dot.pending { background: var(--amber); }
.floor-h { margin: 18px 0 4px; }
.table-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 10px; }
.table-grid.small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.table-card { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; min-height: 104px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow); }
.table-card:hover, .table-card:focus-visible { border-color: var(--brand); }
.table-card .t-name { font-weight: 800; font-size: 1.15rem; }
.table-card .t-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.table-card .t-meta, .table-card .t-state { font-size: .82rem; color: var(--muted); }
.table-card.busy { border-color: var(--brand); background: var(--brand-soft); }
.table-card.busy .t-state { color: var(--brand-strong); font-weight: 600; }
.table-card.pending { border-color: var(--amber); background: var(--amber-bg); }
.table-card.pending .t-state { color: var(--amber); }
.table-card.free .t-state { color: var(--green); font-weight: 600; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pos-method { flex-wrap: wrap; align-items: center; }
.qr-up { cursor: pointer; white-space: nowrap; }
.qr-up img { border-radius: 4px; background: #fff; }
.qr-up:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.qr-drop { margin-left: 4px; }
[hidden] { display: none !important; }
.pos-buttons.rest { grid-template-columns: 1fr 1fr; }
.pos-buttons.rest #payBtn { grid-column: 1 / -1; }
.floor-legend span { display: inline-flex; align-items: center; gap: 2px; }
.pos-cart, .pos-items { min-width: 0; }

/* POS display choices: hide out of stock, list view */
.pos-toggle.on { background: var(--brand-soft); color: var(--brand-strong); }
.pos-toggle .strike { display: none; }
.pos-toggle.on .strike { display: inline; }
#viewBtn .v-grid { display: none; }
#viewBtn.on .v-grid { display: inline; }
#viewBtn.on .v-list { display: none; }
.pos-grid.list { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.pos-grid.list .pos-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 12px; row-gap: 0; align-items: center; min-height: 0; padding: 8px 12px; }
.pos-grid.list .pos-item img, .pos-grid.list .pos-noimg { grid-row: 1 / 3; width: 48px; height: 48px; aspect-ratio: 1; margin: 0; }
.pos-grid.list .pos-noimg svg { display: none; }
.pos-grid.list .pos-noimg b { font-size: 1rem; }
.pos-grid.list .pos-item strong { grid-column: 2; grid-row: 1; }
.pos-grid.list .pos-item small { grid-column: 2; grid-row: 2; }
.pos-grid.list .pos-item .p-price { grid-column: 3; grid-row: 1 / 3; font-size: 1.05rem; }
.pos-grid.list .pos-item .p-tag { position: static; grid-column: 3; grid-row: 2; justify-self: end; display: none; }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

/* POS: order slips waiting for the cashier, order numbers */
.slip-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 14px 0; padding: 8px 12px; border-radius: 10px; background: var(--amber-bg); color: var(--amber); }
.slip-bar small { color: inherit; opacity: .85; }
.pos-buttons.three { grid-template-columns: auto auto 1fr; }
.pos-buttons.taker { grid-template-columns: 1fr; }
.done-no { margin: 4px 0 10px; font-size: 1.1rem; }
.done-no strong { display: block; font-size: 3.4rem; line-height: 1; }
/* full-screen pages: kitchen display, now serving, kiosk */
.screen-page { min-height: 100vh; background: var(--bg); color: var(--text); }
.screen-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.screen-bar .grow, .k-head .grow, .k-line .grow { flex: 1; }
.kds { display: grid; gap: 16px; padding: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 899px) { .kds { grid-template-columns: minmax(0, 1fr); } }
.kds h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.kds-h { margin: 18px 0 8px; font-size: .95rem; }
.kds-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.kds-grid.small .kds-card { opacity: .6; }
.kds-card { display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.kds-card.new { border-color: var(--amber); }
.kds-card.late { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.kds-card.ready { border-color: var(--green); }
.kds-card header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-2); }
.kds-card header strong { font-size: 1.6rem; line-height: 1; }
.kds-card ul { list-style: none; margin: 0; padding: 10px 12px; display: grid; gap: 6px; font-size: 1.05rem; flex: 1; }
.kds-card ul b { display: inline-block; min-width: 2.2em; }
.kds-card em { display: block; color: var(--amber); font-size: .9rem; }
.kds-note { margin: 0 12px 8px; color: var(--amber); }
.kds-card footer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.kds-card footer .btn-primary { flex: 1; min-height: 46px; font-size: 1.05rem; }
.serving-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0; min-height: calc(100vh - 60px); }
.serving-cols section { padding: 24px; }
.serving-cols .ready { background: var(--green-bg); }
.serving-cols h2 { font-size: 2rem; margin: 0 0 20px; }
.serving-cols .ready h2 { color: var(--green); }
.serving .nums { display: flex; flex-wrap: wrap; gap: 18px; }
.serving .nums span { font-size: clamp(3rem, 8vw, 7rem); font-weight: 800; line-height: 1; min-width: 1.6em; font-variant-numeric: tabular-nums; }
.serving .ready .nums span { color: var(--green); }
.serving .nums span.new { animation: kpulse 1s ease-in-out 4; }
@keyframes kpulse { 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .serving .nums span.new { animation: none; } }
.kiosk { user-select: none; }
.k-start, .k-done { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 24px; }
.k-start h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 0; }
.k-logo { width: 120px; height: 120px; object-fit: contain; }
.k-choose { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }
.k-big { width: min(300px, 80vw); min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 18px 16px 20px; border: 3px solid var(--brand-fill, var(--brand)); border-radius: 22px; background: var(--surface); color: var(--text); font: inherit; font-size: 2rem; font-weight: 800; line-height: 1.1; cursor: pointer; box-shadow: var(--shadow); transition: transform .12s; }
.k-big:active { background: var(--brand-soft); transform: scale(.98); }
.k-big small { font-size: 1rem; font-weight: 500; color: var(--muted); }
/* kiosk pictures: dine-in (plate, fork and knife) and take-out (bag and cup), in the theme colours */
.k-ill { width: min(200px, 60vw); height: auto; margin-bottom: 6px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.k-ill-table { fill: var(--line-strong); } .k-ill-shadow { fill: var(--text); opacity: .07; }
.k-ill-plate { fill: var(--surface-2); stroke: var(--text); stroke-width: 4; } .k-ill-rim { stroke: var(--line-strong); stroke-width: 3; }
.k-ill-food { fill: var(--brand-fill, var(--brand)); } .k-ill-line { stroke: var(--text); stroke-width: 4; }
.k-ill-steam { stroke: var(--muted); stroke-width: 3; } .k-ill-tool { stroke: var(--text); stroke-width: 5; }
.k-ill-bag { fill: #d9a066; stroke: var(--text); stroke-width: 4; } .k-ill-fold { stroke: #8a5a2b; stroke-width: 3; } .k-ill-handle { stroke: var(--text); stroke-width: 5; }
.k-ill-badge { fill: var(--brand-fill, var(--brand)); } .k-ill-mark { stroke: var(--brand-ink, #fff); stroke-width: 4; }
.k-ill-cup { fill: var(--surface); stroke: var(--text); stroke-width: 4; } .k-ill-lid { fill: var(--text); } .k-ill-band { fill: var(--brand-fill, var(--brand)); } .k-ill-straw { stroke: var(--red); stroke-width: 5; }
@media (max-height: 560px) { .k-ill { width: 120px; } .k-big { min-height: 140px; } }
.k-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.k-cats { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; }
.k-cats .chipbtn { font-size: 1.15rem; padding: 12px 20px; }
.k-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 0 16px 16px; }
@media (max-width: 899px) { .k-body { grid-template-columns: minmax(0, 1fr); } }
.k-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-content: start; }
.k-item { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s; }
.k-item.k-pop { transform: scale(.96); }
.k-item img, .k-noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.k-noimg { display: grid; place-items: center; font-style: normal; font-size: 2rem; font-weight: 800; color: var(--brand); }
.k-item strong { font-size: 1.1rem; }
.k-item small { color: var(--muted); }
.k-item span { font-size: 1.2rem; font-weight: 800; color: var(--brand); }
.k-cart { position: sticky; top: 12px; align-self: start; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.k-cart h2 { margin: 0 0 8px; }
.k-line { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.k-line small { display: block; color: var(--muted); }
.k-line button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 1.4rem; font-weight: 700; cursor: pointer; }
.k-line b { min-width: 1.6em; text-align: center; font-size: 1.15rem; }
.k-total { display: flex; justify-content: space-between; font-size: 1.3rem; margin: 12px 0; }
.k-place { width: 100%; min-height: 64px; font-size: 1.4rem; }
.k-no { font-size: clamp(6rem, 22vw, 12rem); font-weight: 800; line-height: 1; color: var(--brand); }
.k-done p { font-size: 1.4rem; margin: 0; }
.k-staff { position: fixed; right: 8px; bottom: 6px; color: var(--muted); text-decoration: none; opacity: .4; padding: 6px; }
.qr-up { position: relative; overflow: hidden; }
.qr-up .visually-hidden { left: 0; top: 0; }

/* X reading: items sold and signatories */
.slip-items { width: 100%; border-collapse: collapse; font-size: .9em; margin: 4px 0; }
.slip-items th { text-align: right; font-weight: 700; border-bottom: 1px dashed currentColor; padding: 2px 0 2px 6px; white-space: nowrap; }
.slip-items th:first-child, .slip-items td:first-child { text-align: left; padding-left: 0; }
.slip-items td { padding: 3px 0 3px 6px; vertical-align: top; }
.slip-items td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.slip-items small { color: inherit; opacity: .75; }
.slip-items tfoot td { font-weight: 700; border-top: 1px dashed currentColor; }
.slip-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 34px; text-align: center; font-size: .9em; }
.slip-sign .line { display: block; border-top: 1px solid currentColor; padding-top: 3px; margin-bottom: 2px; min-height: 1.2em; font-weight: 700; }

/* queue: counter console */
.q-now { text-align: center; }
.q-now small { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.q-now-no { font-size: clamp(4rem, 12vw, 8rem); font-weight: 800; line-height: 1.05; color: var(--brand); font-variant-numeric: tabular-nums; margin: 6px 0; }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.q-actions .btn { min-height: 46px; }
.q-big { font-size: 1.15rem; padding-inline: 22px; }
.q-console .join { justify-content: center; }
.q-svc + .q-svc { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.q-svc h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.q-svc h4 i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.q-svc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.q-svc li { display: flex; align-items: center; gap: 6px; }
.q-svc li .btn { margin-left: auto; }
.q-hour { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) 3em; align-items: center; gap: 8px; margin: 4px 0; font-size: .9rem; }
.q-hour i { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--brand-fill); min-width: 2px; }
.q-hour b { text-align: right; font-variant-numeric: tabular-nums; }
/* queue settings: layout choice, logo */
.q-logo-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; margin: 4px 0 8px; }
.q-logo-prev { width: 180px; height: 90px; display: grid; place-items: center; border-radius: 10px; background: #0b1220; padding: 8px; box-sizing: border-box; }
.q-logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.q-logo-prev.plate img { background: #fff; padding: 4px 8px; border-radius: 6px; }
.q-layouts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 6px 0; }
.q-layout { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--surface); }
.q-layout:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.q-layout input { position: absolute; opacity: 0; pointer-events: none; }
.q-layout:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.q-layout small { color: var(--muted); }
.q-mini { display: grid; gap: 4px; aspect-ratio: 16 / 9; padding: 6px; border-radius: 8px; background: #0f172a; margin-bottom: 6px; }
.q-mini i { display: block; border-radius: 4px; }
.q-mini-video { grid-template-columns: 1.7fr 1fr; }
.q-mini-video .v { background: linear-gradient(135deg, #334155, #64748b); }
.q-mini-video .l { display: grid; gap: 4px; }
.q-mini-video .l b { background: #1e293b; border-left: 4px solid #22c55e; border-radius: 3px; }
.q-mini-plain { grid-template-columns: 1fr 1fr; }
.q-mini-plain .t { background: #1e293b; border-top: 4px solid #3b82f6; }

/* queue: ticket kiosk */
.qk { user-select: none; }
.qk-start, .qk-done { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.qk-start h1 { font-size: clamp(2rem, 5vw, 3.6rem); margin: 0; }
.qk-start header p { font-size: clamp(1.1rem, 2.4vw, 1.6rem); color: var(--muted); margin: 6px 0 0; }
.qk-logo { width: clamp(80px, 12vw, 140px); height: auto; aspect-ratio: 1; object-fit: contain; }
.qk-services { display: grid; gap: clamp(12px, 2vw, 22px); width: min(1100px, 100%); grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); margin-top: 10px; }
.qk-svc { --c: var(--brand); display: flex; align-items: center; gap: 16px; min-height: clamp(96px, 16vh, 160px); padding: 16px 22px; text-align: left; border: 0; border-radius: 22px; background: var(--c); color: #fff; font: inherit; cursor: pointer; box-shadow: var(--shadow); }
.qk-svc b { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; min-width: 1.3em; text-align: center; padding: 8px 10px; border-radius: 14px; background: rgba(0, 0, 0, .18); }
.qk-svc span { font-size: clamp(1.25rem, 2.6vw, 1.9rem); font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.qk-svc:active { transform: scale(.98); }
.qk-svc:disabled { opacity: .6; }
.qk-prio { color: var(--text); display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 14px 22px; border: 2px solid var(--line-strong); border-radius: 18px; background: var(--surface); cursor: pointer; text-align: left; }
.qk-prio input { width: 32px; height: 32px; accent-color: var(--amber); }
.qk-prio span { font-size: 1.3rem; font-weight: 700; }
.qk-prio small { display: block; font-size: .95rem; font-weight: 400; color: var(--muted); }
.qk-prio:has(input:checked) { border-color: var(--amber); background: var(--amber-bg); }
.qk-done > p { font-size: clamp(1.2rem, 2.6vw, 1.7rem); margin: 0; }
.qk-no { font-size: clamp(6rem, 24vw, 14rem); font-weight: 800; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.qk-svcname { font-weight: 700; }
.qk-done .btn { min-height: 60px; min-width: 200px; font-size: 1.3rem; margin-top: 10px; }

/* queue: display board (any screen, from a laptop to a large TV; landscape or portrait) */
.qd { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: #0b1220; color: #f8fafc; font-size: clamp(14px, 1.15vmax, 40px); }
.qd.qd-nocursor, .qd.qd-nocursor * { cursor: none; }
.qd-head { display: flex; align-items: center; gap: 1em; padding: .6em 1.2em; background: #111a2e; border-bottom: 1px solid #1f2a44; }
.qd-head .grow { flex: 1; }
.qd-logo { display: inline-flex; align-items: center; height: 2.6em; flex-shrink: 0; }
.qd-logo img { height: 100%; width: auto; max-width: 30vw; object-fit: contain; display: block; }
.qd-logo-s { height: 2em; } .qd-logo-l { height: 3.6em; } .qd-logo-xl { height: 5em; }
.qd-logo.plate, .qd-logo-big.plate { background: #fff; padding: .25em .5em; border-radius: .4em; box-sizing: content-box; }
.qd-logo-big { display: inline-flex; max-width: 40%; }
.qd-logo-big img { max-width: 100%; max-height: 30vh; object-fit: contain; }
.qd-logo-big.plate { padding: .8em 1.2em; border-radius: .8em; }
.qd-title { font-size: 1.6em; }
.qd-clock { text-align: right; line-height: 1.1; }
.qd-clock span { display: block; font-size: 1.8em; font-weight: 800; font-variant-numeric: tabular-nums; }
.qd-clock small { color: #94a3b8; }
.qd-main { flex: 1; min-height: 0; display: grid; gap: 1em; padding: 1em; }
.qd-video .qd-main { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.qd-media { position: relative; min-height: 0; border-radius: .8em; overflow: hidden; background: #000; display: grid; place-items: center; }
.qd-media video, .qd-media iframe { width: 100%; height: 100%; object-fit: contain; border: 0; background: #000; }
.qd-placeholder { display: flex; flex-direction: column; align-items: center; gap: .5em; color: #94a3b8; text-align: center; padding: 1em; }
.qd-placeholder span { font-size: 2em; font-weight: 800; color: #e2e8f0; }
.qd-board { min-height: 0; display: flex; flex-direction: column; gap: .6em; overflow: hidden; }
.qd-h { margin: 0; font-size: 1.3em; text-transform: uppercase; letter-spacing: .12em; color: #94a3b8; }
.qd-counters { display: grid; gap: .6em; align-content: start; }
.qd-row { --c: #3b82f6; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .2em .8em; padding: .5em .9em; border-radius: .6em; background: #16213a; border-left: .35em solid var(--c); }
.qd-ctr { font-size: 1.25em; font-weight: 700; color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qd-no { font-size: 2.6em; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.qd-prio { grid-column: 1 / -1; justify-self: start; font-size: .8em; font-weight: 700; padding: .1em .6em; border-radius: 99px; background: #f59e0b; color: #111; }
.qd-row.idle .qd-no { color: #475569; }
.qd-row.latest { background: #1d3a2b; box-shadow: 0 0 0 .15em #22c55e inset; }
.qd-row.latest .qd-no { color: #4ade80; animation: kpulse 1s ease-in-out 3; }
.qd-plain .qd-counters { flex: 1; grid-template-columns: repeat(auto-fit, minmax(min(15em, 100%), 1fr)); grid-auto-rows: minmax(0, 1fr); align-content: stretch; }
.qd-plain .qd-row { grid-template-columns: 1fr; text-align: center; justify-items: center; align-content: center; border-left: 0; border-top: .4em solid var(--c); padding: .6em; }
.qd-plain .qd-ctr { font-size: 1.6em; }
.qd-plain .qd-no { font-size: clamp(3rem, 7vmax, 14rem); }
.qd-plain .qd-prio { justify-self: center; }
.qd-next { border-top: 1px solid #1f2a44; padding-top: .5em; }
.qd-next:empty { display: none; }
.qd-next h3 { margin: 0 0 .3em; font-size: 1em; color: #94a3b8; text-transform: uppercase; letter-spacing: .1em; }
.qd-line { display: flex; flex-wrap: wrap; align-items: center; gap: .3em .7em; margin: .25em 0; }
.qd-line b { font-size: 1.25em; font-variant-numeric: tabular-nums; color: #e2e8f0; }
.qd-svc { --c: #3b82f6; font-size: .85em; font-weight: 700; padding: .1em .6em; border-radius: .4em; background: var(--c); color: #fff; }
.qd-foot { background: #111a2e; border-top: 1px solid #1f2a44; overflow: hidden; white-space: nowrap; }
.qd-ticker { padding: .5em 0; font-size: 1.2em; }
.qd-ticker span { display: inline-block; padding-left: 100%; animation: qdtick 28s linear infinite; }
@keyframes qdtick { to { transform: translateX(-100%); } }
.qd-call { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2em; background: rgba(8, 13, 26, .92); text-align: center; }
.qd-call small { font-size: 2em; text-transform: uppercase; letter-spacing: .15em; color: #94a3b8; }
.qd-call b { font-size: clamp(5rem, 20vmin, 26rem); line-height: 1; color: #4ade80; font-variant-numeric: tabular-nums; animation: kpulse 1s ease-in-out 3; }
.qd-call span { font-size: clamp(2rem, 7vmin, 8rem); font-weight: 700; }
.qd-start { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4em; border: 0; background: rgba(8, 13, 26, .85); color: #fff; font: inherit; font-size: 2em; font-weight: 700; cursor: pointer; }
.qd-start small { font-size: .55em; font-weight: 400; color: #94a3b8; }
@media (orientation: portrait) {
    .qd-video .qd-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
    .qd-video .qd-media { aspect-ratio: 16 / 9; }
    .qd { font-size: clamp(14px, 1.6vmax, 44px); }
}
@media (prefers-reduced-motion: reduce) { .qd-ticker span, .qd-row.latest .qd-no, .qd-call b { animation: none; } .qd-ticker span { padding-left: 0; } }

/* ---------- Side drawer: black, the open page in the accent colour (the Advance POS look) ---------- */
.drawer { --surface: var(--side); --surface-2: var(--side-2); --line: var(--side-line); --text: var(--side-strong); --muted: var(--side-text); --faint: #8b8d96;
    --s1: #3987e5; --s2: #ef7a45; --s3: #22b884; --s4: #e0a521; --s5: #e0699a; --s6: #2fae4a; --s7: #9085e9;
    background: var(--side); color: var(--side-text); border-right-color: var(--side-line); color-scheme: dark; }
.drawer .nav-link[data-g="pos"] { --g: #ee6b6a; } .drawer .nav-link[data-g="system"] { --g: #a3acb9; }
.drawer .nav-link:hover { background: var(--side-2); color: var(--side-strong); }
.drawer .nav-link.active, [data-theme="dark"] .drawer .nav-link.active { background: var(--brand-fill); color: var(--brand-ink); box-shadow: none; }
.drawer .nav-link.active .ic { background: rgba(0, 0, 0, .14); color: var(--brand-ink); }
.drawer .brand, .drawer .me-text strong { color: var(--side-strong); }
/* Company Settings → Modules: sections with their features */
.mod-sections { display: grid; gap: 12px; margin-bottom: 16px; }
.mod-sections .card { margin: 0; }
.mod-sec > summary { list-style: none; }
.mod-sec > summary::-webkit-details-marker { display: none; }
.mod-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.mod-head::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: none; }
.mod-sec[open] .mod-head::before { transform: rotate(45deg); }
.mod-title { flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.mod-title strong { font-size: 1.02rem; }
.mod-sec.is-off .mod-title strong { color: var(--muted); }
.mod-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.mod-core { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0; color: var(--muted); font-size: .92rem; }
.mod-core .ic { color: var(--green); margin-top: 2px; }
.mod-items { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
.mod-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; font-weight: 400; color: var(--text); }
.mod-item input { margin-top: 3px; accent-color: var(--brand-fill, var(--brand)); }
.mod-item small { display: block; color: var(--muted); font-size: .82rem; }
.mod-item:has(input:checked) { border-color: var(--brand-fill, var(--brand)); background: var(--brand-soft); }
.mod-item:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.mod-tools { display: flex; gap: 8px; margin-top: 10px; }
.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 46px; height: 26px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + span { background: var(--brand-fill, var(--brand)); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Self-order kiosk background: built-in food and drink pattern, your own picture (softened), or plain */
.kiosk.k-bg-pattern { background-color: var(--bg); background-image: radial-gradient(ellipse at top, color-mix(in srgb, var(--brand-fill, var(--brand)) 16%, transparent), transparent 60%), url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22200%22 viewBox=%220 0 200 200%22 fill=%22none%22 stroke=%22%23b45410%22 stroke-opacity=%220.13%22 stroke-width=%223%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M18 40h30v22a12 12 0 0 1-12 12h-6a12 12 0 0 1-12-12z M48 46h5a6 6 0 0 1 0 12h-5 M26 32c-3-4 3-6 0-10 M36 32c-3-4 3-6 0-10%22/%3E%3Cpath d=%22M112 30a26 14 0 0 1 52 0z M110 38h56 M112 46h52 M114 52h48a4 4 0 0 1-4 6h-40a4 4 0 0 1-4-6z M126 23l1 1 M140 20l1 1 M152 24l1 1%22/%3E%3Cpath d=%22M30 120l8 40h24l8-40z M38 120l-4-22 M46 120l-1-26 M54 120l1-24 M62 120l4-20 M36 136h28%22/%3E%3Cpath d=%22M124 118h30l-4 44h-22z M121 112h36 M146 112l8-16h8 M126 134h26%22/%3E%3Cpath d=%22M88 78v14a5 5 0 0 0 10 0V78 M93 78v12 M93 97v22 M104 78c6 4 7 14 5 22h-5v19%22/%3E%3Cpath d=%22M170 150l24 38-48 0z M160 168l2 2 M174 178l2 2 M178 162l2 2%22/%3E%3Ccircle cx=%22186%22 cy=%2296%22 r=%223%22/%3E%3Ccircle cx=%2212%22 cy=%22186%22 r=%223%22/%3E%3Ccircle cx=%2296%22 cy=%22176%22 r=%222%22/%3E%3C/svg%3E"); background-attachment: fixed; }
[data-theme="dark"] .kiosk.k-bg-pattern { background-image: radial-gradient(ellipse at top, color-mix(in srgb, var(--brand-fill, var(--brand)) 18%, transparent), transparent 60%), url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22200%22 viewBox=%220 0 200 200%22 fill=%22none%22 stroke=%22%23f97316%22 stroke-opacity=%220.14%22 stroke-width=%223%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M18 40h30v22a12 12 0 0 1-12 12h-6a12 12 0 0 1-12-12z M48 46h5a6 6 0 0 1 0 12h-5 M26 32c-3-4 3-6 0-10 M36 32c-3-4 3-6 0-10%22/%3E%3Cpath d=%22M112 30a26 14 0 0 1 52 0z M110 38h56 M112 46h52 M114 52h48a4 4 0 0 1-4 6h-40a4 4 0 0 1-4-6z M126 23l1 1 M140 20l1 1 M152 24l1 1%22/%3E%3Cpath d=%22M30 120l8 40h24l8-40z M38 120l-4-22 M46 120l-1-26 M54 120l1-24 M62 120l4-20 M36 136h28%22/%3E%3Cpath d=%22M124 118h30l-4 44h-22z M121 112h36 M146 112l8-16h8 M126 134h26%22/%3E%3Cpath d=%22M88 78v14a5 5 0 0 0 10 0V78 M93 78v12 M93 97v22 M104 78c6 4 7 14 5 22h-5v19%22/%3E%3Cpath d=%22M170 150l24 38-48 0z M160 168l2 2 M174 178l2 2 M178 162l2 2%22/%3E%3Ccircle cx=%22186%22 cy=%2296%22 r=%223%22/%3E%3Ccircle cx=%2212%22 cy=%22186%22 r=%223%22/%3E%3Ccircle cx=%2296%22 cy=%22176%22 r=%222%22/%3E%3C/svg%3E"); }
.kiosk.k-bg-image { background: linear-gradient(color-mix(in srgb, var(--bg) 72%, transparent), color-mix(in srgb, var(--bg) 86%, transparent)), var(--k-bg) center / cover no-repeat fixed var(--bg); }
.kiosk.k-bg-pattern .k-start h1, .kiosk.k-bg-image .k-start h1 { text-shadow: 0 1px 0 var(--bg), 0 0 18px var(--bg); }
.kiosk.k-bg-pattern .k-start > p, .kiosk.k-bg-image .k-start > p { display: inline-block; padding: 4px 14px; border-radius: 99px; background: color-mix(in srgb, var(--surface) 85%, transparent); }
.kiosk .k-head { position: sticky; top: 0; z-index: 5; }
/* Now Serving screen: the order just ready, shown large */
.srv-call b { color: #4ade80; } .srv-call span { font-size: clamp(1.4rem, 4vmin, 3rem); color: #cbd5e1; font-weight: 600; } .srv-call small { font-size: clamp(1.4rem, 4vmin, 3rem); }
.serving .qd-start { font-size: clamp(1.4rem, 3vw, 2.4rem); }
.mod-group { margin: 10px 2px -2px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mod-group small { text-transform: none; letter-spacing: 0; font-weight: 400; }
