/* JITS POS — tema-drevet design. Alle farver kommer fra tokens; kunden styrer dem i tema-editoren. */
:root {
  --accent: #0EA5A4;
  --accent2: #F59E0B;
  --radius: 18px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pad: 14px;
  --tile-h: 112px;
  --tile-font: 15px;

  --bg: #0B1020;
  --bg-2: #111832;
  --surface: rgba(255,255,255,.05);
  --surface-2: rgba(255,255,255,.09);
  --border: rgba(255,255,255,.10);
  --text: #EEF2FF;
  --text-2: #A5B0CC;
  --text-3: #6B7699;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --danger: #F43F5E;
  --ok: #22C55E;
  --warn: #F59E0B;
  --glow: color-mix(in oklab, var(--accent) 35%, transparent);
}
body[data-mode="light"] {
  --bg: #F3F5FA;
  --bg-2: #FFFFFF;
  --surface: rgba(15,23,42,.04);
  --surface-2: rgba(15,23,42,.08);
  --border: rgba(15,23,42,.10);
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;
  --shadow: 0 20px 60px rgba(15,23,42,.14);
  --glow: color-mix(in oklab, var(--accent) 22%, transparent);
}
body[data-density="compact"] { --pad: 10px; --tile-h: 84px; --tile-font: 13px; }
body[data-density="touch"] { --pad: 18px; --tile-h: 140px; --tile-font: 17px; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--glow), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in oklab, var(--accent2) 22%, transparent), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; }
select { background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; height: 36px; padding: 0 10px; color-scheme: dark; }
body[data-mode="light"] select { color-scheme: light; }
select option { background: var(--bg-2); color: var(--text); }
input[type=date], input[type=number], input[type=text] { color-scheme: inherit; }
body[data-mode="dark"] { color-scheme: dark; }
body[data-mode="light"] { color-scheme: light; }
kbd { font: 11px/1 ui-monospace, monospace; padding: 3px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
[hidden] { display: none !important; }

#app { height: 100%; display: grid; grid-template-rows: 64px 1fr; }

.top { display: grid; grid-template-columns: 260px 1fr auto; align-items: center; gap: 16px; padding: 0 18px; border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; letter-spacing: .5px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 18px var(--glow); }
.brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--text-2); }
.search-wrap { position: relative; max-width: 620px; }
.search { width: 100%; height: 42px; padding: 0 44px 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); outline: none; transition: box-shadow .2s, border-color .2s; }
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--glow); }
.search-wrap kbd { position: absolute; right: 12px; top: 13px; }
.status { display: flex; align-items: center; gap: 8px; }
.pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ok) 25%, transparent); }
.pill.off .dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 25%, transparent); }
.pill.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in oklab, var(--warn) 25%, transparent); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; font-size: 16px; transition: background .15s, transform .1s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }

