:root {
  --bg: #f3f4f6; --fg: #111827; --muted: #6b7280; --card: #fff; --line: #e5e7eb;
  --primary: #111827; --danger: #b91c1c; --ok: #047857; --warn: #b45309;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }
header#topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; background: var(--primary); color: #fff; }
header#topbar[hidden] { display: none; }
header .brand-mark { width: 1.85rem; height: 1.85rem; flex: none; }
header .brand { color: #fff; text-decoration: none; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-switch { display: flex; margin-left: auto; border-radius: .4rem; overflow: hidden; }
.lang-switch button { font: inherit; font-size: .72rem; font-weight: 700; letter-spacing: .04em; border: 0; background: #374151; color: #fff; padding: .28rem .5rem; cursor: pointer; }
.lang-switch button.on { background: #fff; color: #111827; }
.lang-switch-page { margin: 0 0 1rem; display: inline-flex; }
.login-logo { display: block; height: 2.4rem; width: auto; max-width: 16rem; margin: .25rem 0 1rem; }
#shop-switch { margin-left: auto; max-width: 11rem; padding: .35rem .5rem; font: inherit; font-size: .85rem; border: 0; border-radius: .45rem; background: #374151; color: #fff; }
.badge { background: #f59e0b; color: #111; border-radius: 999px; padding: .1rem .6rem; font-size: .75rem; font-weight: 700; }
main { max-width: 40rem; margin: 0 auto; padding: 1rem; padding-bottom: 4rem; }
h1 { font-size: 1.4rem; margin: .25rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
.muted { color: var(--muted); font-size: .9rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: .9rem; padding: 1rem; margin-bottom: 1rem; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.tile { display: flex; flex-direction: column; justify-content: center; min-height: 5.5rem; background: var(--card); border: 1px solid var(--line); border-radius: .9rem; padding: 1rem; color: var(--fg); text-decoration: none; font-weight: 600; }
.tile.primary { grid-column: span 2; background: var(--primary); color: #fff; min-height: 7rem; font-size: 1.25rem; }
.tile.on { background: var(--primary); color: #fff; }
.tile small { font-weight: 400; color: inherit; opacity: .7; }
.home-section { margin: 0 0 1.4rem; }
.home-section h2 {
  margin: 0 0 .45rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.home-section .tiles > :only-child { grid-column: 1 / -1; }
.howto { display: grid; gap: .45rem; margin: 0 0 1rem; }
.howto p { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: .75rem; padding: .7rem .85rem; font-size: .92rem; }
.howto b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: .72rem;
  margin-right: .45rem;
  vertical-align: middle;
}
.type-pick { grid-template-columns: 1fr; margin: 0 0 1rem; }
label { display: block; font-weight: 600; margin: .75rem 0 .3rem; }
input, select, textarea { width: 100%; font: inherit; padding: .75rem; border: 1px solid #d1d5db; border-radius: .6rem; background: #fff; }
input[type=checkbox] { width: auto; transform: scale(1.4); margin-right: .6rem; }
.check { display: flex; align-items: flex-start; font-weight: 500; background: #fef3c7; border-radius: .6rem; padding: .75rem; }
button, .btn { display: inline-block; font: inherit; font-weight: 600; border: 0; border-radius: .7rem; padding: .85rem 1.1rem; background: var(--primary); color: #fff; cursor: pointer; text-decoration: none; text-align: center; }
button.block, .btn.block { display: block; width: 100%; margin-top: .75rem; }
button.secondary { background: #e5e7eb; color: var(--fg); }
button.danger { background: var(--danger); }
button.small { padding: .45rem .7rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: .5rem; align-items: center; }
.row > * { flex: 1; }
.stepper { display: flex; align-items: center; gap: .75rem; }
.stepper button { width: 3.25rem; height: 3.25rem; font-size: 1.5rem; padding: 0; }
.stepper output { font-size: 2rem; font-weight: 700; min-width: 3rem; text-align: center; }
.cardview { border-radius: .9rem; padding: 1rem; color: #fff; background: #1f2937; margin-bottom: 1rem; }
.cardview .num { font-family: ui-monospace, monospace; letter-spacing: .05em; opacity: .85; }
.cardview .bal { font-size: 2.2rem; font-weight: 800; margin: .3rem 0; }
.wallet-preview { margin-bottom: 1rem; }
.wallet-preview .cap { font-size: .8rem; color: var(--muted); margin: 0 0 .45rem; }
.wallet-face { border-radius: 1rem; padding: 1rem 1.1rem 1.15rem; color: #fff; }
.wallet-face .issuer { font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; opacity: .8; }
.wallet-face .pname { font-size: 1.15rem; font-weight: 700; margin: .2rem 0 .85rem; }
.wallet-face .face-row { display: flex; gap: 1rem; align-items: flex-end; }
.wallet-face .qrbox { flex: 0 0 5.2rem; width: 5.2rem; height: 5.2rem; border-radius: .35rem; background: repeating-conic-gradient(#111 0 25%, #fff 0 50%) 0 0 / 18% 18%; }
.wallet-face .face-meta { flex: 1; display: grid; gap: .45rem; }
.wallet-face .face-meta small { display: block; opacity: .75; font-size: .7rem; }
.wallet-face .face-meta strong { font-size: 1.05rem; }
.wallet-details { background: var(--card); border: 1px solid var(--line); border-radius: .9rem; padding: .85rem 1rem 1rem; margin-top: .65rem; }
.wallet-details dt { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-top: .7rem; }
.wallet-details dt:first-child { margin-top: 0; }
.wallet-details dd { margin: .15rem 0 0; white-space: pre-wrap; }
.alert { border-radius: .7rem; padding: .8rem 1rem; margin: .75rem 0; }
.alert.error { background: #fee2e2; color: #7f1d1d; }
.alert.ok { background: #d1fae5; color: #064e3b; }
.alert.warn { background: #fef3c7; color: #78350f; }
.alert code { font-weight: 700; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: .75rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .meta { font-size: .8rem; color: var(--muted); }
.pos { color: var(--ok); font-weight: 700; } .neg { color: var(--danger); font-weight: 700; }
.scanner { position: relative; background: #000; border-radius: .9rem; overflow: hidden; aspect-ratio: 3 / 4; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 1rem; }
.qr { background: #fff; padding: .5rem; border-radius: .6rem; }
.qr svg { width: 100%; height: auto; display: block; }
.copy { word-break: break-all; font-family: ui-monospace, monospace; font-size: .8rem; background: #f9fafb; padding: .5rem; border-radius: .4rem; }
.back { display: inline-block; margin-bottom: .5rem; color: var(--muted); text-decoration: none; }
.big-number { font-size: 1.6rem; text-transform: uppercase; letter-spacing: .08em; font-family: ui-monospace, monospace; }
.pill { display: inline-block; border-radius: 999px; padding: .05rem .55rem; font-size: .72rem; font-weight: 700; vertical-align: middle; background: #e5e7eb; color: var(--fg); }
.pill.active { background: #d1fae5; color: #064e3b; }
.pill.pending { background: #e0e7ff; color: #3730a3; }
.pill.suspended { background: #fee2e2; color: #7f1d1d; }
.pill.test { background: #fef3c7; color: #78350f; margin-left: .3rem; }
.rowlink { display: block; flex: 1; color: inherit; text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; }
.stats strong { display: block; font-size: 1.5rem; }
.stats small { color: var(--muted); }
pre.copy { white-space: pre-wrap; }
button.tile { background: var(--card); color: var(--fg); font-size: 1.15rem; text-align: left; }
input.pin { font-size: 2rem; letter-spacing: .6em; text-align: center; max-width: 12rem; }
details > summary { cursor: pointer; font-weight: 600; }
html.till, body.till { height: 100%; max-height: 100dvh; overscroll-behavior: none; touch-action: manipulation; }
html.till button, html.till a, html.till .scanner, html.till .tile { touch-action: manipulation; }
body.till header#topbar { display: none !important; }
body.till main {
  max-width: min(28rem, 100%);
  width: 100%;
  padding: .5rem;
  padding-bottom: max(.5rem, env(safe-area-inset-bottom));
}
body.till-lock { overflow: hidden; }
body.till-lock main {
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.till .scanner {
  aspect-ratio: auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
}
body.till-lock .till, body.till-lock .till-scan {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.till-lock .till-scan .scanner { flex: 1 1 auto; min-height: 0; }
body.till-lock .till .keypad { flex: 0 0 auto; }
.till { text-align: center; }
.till-shop { font-weight: 700; font-size: 1.05rem; margin: 0 0 .35rem; }
.till h1 { font-size: 1.85rem; margin: .15rem 0 .85rem; }
.till-dots { display: flex; justify-content: center; gap: .7rem; margin: 0 0 1.1rem; }
.till-dots span { width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 3px solid #111; }
.till-dots span.on { background: #111; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.till-key { height: clamp(3.1rem, 11dvh, 4.3rem); font-size: 1.8rem; border-radius: 1rem; padding: 0; }
.till-del { background: #e5e7eb; color: #111; }
.till-owner { display: inline-block; margin-top: .85rem; font-size: .8rem; color: var(--muted); }
.till-tiles { grid-template-columns: 1fr; }
.till-choice { min-height: 5.5rem; font-size: 1.35rem; text-align: center; }
.till-amount { font-size: 2rem; font-weight: 700; letter-spacing: .04em; padding: .4rem; margin: .35rem 0 .6rem; background: #fff; border: 1px solid var(--line); border-radius: .7rem; }
body.till .qr svg { max-height: min(52dvh, 22rem); width: auto; max-width: 100%; margin: 0 auto; display: block; }
body.till .scan-msg { min-height: 1.5rem; }

/* Joomla-style desk: left menu + control panel. Hidden for staff till and login. */
:root { --nav: #163a5f; --nav-on: #0e2a46; --nav-line: #2b5680; --accent: #5091cd; }
.nav-toggle {
  display: none;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  border: 0;
  border-radius: .45rem;
  background: #374151;
  color: #fff;
  padding: .4rem .7rem;
  cursor: pointer;
}
#nav-backdrop { display: none; }
body.desk {
  display: grid;
  grid-template-columns: 16.75rem minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100dvh;
}
body.desk header#topbar { grid-column: 1 / -1; grid-row: 1; }
body.desk #nav-backdrop { display: none; }
body.desk #sidenav {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  top: 3.15rem;
  align-self: start;
  height: calc(100dvh - 3.15rem);
  overflow: auto;
  width: 16.75rem;
  background: var(--nav);
  color: #fff;
  padding: .75rem 0 1.5rem;
}
body.desk main {
  grid-column: 2;
  grid-row: 2;
  max-width: 54rem;
  width: 100%;
  margin: 0;
  padding: 1.15rem 1.35rem 4rem;
}
.snav-home {
  display: block;
  margin: 0 .75rem .85rem;
  padding: .7rem .8rem;
  border-radius: .55rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}
.snav-home.on, .snav-link.on { outline: 2px solid #fff; outline-offset: -2px; }
.snav-group { margin: 0 0 .85rem; }
.snav-group h2 {
  margin: 0;
  padding: .35rem .95rem;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #b6d0ea;
}
.snav-link {
  display: block;
  padding: .55rem .95rem .6rem 1.15rem;
  color: #fff;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.snav-link:hover, .snav-home:hover { background: var(--nav-on); }
.snav-link.on { background: var(--nav-on); border-left-color: #fff; }
.snav-link small { display: block; font-size: .75rem; font-weight: 400; opacity: .75; margin-top: .1rem; }
.snav-foot { margin: 1rem .75rem 0; padding-top: .85rem; border-top: 1px solid var(--nav-line); }
.snav-foot button { width: 100%; background: #fff; color: var(--nav); }
.crumbs { display: flex; flex-wrap: wrap; gap: .35rem .45rem; align-items: center; margin: 0 0 .85rem; font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--accent); text-decoration: none; font-weight: 600; }
.crumb-sep { opacity: .5; }
.cpanel { display: grid; grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr)); gap: .85rem; margin: 0 0 1.4rem; }
.cpanel-tile {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-height: 8.2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .7rem;
  padding: 1rem 1.05rem 1.1rem;
  color: var(--fg);
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}
.cpanel-tile:hover { border-color: var(--accent); }
.cpanel-tile.start { grid-column: 1 / -1; min-height: 6.5rem; background: var(--nav); color: #fff; border-color: var(--nav); }
.cpanel-tile.start small { color: #dbeafe; opacity: 1; }
.cpanel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: .55rem;
  background: #e8f1fa;
  color: var(--nav);
  font-size: 1.2rem;
  font-weight: 800;
}
.cpanel-tile.start .cpanel-icon { background: #fff; }
.cpanel-title { font-weight: 700; font-size: 1.05rem; }
.cpanel-tile small { color: var(--muted); font-weight: 400; line-height: 1.35; }
.type-pick { grid-template-columns: 1fr; }
.type-pick .tile { min-height: 6.2rem; font-size: 1.15rem; }
.type-pick .tile small { display: block; margin-top: .25rem; font-size: .92rem; }
.advanced { margin-top: 1rem; }
.advanced > summary { font-size: 1rem; padding: .2rem 0; }
.level-copy { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.level-copy h2 { margin-top: 0; }
.level-chips-row { display: flex; align-items: center; gap: .6rem; margin: .2rem 0 .55rem; flex-wrap: wrap; }
.level-chips-row > .muted { margin: 0; font-weight: 600; }
.level-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
button.level-chip {
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.15rem;
  background: #e5e7eb;
  color: var(--fg);
}
button.level-chip.on { background: var(--primary); color: #fff; }
.level-line {
  display: flex;
  gap: .4rem;
  align-items: flex-end;
  overflow-x: auto;
  padding-bottom: .2rem;
}
.level-cell { margin: 0; font-size: .72rem; flex: 0 0 auto; }
.level-cell.grow { flex: 1 1 8rem; min-width: 7rem; }
.level-copy input.level-box {
  padding: .55rem .45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.level-copy input.level-box.mark { width: 3.25rem; text-align: center; font-weight: 800; }
.level-copy input.level-box.word { width: 7rem; }
.level-copy input.level-box.locked { width: 3.6rem; background: #f3f4f6; color: var(--muted); }
.level-copy input.level-box.note { width: 100%; }
.wallet-details dd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92rem; }
@media (max-width: 860px) {
  body.desk { display: block; }
  body.desk main { max-width: 40rem; margin: 0 auto; padding: 1rem; padding-bottom: 4rem; }
  .nav-toggle { display: inline-block; }
  body.desk #sidenav {
    position: fixed;
    z-index: 20;
    left: 0;
    top: 3.15rem;
    height: calc(100dvh - 3.15rem);
    transform: translateX(-105%);
    transition: transform .18s ease;
  }
  body.desk.nav-open #sidenav { transform: none; }
  body.desk.nav-open #nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(15, 23, 42, .45);
  }
}
