/* Dartnotan – register for club bars. Built for tablets first: big touch targets, no hover-only UI. */

:root {
    --font-display: "DM Serif Display", Georgia, serif;
    --font-body: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
    --radius: 14px;
    --radius-sm: 10px;
    --tap: 56px;
    --gutter: 16px;
    --sidebar: 380px;
}

/* ---------- colour themes (per device) ---------- */
:root, [data-theme="dart"] {
    --bg: #0e1813;
    --surface: #13211a;
    --surface-2: #1a2b22;
    --surface-3: #22362b;
    --line: #26392e;
    --text: #f3ecda;
    --muted: #93a596;
    --accent: #d6b25e;
    --accent-ink: #1d1606;
    --danger: #e2583e;
    --danger-ink: #fff4ef;
    --positive: #d6b25e;
    --overlay: rgba(5, 10, 7, .72);
    color-scheme: dark;
}
[data-theme="filt"] {
    --bg: #0a2a1c;
    --surface: #0e3423;
    --surface-2: #134330;
    --surface-3: #19533b;
    --line: #1f5b41;
    --text: #f2f0e4;
    --muted: #9cc2ab;
    --accent: #e3bd5f;
    --accent-ink: #1d1606;
    --danger: #ef6a4a;
    --danger-ink: #fff4ef;
    --positive: #e3bd5f;
    --overlay: rgba(3, 15, 9, .72);
    color-scheme: dark;
}
[data-theme="krita"] {
    --bg: #f2ede3;
    --surface: #fbf7ef;
    --surface-2: #efe7d8;
    --surface-3: #e5dbc8;
    --line: #dcd1bd;
    --text: #1f1b14;
    --muted: #6d6452;
    --accent: #9a6f1c;
    --accent-ink: #fffaf0;
    --danger: #c0412a;
    --danger-ink: #fff7f4;
    --positive: #8a6418;
    --overlay: rgba(40, 32, 18, .45);
    color-scheme: light;
}
[data-theme="natt"] {
    --bg: #07080a;
    --surface: #0f1114;
    --surface-2: #161a1e;
    --surface-3: #1e2328;
    --line: #23282e;
    --text: #eceff3;
    --muted: #8a929c;
    --accent: #e3b24a;
    --accent-ink: #1a1305;
    --danger: #ef5b45;
    --danger-ink: #fff4ef;
    --positive: #e3b24a;
    --overlay: rgba(0, 0, 0, .75);
    color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
    touch-action: manipulation;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; letter-spacing: .2px; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }
.danger-text { color: var(--danger); }
.positive-text { color: var(--positive); }
.hidden { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--tap); padding: 0 20px;
    border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--surface-2); color: var(--text);
    font-weight: 600; font-size: 16px; text-decoration: none;
    cursor: pointer; user-select: none; -webkit-user-select: none;
    transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.btn-ghost { background: transparent; }
