/* BrandBros POS - every color and font comes from the active store's theme (set in app.js). */
:root {
  color-scheme: light;
  --bg: #F4F4F2; --card: #FFFFFF; --ink: #222222; --ink-2: #4A4A4A; --ink-3: #6B6B6B; --line: #DDDDDD;
  --accent: #333333; --on-accent: #FFFFFF; --hi: #F2C230; --chip: #EDEDED;
  --nav-bg: #1C1C1C; --nav-ink: #FFFFFF; --nav-mute: #A8A8A8; --nav-line: #333333;
  --good: #15803D; --bad: #B91C1C;
  --font-display: Impact, "Arial Narrow", sans-serif; --font-body: "Segoe UI", system-ui, sans-serif;
  --d-style: normal; --d-weight: 400; --d-track: 0.01em;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 var(--font-body); color: var(--ink); background: var(--bg);
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
.d { font-family: var(--font-display); font-style: var(--d-style); font-weight: var(--d-weight); letter-spacing: var(--d-track); text-transform: uppercase; line-height: 1; }
h1 { font: var(--d-style) var(--d-weight) clamp(30px, 3.4vw, 42px)/0.95 var(--font-display); letter-spacing: var(--d-track); text-transform: uppercase; margin: 0; text-wrap: balance; }
h2 { font: var(--d-style) var(--d-weight) 24px/1 var(--font-display); letter-spacing: var(--d-track); text-transform: uppercase; margin: 0 0 14px; }
h3 { font-size: 12px; font-weight: 700; margin: 0 0 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .muted { margin-top: 6px; }

#app { display: flex; height: 100dvh; }

/* ---------- side navigation ---------- */
#nav {
  width: 212px; flex: none; background: var(--nav-bg); color: var(--nav-ink);
  display: flex; flex-direction: column; padding: 18px 12px 14px; gap: 3px;
}
.store-id { display: flex; align-items: center; gap: 11px; padding: 0 4px 14px; }
.logo-tile { width: 46px; height: 46px; flex: none; border-radius: 12px; background: #FFFFFF; display: grid; place-items: center; overflow: hidden; }
.logo-tile img { width: 100%; height: 100%; object-fit: contain; }
.logo-tile.pad img { width: 76%; height: 76%; }
.logo-tile span { font: var(--d-style) var(--d-weight) 22px/1 var(--font-display); color: var(--accent); }
.store-id .nm { font: var(--d-style) var(--d-weight) 19px/0.95 var(--font-display); letter-spacing: var(--d-track); text-transform: uppercase; }
.store-id .sub { font-size: 11px; color: var(--nav-mute); margin-top: 4px; letter-spacing: .04em; }
#nav select {
  margin: 0 0 14px; width: 100%; padding: 9px 10px; border-radius: 9px; font-size: 14px;
  background: transparent; color: var(--nav-ink); border: 1px solid var(--nav-line);
}
#nav select option { color: #222; }
#nav button.tab {
  display: flex; align-items: center; gap: 12px; text-align: left; background: none; border: 0; color: var(--nav-mute);
  padding: 11px 12px; border-radius: 10px; font-weight: 600; font-size: 15px;
}
#nav button.tab svg { width: 20px; height: 20px; flex: none; }
#nav button.tab:hover { color: var(--nav-ink); }
#nav button.tab.on { background: var(--accent); color: var(--on-accent); }
#nav .status { margin-top: auto; font-size: 12px; color: var(--nav-mute); padding: 10px 6px; display: grid; gap: 6px; border-top: 1px solid var(--nav-line); }
#nav .powered { display: flex; align-items: center; gap: 7px; padding: 10px 6px 0; font-size: 10px; color: var(--nav-mute); letter-spacing: .06em; text-transform: uppercase; }
#nav .powered img { height: 11px; filter: brightness(0) invert(1); opacity: .7; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--nav-mute); margin-right: 7px; opacity: .6; }
.dot.on { background: #4ADE80; opacity: 1; }
#main { flex: 1; min-width: 0; overflow: auto; }
.page { padding: 28px 32px 40px; max-width: 1180px; }

/* ---------- buttons & forms ---------- */
.btn {
  border: 1.5px solid var(--ink); background: transparent; border-radius: 999px;
  padding: 9px 18px; font-weight: 700; min-height: 44px; font-size: 14px; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--ink); color: var(--card); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); background: var(--accent); color: var(--on-accent); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover:not(:disabled) { background: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; }
.btn.sm { padding: 5px 13px; min-height: 34px; font-size: 13px; border-width: 1.5px; }
.btn.big {
  width: 100%; padding: 14px; min-height: 60px; border-radius: 14px;
  font: var(--d-style) var(--d-weight) 24px/1 var(--font-display); letter-spacing: var(--d-track); text-transform: uppercase;
}
.btn:disabled { opacity: .35; cursor: not-allowed; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 14px; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; font-weight: 500; }
input[type=text], input[type=search], input[type=number], input[type=password], input:not([type]), select, textarea {
  width: 100%; height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--card); font-size: 16px; font-weight: 500;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 10px; }