.main { display: grid; grid-template-columns: 1fr 400px; min-height: 0; }
.catalog { display: grid; grid-template-rows: auto 1fr; min-height: 0; padding: var(--pad) var(--pad) 0 18px; gap: var(--pad); }
.groups { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.groups button { flex: 0 0 auto; padding: 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 13px; color: var(--text-2); transition: all .15s; }
.groups button.active { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 8px 20px var(--glow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--pad); overflow-y: auto; padding-bottom: 24px; align-content: start; }
.tile { position: relative; height: var(--tile-h); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; background: var(--surface); border: 1px solid var(--border); overflow: hidden; transition: transform .08s, border-color .15s, background .15s; }
.tile::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, var(--tile-color, var(--accent)) 0%, transparent 62%); opacity: .28; }
.tile:hover { border-color: color-mix(in oklab, var(--tile-color, var(--accent)) 60%, transparent); background: var(--surface-2); }
.tile:active { transform: scale(.96); }
.tile .emoji { position: relative; font-size: 26px; line-height: 1; }
.tile .name { position: relative; font-weight: 600; font-size: var(--tile-font); line-height: 1.2; }
.tile .price { position: relative; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tile .sku { position: absolute; right: 10px; top: 10px; font-size: 10px; color: var(--text-3); font-family: ui-monospace, monospace; }

.cart { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; margin: var(--pad); margin-left: 0; border-radius: calc(var(--radius) + 6px); background: var(--bg-2); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
body[data-mode="dark"] .cart { background: rgba(17,24,50,.75); backdrop-filter: blur(20px); }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cart-title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.cart-count { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; }
.cart-actions { display: flex; gap: 6px; }
.ghost { padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); }
.ghost:hover { background: var(--surface-2); color: var(--text); }
.ghost.danger:hover { color: var(--danger); }
.badge { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--accent2); color: #000; font-size: 11px; }
.cart-lines { overflow-y: auto; padding: 8px 10px; }
.empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); text-align: center; font-size: 14px; }
.empty-icon { font-size: 40px; opacity: .5; }
.hint { font-size: 12px; color: var(--text-3); }
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 8px; border-radius: 12px; align-items: center; }
.line:hover { background: var(--surface); }
.line .n { font-weight: 600; font-size: 14px; cursor: pointer; }
.line .sub { font-size: 12px; color: var(--text-2); grid-column: 1; }
.line .amt { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.line .qty { grid-column: 2; display: flex; align-items: center; gap: 2px; justify-self: end; }
.qty button { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); font-weight: 700; }
.qty span { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.qty .del { color: var(--danger); background: transparent; }
.cart-foot { padding: 12px 16px 16px; border-top: 1px solid var(--border); display: grid; gap: 12px; }
.totals .row { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.totals .muted { color: var(--text-2); font-size: 12px; }
.totals .total { font-size: 22px; font-weight: 800; margin-top: 6px; }
.pay-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay { height: 56px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: all .15s; }
.pay:hover { background: var(--surface-2); border-color: var(--accent); }
.pay-ico { font-size: 18px; line-height: 22px; height: 22px; display: block; }
.pay-all { height: 60px; border-radius: 16px; background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 70%, var(--accent2))); color: #fff; font-weight: 800; font-size: 17px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; box-shadow: 0 10px 28px var(--glow); transition: transform .1s, filter .15s; }
.pay-all:hover { filter: brightness(1.08); }
.pay-all:active { transform: scale(.98); }
.pay-all:disabled { opacity: .4; filter: grayscale(.5); box-shadow: none; cursor: not-allowed; }

.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); z-index: 50; }
.sheet { background: var(--bg-2); border: 1px solid var(--border); border-radius: calc(var(--radius) + 8px); box-shadow: var(--shadow); overflow: hidden; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { margin: 0; font-size: 18px; }
.pay-sheet { width: min(920px, 96vw); }
.pay-body { display: grid; grid-template-columns: 1fr 340px; }
.pay-left { padding: 20px; display: grid; grid-template-rows: auto 1fr auto auto; gap: 14px; min-height: 480px; border-right: 1px solid var(--border); }
.big-amount { display: flex; flex-direction: column; gap: 4px; }
.big-amount .lbl { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: 1px; }
.big-amount span:last-child { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.big-amount.done span:last-child { color: var(--ok); }
.tender-list { display: grid; gap: 6px; align-content: start; }
.tender { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--surface); font-size: 14px; }
.tender b { font-variant-numeric: tabular-nums; }
.tender button { color: var(--danger); font-size: 12px; }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.method { height: 52px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; font-size: 13px; transition: all .15s; }
.method.active, .method:hover { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 18%, transparent); }
.pay-status { min-height: 22px; font-size: 13px; color: var(--text-2); }
.pay-status.ok { color: var(--ok); }
.pay-status.err { color: var(--danger); }
.pay-right { padding: 20px; display: grid; gap: 10px; align-content: start; }
.numpad-display { height: 56px; border-radius: 12px; background: var(--surface); display: flex; align-items: center; justify-content: flex-end; padding: 0 16px; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad button { height: 56px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-size: 20px; font-weight: 600; }
.numpad button:active { background: var(--surface-2); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick button { height: 38px; border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 600; border: 1px solid var(--border); }
.primary { height: 48px; padding: 0 18px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 8px 20px var(--glow); }
.primary:disabled { opacity: .4; box-shadow: none; }
.wide { width: 100%; }

.receipt-sheet { width: 420px; max-height: 92vh; display: grid; grid-template-rows: 1fr auto; }
.receipt { overflow-y: auto; padding: 22px 26px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; line-height: 1.5; background: #fff; color: #111; }
.receipt .c { text-align: center; }
.receipt .big { font-size: 18px; font-weight: 700; }
.receipt .r { display: flex; justify-content: space-between; gap: 8px; }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: 8px 0; }
.receipt .test { background: #fde047; color: #000; font-weight: 800; padding: 6px; text-align: center; margin-bottom: 6px; }
.receipt-actions { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.receipt-actions .primary { flex: 1; }

.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(720px, 96vw); background: var(--bg-2); border-left: 1px solid var(--border); display: grid; grid-template-rows: auto auto 1fr; box-shadow: var(--shadow); }
.theme-panel { width: min(420px, 96vw); grid-template-rows: auto 1fr; }
.drawer-nav { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.drawer-nav button { padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.drawer-nav button.active { background: var(--surface-2); color: var(--text); }
.drawer-body { overflow-y: auto; padding: 18px 20px; display: grid; gap: 14px; align-content: start; }
.card { padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: grid; gap: 8px; }
.card h3 { margin: 0 0 4px; font-size: 14px; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.card .muted { color: var(--text-2); font-size: 12px; }
.card input, .card select { height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 10px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th { color: var(--text-2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.tbl tr:hover td { background: var(--surface); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tag.ok { background: color-mix(in oklab, var(--ok) 22%, transparent); color: var(--ok); }
.tag.warn { background: color-mix(in oklab, var(--warn) 22%, transparent); color: var(--warn); }
.tag.err { background: color-mix(in oklab, var(--danger) 22%, transparent); color: var(--danger); }
.tag.mute { background: var(--surface-2); color: var(--text-2); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { padding: 12px; border-radius: 12px; background: var(--surface); }
.kpi .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .6px; }

.theme-body label { display: grid; gap: 6px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.theme-body input[type=text], .theme-body select, .theme-body textarea { height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 12px; font-weight: 500; }
.theme-body textarea { height: auto; padding: 10px 12px; resize: vertical; }
.theme-body input[type=color] { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); padding: 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; }
.swatches button.active { border-color: var(--text); }
.seg { display: grid; grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); }
.seg button { height: 34px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.seg button.active { background: var(--accent); color: #fff; }
.theme-actions { display: flex; gap: 8px; }
.theme-actions .primary { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow); z-index: 100; }

body.offline .top { border-bottom-color: var(--warn); }

@media (max-width: 900px) {
  .top { grid-template-columns: auto 1fr auto; }
  .brand-sub, .search-wrap kbd { display: none; }
  .main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .cart { margin: 0; border-radius: 22px 22px 0 0; max-height: 46vh; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .pay-body { grid-template-columns: 1fr; }
  .pay-left { border-right: 0; border-bottom: 1px solid var(--border); min-height: 0; }
}
@media print {
  body * { visibility: hidden; }
  #receipt, #receipt * { visibility: visible; }
  #receipt { position: fixed; left: 0; top: 0; width: 80mm; }
}

/* login */
.login-sheet { width: 340px; padding: 28px 24px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.login-sheet h2 { margin: 0; font-size: 18px; }
.login-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 10px 28px var(--glow); }
.pin-dots { display: flex; gap: 10px; height: 16px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); transition: all .15s; }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--glow); }
.pin-msg { min-height: 18px; font-size: 13px; color: var(--danger); }
.pinpad { width: 100%; }
.pinpad .okk { background: var(--accent); color: #fff; }

/* varebilleder */
.tile .timg { position: relative; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
body[data-density="touch"] .tile .timg { width: 60px; height: 60px; }
.tile.hidden-in-pos { border-style: dashed; }
.thumb { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; vertical-align: middle; }
/* emoji-vælger */
#emojiModal { z-index: 70; }
.emoji-sheet { width: min(620px, 96vw); }
.emoji-body { padding: 16px; display: grid; gap: 12px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; max-height: 50vh; overflow-y: auto; }
.emoji-grid button { height: 48px; border-radius: 12px; font-size: 26px; background: var(--surface); border: 1px solid var(--border); }
.emoji-grid button:hover, .emoji-grid button.active { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 18%, transparent); }