.btn.danger-text { color: var(--danger); }
.btn-block { width: 100%; }
.btn-lg { min-height: 64px; font-size: 18px; }
.btn.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.input {
    width: 100%; min-height: var(--tap); padding: 0 16px;
    border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--surface-2); color: var(--text); font-size: 17px; outline: none;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted); }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.error-text { color: var(--danger); font-size: 14px; min-height: 20px; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--tap); height: var(--tap); border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
    cursor: pointer; text-decoration: none;
}
.icon-btn:active { transform: scale(.95); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- app shell (register screen) ---------- */
.app { height: 100dvh; display: grid; grid-template-rows: auto auto 1fr; grid-template-columns: minmax(0, 1fr); overflow: hidden; }
[data-icon] { display: inline-flex; }

.topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px var(--gutter); padding-top: max(10px, env(safe-area-inset-top));
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.brand-mark { width: 44px; height: 44px; border-radius: 50%; flex: none; object-fit: cover; color: var(--accent); }
.brand-name { font-family: var(--font-display); font-size: 26px; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 13px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { border-color: var(--accent); color: var(--accent); }
.menu-list {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 220px;
    display: grid; padding: 6px; border-radius: var(--radius); border: 1px solid var(--line);
    background: var(--surface-2); box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.menu-list a {
    display: flex; align-items: center; min-height: var(--tap); padding: 0 16px;
    border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 500; font-size: 17px;
}
.menu-list a:active { background: var(--surface-3); }
.menu-list.pin-form { padding: 14px; gap: 10px; min-width: 260px; }

.staff-chip {
    display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
    min-height: var(--tap); text-decoration: none;
}
.staff-chip .who { display: grid; line-height: 1.1; }
.staff-chip .who small { color: var(--muted); font-size: 12px; }
.staff-chip .chip-gear { color: var(--muted); margin-left: 2px; }
.staff-chip .chip-gear svg { width: 20px; height: 20px; }
.staff-chip:active { transform: scale(.97); }
.avatar {
    width: 46px; height: 46px; border-radius: 50%; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-3); border: 1px solid var(--line);
    font-weight: 600; font-size: 15px; letter-spacing: .5px; object-fit: cover; overflow: hidden;
}
.avatar-sm { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 88px; height: 88px; font-size: 28px; }

.lock-btn { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lock-countdown {
    margin-left: 4px; padding: 2px 8px; border-radius: 999px;
    background: var(--danger); color: var(--danger-ink); font-size: 14px; font-variant-numeric: tabular-nums;
}

.registerbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--line);
}
.register-switch {
    display: flex; align-items: center; gap: 10px; text-decoration: none;
    min-height: 48px; padding: 4px 14px 4px 0;
}
.register-switch .label { font-size: 12px; color: var(--muted); }
.register-switch .name { font-weight: 700; font-size: 18px; }
.register-switch svg { width: 18px; height: 18px; color: var(--muted); }
.sold { text-align: right; }
.sold .label { font-size: 12px; color: var(--muted); }
.sold .value { font-weight: 700; font-size: 20px; color: var(--accent); }

.main { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 0; }
.main > *, .panel > *, .sidebar > * { min-width: 0; }

/* ---------- customer list (left) ---------- */
.sidebar { display: grid; grid-template-rows: auto auto auto 1fr auto; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
/* The list picker (Listor) is one more row; only the customer list takes the free height. */
.sidebar:has(> .list-pick:not(.hidden)) { grid-template-rows: auto auto auto auto 1fr auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px var(--gutter); border-bottom: 1px solid var(--line); }
.stats .label { font-size: 12px; color: var(--muted); }
.stats .value { font-weight: 700; font-size: 17px; }
.search { position: relative; padding: 12px var(--gutter) 8px; }
.search > span { position: absolute; left: calc(var(--gutter) + 16px); top: calc(50% + 2px); transform: translateY(-50%); display: inline-flex; pointer-events: none; }
.search svg { width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 48px; }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 var(--gutter) 12px; border-bottom: 1px solid var(--line); }
.filters .btn { min-height: 50px; padding: 0 8px; }
.list-pick { display: flex; align-items: center; gap: 10px; padding: 0 var(--gutter) 8px; }
.list-pick .label { font-size: 13px; color: var(--muted); }
.list-pick .input { min-height: 50px; }
.opening-rows { display: grid; border-top: 1px solid var(--line); }
.opening-row { display: grid; grid-template-columns: 1fr 160px; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.opening-name { display: grid; gap: 2px; font-weight: 600; }
.opening-name small { font-weight: 400; font-size: 13px; }
.opening-row .input { text-align: right; }
.list-members { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; margin-top: 10px; }

.customer-list { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.customer {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 12px var(--gutter); min-height: 72px;
    border: 0; border-bottom: 1px solid var(--line); background: transparent;
    text-align: left; cursor: pointer; user-select: none; -webkit-user-select: none;
}
.customer:active { background: var(--surface-2); }
.customer.is-selected { background: var(--surface-2); box-shadow: inset 4px 0 0 var(--accent); }
.customer .info { flex: 1; min-width: 0; }
.customer .name { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer .state { font-size: 13px; color: var(--muted); }
.customer .balance { font-weight: 700; white-space: nowrap; }
.customer .edit { width: 48px; height: 48px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.customer .edit:active { background: var(--surface-3); }
.customer .edit svg { width: 20px; height: 20px; }
.list-empty { padding: 24px var(--gutter); color: var(--muted); text-align: center; }

.add-customer { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px var(--gutter); padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.add-customer .add-many { grid-column: 1 / -1; min-height: 40px; color: var(--muted); }

/* ---------- right panel ---------- */
.panel { display: grid; grid-template-rows: auto 1fr; min-height: 0; overflow: hidden; }
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px var(--gutter); border-bottom: 1px solid var(--line);
}
.panel-head h1 { font-size: 40px; line-height: 1.05; }
.panel-head .balance-big { font-family: var(--font-display); font-size: 34px; }
.panel-head .balance-big small { font-family: var(--font-body); font-size: 16px; color: var(--muted); margin-left: 6px; }
.panel-head .bonus-hint { color: var(--muted); font-size: 14px; margin-top: 2px; }
.panel-head .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.back-btn { display: none; }
.panel-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px var(--gutter) 32px; }
.hint { color: var(--muted); margin-top: 6px; max-width: 560px; }

.category-tabs {
    display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain;
    margin: 0 calc(-1 * var(--gutter)) 14px; padding: 0 var(--gutter) 2px;
    scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-tabs .btn { flex: 0 0 auto; min-width: 130px; min-height: 52px; }
[data-layout="big"] .category-tabs .btn { min-height: 62px; font-size: 18px; min-width: 160px; }

.products { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }
.product {
    display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
    min-height: 112px; padding: 16px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--surface);
    text-align: left; cursor: pointer; user-select: none; -webkit-user-select: none;
    transition: transform .06s ease, background .15s ease;
}
.product:active { transform: scale(.97); background: var(--surface-2); }
.product .p-name { font-weight: 600; font-size: 19px; }
.product .p-price { color: var(--muted); font-size: 17px; font-weight: 500; }
.products.is-waiting .product { opacity: .45; }
.product { position: relative; }
.product.in-cart { border-color: var(--accent); }
.product .p-badge {
    position: absolute; top: 10px; right: 10px; min-width: 30px; height: 30px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center; border-radius: 999px;
    background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
}
.cart {
    position: sticky; bottom: -32px; z-index: 5; display: grid; gap: 6px; margin: 16px 0 0; padding: 12px 14px 14px;
    border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface-2);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, .3);
}
.cart-head { display: flex; align-items: center; justify-content: space-between; }
.cart-head strong { font-size: 18px; }
.cart-head .btn { min-height: 40px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 90px; align-items: center; gap: 10px; }
.cart-line .c-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-line .c-qty { display: inline-flex; align-items: center; gap: 6px; }
.cart-line .c-qty .btn { width: 44px; min-height: 44px; padding: 0; }
.cart-line .c-qty svg { width: 18px; height: 18px; }
.cart-line .c-qty b { min-width: 26px; text-align: center; font-size: 18px; }
.cart-line .c-sum { text-align: right; font-weight: 600; }
.cart-buy { margin-top: 6px; width: 100%; }

.nota { margin-top: 28px; }
.nota-title { font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented .btn { min-height: 50px; }
.nota-hint { font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.tx { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tx .t-label { font-weight: 500; }
.tx .t-meta { font-size: 13px; color: var(--muted); }
.tx .t-amount { font-weight: 700; white-space: nowrap; }
.tx.is-undone .t-label, .tx.is-undone .t-amount { text-decoration: line-through; opacity: .5; }

.empty-panel { display: grid; place-content: center; text-align: center; gap: 8px; height: 100%; color: var(--muted); }

/* ---------- layouts (per device) ---------- */
[data-layout="big"] .products { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
[data-layout="big"] .product { min-height: 150px; }
[data-layout="big"] .product .p-name { font-size: 24px; }
[data-layout="big"] .product .p-price { font-size: 20px; }

/* "En i taget": list first, then the tab. Phones always work this way. */
[data-layout="single"] .main { grid-template-columns: 1fr; }
[data-layout="single"] .main .panel { display: none; }
[data-layout="single"] .main.show-panel .sidebar { display: none; }
[data-layout="single"] .main.show-panel .panel { display: grid; }
[data-layout="single"] .back-btn { display: inline-flex; }
[data-layout="single"] .sidebar { border-right: 0; }

/* Narrow screens show one thing at a time, except "Surfplatta" on an upright tablet (561-700px):
   that keeps customers and products side by side. Phones (up to 560px) are always one at a time. */
@media (max-width: 700px) {
    :root { --gutter: 12px; --tap: 52px; }
    :root:not([data-layout="tablet"]) .main { grid-template-columns: minmax(0, 1fr); }
    :root:not([data-layout="tablet"]) .main .panel { display: none; }
    :root:not([data-layout="tablet"]) .main.show-panel .sidebar { display: none; }
    :root:not([data-layout="tablet"]) .main.show-panel .panel { display: grid; }
    :root:not([data-layout="tablet"]) .back-btn { display: inline-flex; }
    :root:not([data-layout="tablet"]) .sidebar { border-right: 0; }
    .brand-sub, .staff-chip .who, .topbar-actions .hide-narrow { display: none; }
    .brand-name { font-size: 21px; }
    .brand-mark { width: 36px; height: 36px; }
    .staff-chip { padding: 3px; min-height: 0; border: 0; background: none; }
    .lock-btn { padding: 0 14px; }
    .panel-head { flex-direction: column; align-items: stretch; gap: 12px; }
    .panel-head h1 { font-size: 30px; }
    .panel-head .balance-big { font-size: 28px; }
    .panel-head .actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
    .panel-head .actions .btn-lg { min-height: 56px; font-size: 16px; padding: 0 10px; }
    .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .product { min-height: 96px; padding: 14px; }
    .product .p-name { font-size: 17px; }
    .stats .value { font-size: 15px; }
    .customer { padding-right: 4px; }
    .list-row { flex-wrap: wrap; }
    .modal { padding: 18px; }
    .keypad .key { min-height: 56px; }
}
@media (max-width: 560px) {
    .main { grid-template-columns: minmax(0, 1fr); }
    .main .panel { display: none; }
    .main.show-panel .sidebar { display: none; }
    .main.show-panel .panel { display: grid; }
    .back-btn { display: inline-flex; }
    .sidebar { border-right: 0; }
}
@media (min-width: 561px) and (max-width: 700px) {
    [data-layout="tablet"] { --sidebar: 250px; }
    [data-layout="tablet"] .customer .avatar { display: none; }
    [data-layout="tablet"] .customer .edit { width: 40px; }
    [data-layout="tablet"] .stats { grid-template-columns: 1fr 1fr; }
    [data-layout="tablet"] .add-customer { grid-template-columns: 1fr; }
}
@media (min-width: 701px) and (max-width: 1100px) {
    :root { --sidebar: 330px; --gutter: 14px; }
    .customer .avatar { display: none; }
    .customer .edit { width: 44px; }
    .add-customer .btn { padding: 0 14px; }
    .brand-sub { display: none; }
    .staff-chip .who { display: none; }
    .staff-chip { padding: 4px 12px 4px 4px; }
    .panel-head h1 { font-size: 32px; }
}

/* ---------- modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
    padding: 16px; background: var(--overlay);
    animation: fade .12s ease;
}
.modal {
    width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
    padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
    animation: pop .14s ease;
}
.modal h2 { font-size: 32px; }
.modal .lead { color: var(--muted); margin: 6px 0 16px; }
.modal .row { display: grid; gap: 8px; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-top: 10px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.modal-actions .span-all { grid-column: 1 / -1; }
.amount-display { font-family: var(--font-display); font-size: 52px; color: var(--accent); line-height: 1.1; margin-top: 4px; }
.amount-display.center { text-align: center; }
.amount-note { color: var(--muted); font-size: 14px; min-height: 20px; }
.bonus-note { margin: 6px 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-3); font-size: 15px; line-height: 1.45; }
.swish-qr { width: 190px; margin: 10px auto; border-radius: 12px; background: #fff; padding: 6px; }


.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.keypad .key {
    min-height: 62px; border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--surface-2); font-size: 26px; font-weight: 600; cursor: pointer;
    user-select: none; -webkit-user-select: none;
}
.keypad .key:active { background: var(--surface-3); transform: scale(.97); }
.keypad .key svg { width: 26px; height: 26px; vertical-align: middle; }

.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 16px 0 6px; min-height: 22px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); }
.shake { animation: shake .35s ease; }

/* ---------- full-screen auth pages ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); text-align: center; }
.auth-card h1 { font-size: 40px; margin-top: 12px; }
.auth-card .brand-mark { width: 84px; height: 84px; margin: 0 auto; }
.auth-card form { display: grid; gap: 12px; margin-top: 24px; text-align: left; }
.pin-pad .keypad .key { min-height: 76px; font-size: 30px; }
.pin-pad .keypad { gap: 10px; }

/* ---------- sub pages (kassor, produkter, inställningar) ---------- */
.page { min-height: 100dvh; }
.page-head {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px var(--gutter); padding-top: max(14px, env(safe-area-inset-top));
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: 34px; }
.page-head h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head .topbar-actions { flex: none; }
@media (max-width: 700px) {
    .page-head h1 { font-size: 26px; }
    .page-head .btn { padding: 0; width: var(--tap); }
    .page-head .btn-label { display: none; }
}
.section { padding: 22px var(--gutter); border-bottom: 1px solid var(--line); }
.section h2 { font-size: 28px; margin-bottom: 4px; }
.section .lead { color: var(--muted); margin: 0 0 14px; max-width: 720px; }
.stack { display: grid; gap: 12px; }
.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.choice {
    display: grid; gap: 8px; padding: 16px; min-height: 76px; text-align: left;
    border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
    cursor: pointer;
}
.choice.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice strong { font-size: 17px; }
.choice small { color: var(--muted); }
.swatches { display: flex; gap: 6px; }
.swatches i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .25); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row .who { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.flash { margin: 12px var(--gutter) 0; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--accent); }
.flash.is-error { border-color: var(--danger); }
.log-row { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log-row time { color: var(--muted); margin-right: 6px; }
.image-preview { width: 150px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.swish-club { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 16px; }
.swish-club .swish-sign { display: block; width: 240px; border-radius: 12px; }
.swish-club > div { display: grid; gap: 8px; justify-items: start; flex: 1 1 220px; }
.upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.upload input[type=file], label.btn input[type=file] { display: none; }

.register-card { padding: 20px var(--gutter); border-bottom: 1px solid var(--line); }
.register-card .top { display: flex; justify-content: space-between; gap: 12px; }
.register-card .title { font-weight: 700; font-size: 19px; }
.register-card .badge { color: var(--accent); font-weight: 600; margin-left: 8px; font-size: 15px; }
.register-card .total { font-weight: 700; color: var(--accent); font-size: 19px; }
.register-card .buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.summary-row { display: flex; justify-content: space-between; padding: 5px 0; }
.summary-row .q { color: var(--muted); }

.product-row { display: grid; grid-template-columns: auto 1fr 140px auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.product-row .order { display: grid; gap: 4px; }
.product-row .order .icon-btn { width: 44px; height: 36px; }
@media (max-width: 700px) {
    .product-row { grid-template-columns: 1fr 110px; }
    .product-row .order { display: none; }
}

[hidden] { display: none !important; }

/* ---------- banners ---------- */
textarea.input { padding: 12px 16px; line-height: 1.45; resize: vertical; font-family: inherit; }
.banner-form { display: grid; gap: 14px; max-width: 980px; }
.field-label { font-size: 13px; color: var(--muted); margin-bottom: -6px; }
.banner-choices { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.banner-choices .choice { min-height: 64px; color: var(--text); }
label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
label.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.prompt-box { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.prompt-text { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.banner-search { display: grid; grid-template-columns: minmax(0, 1fr) 200px auto auto; gap: 12px; margin-top: 12px; }
.banner-search .input, .banner-search .btn { min-width: 0; }
.date-range {
    display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 8px 0 16px;
    border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2);
}
.date-range:focus-within { border-color: var(--accent); }
.date-range input {
    min-width: 0; padding: 8px; border: 0; border-radius: 8px; background: none;
    color: var(--text); font: inherit; font-size: 17px; outline: none;
}
.date-range input:focus { background: var(--surface-3); }
.banner-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-top: 24px; }
.banner-card { display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); color: var(--text); text-decoration: none; }
.banner-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--surface-2); }
.banner-card .meta { display: grid; gap: 2px; padding: 10px 12px; }
.banner-card small { color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.banner-detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.banner-image img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); display: block; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.banner-params { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.banner-params dt { color: var(--muted); }
.banner-params dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.banner-prompt { margin-top: 18px; }
.banner-prompt summary { cursor: pointer; color: var(--muted); min-height: 36px; }
.banner-prompt pre { white-space: pre-wrap; font-size: 13px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.banner-retext { display: grid; gap: 10px; margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.banner-retext h3 { font-size: 20px; }
.spinner { width: 42px; height: 42px; margin: 8px auto 4px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1100px) {
    .banner-search { grid-template-columns: 200px minmax(0, 1fr) auto; }
    .banner-search .input[type=search] { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .banner-search { grid-template-columns: 1fr; }
    .date-range input { flex: 1; }
    .banner-detail { grid-template-columns: 1fr; }
    .banner-params { grid-template-columns: 1fr; gap: 2px; }
    .banner-params dd { margin-bottom: 8px; }
}

/* ---------- swish, min nota, happy hour ---------- */
.swish-dyn { display: grid; justify-items: center; gap: 6px; margin: 12px 0; }
.swish-dyn .swish-qr { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 6px; }
.swish-dyn span, .swish-hint { color: var(--muted); font-size: 14px; text-align: center; }
.nota-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.nota-box > div { display: grid; flex: 1 1 200px; }
.nota-box small { color: var(--muted); }
.nota-qr { display: grid; place-items: center; padding: 14px; margin: 6px auto 12px; width: max-content; background: #fff; border-radius: 12px; }
.nota-link { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.nota-link .input { font-size: 13px; }
.hh-pill { align-self: center; padding: 6px 12px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; white-space: nowrap; }
.product.is-happy { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.product.is-happy s { color: var(--muted); font-weight: 400; margin-right: 4px; }
.day-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.day-pick input { position: absolute; opacity: 0; pointer-events: none; }
.day-pick span { display: inline-grid; place-items: center; min-width: 58px; min-height: 46px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; cursor: pointer; }
.day-pick input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.nota-page { max-width: 640px; margin: 0 auto; padding: 24px var(--gutter) 40px; display: grid; gap: 18px; }
.nota-head { display: flex; align-items: center; gap: 14px; }
.nota-logo { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: #fff; }
.nota-club { color: var(--accent); font-weight: 600; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.nota-head h1 { font-size: 34px; }
.nota-balance { display: grid; gap: 4px; padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.nota-balance .label { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 13px; letter-spacing: .04em; }
.nota-balance strong { font-family: var(--font-display); font-size: 48px; font-weight: 400; line-height: 1.05; }
.nota-balance.is-debt strong { color: var(--danger); }
.nota-balance.is-credit strong { color: var(--positive); }
.nota-swish { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 16px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--surface); }
.nota-swish img { width: 180px; height: 180px; background: #fff; border-radius: 12px; padding: 6px; }
.nota-swish h2 { font-size: 22px; }
.nota-foot { font-size: 13px; }
@media (max-width: 520px) { .nota-swish { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

/* ---------- statistics ---------- */
.stats-filters { display: grid; gap: 12px; padding: 14px var(--gutter); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.stats-presets { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.stats-presets::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stats-fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stats-fields .input { min-height: 46px; font-size: 15px; padding: 0 12px; }
.stats-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: flex-end; }
.stats-actions [data-period-label] { margin-right: auto; font-size: 13px; }
.stats-actions .btn { min-height: 44px; }
.stats-body { display: grid; gap: 16px; padding: 18px var(--gutter) 40px; transition: opacity .2s ease; }
.stats-body.is-loading { opacity: .55; }
.kpi-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpi { position: relative; overflow: hidden; display: grid; align-content: start; gap: 4px; min-height: 132px; padding: 16px 16px 44px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.kpi-hero { background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 26%, var(--surface-2)), var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.kpi-value { font-family: var(--font-display); font-size: 34px; font-weight: 400; line-height: 1.1; }
.kpi-delta { justify-self: start; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.kpi-delta:empty { display: none; }
.kpi-delta.up { color: #7fd1a8; background: rgba(127, 209, 168, .12); }
.kpi-delta.down { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.kpi-sub { color: var(--muted); font-size: 13px; }
.kpi-spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100% !important; height: 46px !important; }
.kpi-now .kpi-value { font-size: 28px; color: var(--danger); }
.stats-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stats-grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stats-card { min-width: 0; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.stats-card header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 12px; }
.stats-card h2 { font-size: 22px; }
.stats-card header .muted { font-size: 13px; }
.stats-toggle { grid-template-columns: auto auto; }
.stats-toggle .btn { min-height: 38px; padding: 0 14px; font-size: 14px; }
.chart-box { position: relative; height: 280px; }
.chart-tall { height: 340px; }
.donut-box { height: 300px; }
.donut-center { position: absolute; left: 0; right: 0; top: 38%; transform: translateY(-50%); display: grid; text-align: center; pointer-events: none; }
.donut-center strong { font-family: var(--font-display); font-size: 26px; font-weight: 400; }
.donut-center span { color: var(--muted); font-size: 12px; }
.heatmap { display: grid; gap: 4px; overflow-x: auto; }
.hm-row { display: grid; grid-template-columns: 44px repeat(var(--hm-cols, 24), minmax(22px, 1fr)); gap: 4px; align-items: center; }
.hm-head span { color: var(--muted); font-size: 11px; text-align: center; }
.hm-day { color: var(--muted); font-size: 13px; font-weight: 600; }
.hm-cell { height: 30px; border-radius: 6px; transition: transform .1s ease; }
.hm-cell:hover { transform: scale(1.12); outline: 1px solid var(--accent); }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.hm-legend i { width: 22px; height: 12px; border-radius: 4px; }
.rank-list { display: grid; gap: 12px; }
.rank { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; }
.rank-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--accent); font-weight: 700; font-size: 14px; }
.rank:first-child .rank-n { background: var(--accent); color: var(--accent-ink); }
.rank-top { display: flex; justify-content: space-between; gap: 10px; }
.rank-top span { font-weight: 700; }
.rank-bar { height: 6px; margin: 6px 0 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--accent)); }
.rank small { color: var(--muted); }
.table-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stats-table td { padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stats-table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.stats-body.is-empty .stats-card, .stats-body.is-empty .kpi-grid { opacity: .7; }
@media (max-width: 700px) {
    .stats-filters { position: static; }
    .stats-fields { grid-template-columns: 1fr 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi { min-height: 118px; }
    .kpi-value { font-size: 26px; }
    .stats-grid, .stats-grid-3 { grid-template-columns: 1fr; }
    .chart-tall { height: 260px; }
}

/* ---------- toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 80;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 14px 20px; border-radius: 999px; max-width: calc(100% - 32px);
    background: var(--text); color: var(--bg); font-weight: 600;
    transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); color: var(--danger-ink); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Telefon på tvären: for låg skärm för fasta paneler, så hela sidan scrollar i stället. */
@media (max-height: 520px) and (orientation: landscape) {
    .app { height: auto; min-height: 100dvh; overflow: visible; grid-template-rows: auto auto auto; }
    .main, .sidebar, .panel { min-height: 0; overflow: visible; align-content: start; }
    .sidebar, .sidebar:has(> .list-pick:not(.hidden)) { grid-template-rows: none; align-self: start; }
    .customer-list, .panel-body { overflow: visible; }
    .panel-body { padding-bottom: 24px; }
    .panel-head { padding-top: 10px; padding-bottom: 10px; }
    .panel-head h1 { font-size: 28px; }
    .cart { bottom: 0; }
}