.row.between { justify-content: space-between; }
.muted { color: var(--ink-3); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--r); padding: 14px 16px 16px; }
.stat span { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.stat b { display: block; margin-top: 8px; font: var(--d-style) var(--d-weight) 30px/1 var(--font-display); letter-spacing: var(--d-track); color: var(--ink); font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td b { font-weight: 700; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--chip); }
.tag { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--chip); }
.tag.bad { background: #FDE4E1; color: var(--bad); }
.tag.good { background: #DCFCE7; color: var(--good); }
.table-wrap { overflow-x: auto; padding: 6px 10px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: 0; }

/* ---------- sale screen ---------- */
.sale { display: flex; height: 100%; }
.catalog { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 18px 20px 16px; gap: 14px; }
.mhead { display: none; }
.search { position: relative; flex: none; }
.search svg { position: absolute; left: 14px; top: 14px; width: 20px; height: 20px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 44px; border-color: var(--line); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; flex: none; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 16px; font-weight: 700; font-size: 14px; min-height: 40px; }
.chip i { font-style: normal; color: var(--ink-3); font-weight: 600; margin-left: 4px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--card); }
.chip.on i { color: inherit; opacity: .7; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; overflow: auto; align-content: start; flex: 1; padding-bottom: 6px; }
.tile {
  position: relative; background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--tc, var(--accent));
  border-radius: var(--r); padding: 12px 13px 13px; min-height: 108px; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; transition: transform .08s;
}
.tile:hover { border-color: var(--ink-3); border-top-color: var(--tc, var(--accent)); }
.tile:active { transform: scale(.97); }
.tile .n { font-weight: 700; font-size: 15px; line-height: 1.2; }
.tile .p { display: flex; justify-content: space-between; align-items: flex-end; gap: 6px; }
.tile .p b { font: var(--d-style) var(--d-weight) 22px/1 var(--font-display); letter-spacing: var(--d-track); font-variant-numeric: tabular-nums; }
.tile .p small { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.tile .q {
  position: absolute; top: 8px; right: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 99px;
  background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 13px; display: grid; place-items: center;
}
.tile:has(.q) .n { padding-right: 26px; }
.tile:has(.q) { border-color: var(--tc, var(--accent)); box-shadow: inset 0 0 0 1px var(--tc, var(--accent)); }
.tile.out { opacity: .4; }
.empty { color: var(--ink-3); padding: 40px 16px; text-align: center; grid-column: 1 / -1; }
.empty b { display: block; font: var(--d-style) var(--d-weight) 22px/1 var(--font-display); text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }

.ticket { width: 372px; flex: none; background: var(--card); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.ticket header { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.ticket header .tt { display: flex; justify-content: space-between; align-items: center; }
.ticket header .tt h2 { margin: 0; font-size: 26px; }
.ticket header .tt small { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; margin-top: 3px; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--hi); color: #1A1A1A; font-size: 11px; font-weight: 800; }
.lines { flex: 1; overflow: auto; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.line .nm { font-weight: 700; }
.line .amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button { width: 34px; height: 34px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); font-weight: 800; font-size: 17px; line-height: 1; }
.qty button:hover { border-color: var(--ink); }
.qty span { min-width: 28px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.qty em { font-style: normal; color: var(--ink-3); font-size: 13px; margin-left: 6px; }
.ticket footer { padding: 14px 18px 18px; border-top: 1px solid var(--line); display: grid; gap: 8px; background: var(--card); }
.tot { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.tot.grand { color: var(--ink); align-items: baseline; padding-top: 6px; border-top: 1.5px dashed var(--line); margin-top: 2px; }
.tot.grand span:first-child { font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; }
.tot.grand span:last-child { font: var(--d-style) var(--d-weight) 36px/1 var(--font-display); letter-spacing: var(--d-track); }
.ticket-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 4px 0 2px; }
.ticket-actions .btn { padding: 5px 6px; }
.ticket-fab { display: none; }
.seg { display: flex; background: var(--chip); border-radius: 99px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 7px 12px; border-radius: 99px; font-weight: 700; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1.5px var(--ink); }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; background: color-mix(in srgb, var(--nav-bg) 72%, transparent); display: grid; place-items: center; padding: 16px; z-index: 20; }
#modal[hidden], #toast[hidden] { display: none; }
#modal-card {
  background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 22px;
  width: min(500px, calc(100% - 10px)); max-height: calc(100dvh - 40px); overflow: auto;
  box-shadow: 10px 10px 0 var(--hi);
}
#modal-card .mh { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
#modal-card .mh h2 { margin: 0; }
.methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; margin-bottom: 18px; }
.methods button {
  display: flex; align-items: center; gap: 9px; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 9px 10px; font-weight: 700; font-size: 14px; min-height: 50px; text-align: left;
}
.methods button i { width: 26px; height: 26px; flex: none; border-radius: 7px; display: grid; place-items: center; color: #fff; font-style: normal; font-size: 11px; font-weight: 800; }
.methods button.on { border-color: var(--ink); box-shadow: 0 0 0 1.5px var(--ink); background: var(--chip); }
.due { display: flex; justify-content: space-between; align-items: flex-end; padding: 14px 16px; border-radius: 12px; background: var(--chip); margin-bottom: 14px; }
.due span { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.due b { font: var(--d-style) var(--d-weight) 44px/0.9 var(--font-display); letter-spacing: var(--d-track); font-variant-numeric: tabular-nums; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin-bottom: 14px; }
.quick .btn { border-radius: 10px; border-color: var(--line); }
.change { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 2px 14px; }
.change span { font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; color: var(--ink-2); }
.change b { font: var(--d-style) var(--d-weight) 32px/1 var(--font-display); color: var(--good); font-variant-numeric: tabular-nums; }
.qr { display: block; width: 240px; max-width: 100%; margin: 4px auto 12px; border: 1px solid var(--line); border-radius: 12px; }
.note { background: var(--chip); border-left: 4px solid var(--hi); border-radius: 8px; padding: 11px 14px; font-size: 14px; margin-bottom: 14px; }
.err { color: var(--bad); font-size: 13px; font-weight: 600; margin: 6px 0; }

/* ---------- receipt paper ---------- */
.paper { font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: 13px; background: #FFFFFF; color: #111; border: 1px dashed var(--line); padding: 16px; border-radius: 8px; margin-bottom: 16px; }
.paper .c { text-align: center; }
.paper .logo { width: 64px; height: 64px; object-fit: contain; display: block; margin: 0 auto 6px; }
.paper .ln { display: flex; justify-content: space-between; gap: 10px; }
.paper hr { border: 0; border-top: 1px dashed #999; margin: 8px 0; }
.paper .void { text-align: center; font-weight: 700; color: var(--bad); border: 2px solid var(--bad); padding: 4px; margin: 8px 0; }

/* ---------- report bars ---------- */
.bar-row { display: grid; grid-template-columns: 170px 1fr auto; gap: 12px; align-items: center; padding: 6px 0; font-size: 14px; font-weight: 600; }
.bar-row .track { background: var(--chip); border-radius: 99px; height: 12px; overflow: hidden; }
.bar-row .fill { background: var(--accent); height: 100%; border-radius: 99px; }
.bar-row .v { font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }

#toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 11px 18px; border-radius: 99px; z-index: 30; font-size: 14px; font-weight: 600; }

/* ---------- tablets and phones ---------- */
@media (max-width: 1080px) {
  .ticket { width: 330px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); }
}
@media (max-width: 860px) {
  #app { flex-direction: column-reverse; }
  #nav { width: 100%; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 2px; align-items: stretch; }
  #nav .store-id, #nav .status, #nav .powered, #nav select { display: none; }
  #nav button.tab { flex: 1; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 11px; text-align: center; justify-content: center; border-radius: 10px; }
  .page { padding: 18px 16px 30px; }
  .mhead { display: flex; align-items: center; gap: 10px; flex: none; }
  .mhead .logo-tile { width: 40px; height: 40px; border: 1px solid var(--line); }
  .mhead .nm { font: var(--d-style) var(--d-weight) 20px/1 var(--font-display); letter-spacing: var(--d-track); text-transform: uppercase; flex: 1; min-width: 0; }
  .mhead select { width: auto; max-width: 140px; height: 38px; font-size: 13px; padding: 0 8px; }
  .catalog { padding: 14px 16px 12px; gap: 12px; }
  .ticket { display: none; width: 100%; border-left: 0; }
  .sale.show-ticket { flex-direction: column; }
  .sale.show-ticket .catalog > :not(.ticket-fab) { display: none; }
  .sale.show-ticket .catalog { flex: none; padding: 10px 16px; }
  .sale.show-ticket .ticket { display: flex; flex: 1; min-height: 0; }
  .ticket-fab { display: flex; justify-content: space-between; align-items: center; flex: none; border-radius: 14px; min-height: 54px; padding: 10px 18px; }
  .ticket-fab b { font: var(--d-style) var(--d-weight) 22px/1 var(--font-display); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .tile { min-height: 96px; padding: 9px 10px 10px; border-top-width: 4px; }
  .tile .n { font-size: 13.5px; }
  .tile .p b { font-size: 18px; }
  .bar-row { grid-template-columns: 96px 1fr auto; }
  .bar-row .v { min-width: 0; }
  #modal-card { box-shadow: 6px 6px 0 var(--hi); padding: 18px; }
  .due b { font-size: 36px; }
}

@media print {
  body * { visibility: hidden; }
  .paper, .paper * { visibility: visible; }
  .paper { position: fixed; left: 0; top: 0; width: 72mm; border: 0; padding: 0; }
  .paper .logo { filter: grayscale(1); }
}
