:root {
  --navy: #102a43;
  --navy-deep: #0b1d30;
  --blau: #1e4e7a;
  --blau-bright: #2b6ea3;
  --paper: #f4f7fb;
  --ink: #102a43;
  --muted: #5b6b7c;
  --line: #c5d0dc;
  --cash: #1b7a45;
  --card: #c45c26;
  --warn: #b42318;
  --reward: #0f6b4c;
  --min-tap: 72px;
  --tile: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--navy-deep);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

button, input, select {
  font: inherit;
}

button {
  min-height: var(--min-tap);
  border: 0;
  border-radius: var(--tile);
  cursor: pointer;
  font-weight: 700;
}

input, select {
  min-height: var(--min-tap);
  border: 1px solid var(--line);
  border-radius: var(--tile);
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 8px 16px;
  background: var(--navy);
  color: #fff;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 2px;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
}

.sub {
  margin: 0;
  color: #c5d4e3;
  font-size: 0.9rem;
}

.sync-note {
  margin: 0;
  color: #c5d4e3;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.sync-note[data-state="on"] { color: #8ee0b0; }
.sync-note[data-state="off"] { color: #ffd39a; }
.sync-note[data-state="sync"] { color: #9ad4ff; }

.mode-btn, .setup-tab {
  background: #1a3d5c;
  color: #fff;
  padding: 0 22px;
  min-width: 140px;
}

.mode-btn.active, .setup-tab.active {
  background: #fff;
  color: var(--navy);
}

.pos {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 380px;
  height: calc(100dvh - 72px);
  background: #d9e2ec;
}

.families {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow: auto;
  background: var(--navy);
}

.family {
  min-height: 88px;
  color: #fff;
  font-size: 1.15rem;
  text-align: center;
  padding: 10px 8px;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.18);
}

.family.on {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

.menu {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.cat-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
  background: #bcccdc;
}

.cat {
  flex: 1 0 140px;
  min-height: 80px;
  color: #fff;
  font-size: 1.05rem;
  padding: 8px 10px;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.18);
}

.cat.on {
  outline: 3px solid var(--navy);
  outline-offset: -3px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  padding: 10px;
  overflow: auto;
  align-content: start;
}

.product {
  min-height: 132px;
  color: #fff;
  text-align: left;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 -6px rgba(0, 0, 0, 0.16);
}

.example {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #ffe08a;
}

.mark { font-size: 28px; line-height: 1; }
.pname { font-size: 1.25rem; line-height: 1.15; }
.price { font-size: 1.15rem; font-weight: 700; }

.ticket-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-left: 1px solid var(--line);
}

.ticket-head, .line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.ticket-head {
  padding: 10px 12px;
  background: var(--navy);
  color: #fff;
}

.ticket-head h2 { margin: 0; font-size: 1.2rem; }
.ticket-head .ghost { color: #fff; border-color: #6b87a1; min-height: 56px; }

.ticket-lines {
  flex: 1;
  overflow: auto;
  padding: 8px 12px;
}

.line {
  padding: 8px 0;
  border-bottom: 1px solid #e6edf4;
}

.qty {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.2rem;
  font-weight: 700;
}

.qty button {
  width: 64px;
  min-width: 64px;
  background: #e4ebf3;
  color: var(--navy);
}

.ticket-client {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #f4f7fb;
}

.ticket-client label, .form label, .lead, .hint {
  display: block;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.identify {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.identify .tonal { min-width: 96px; }

.customer {
  margin-top: 8px;
  padding: 10px;
  border-radius: var(--tile);
  background: #e8f1f8;
}

.customer.reward {
  background: #e3f6ec;
  border: 2px solid var(--reward);
}

.gift-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #0f6b4c;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.gift-banner {
  margin-top: 8px;
  padding: 10px;
  border-radius: var(--tile);
  background: #fff4d6;
  border: 2px solid #b8860b;
}

.gift-banner strong { display: block; margin-bottom: 8px; }
.line.gift .muted { color: var(--reward); font-weight: 700; }

.discount {
  margin: 0;
  padding: 0 12px;
  color: var(--reward);
  font-weight: 800;
  min-height: 1.2em;
}

.total {
  margin: 0;
  padding: 8px 12px 4px;
  color: var(--navy);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
}

.pay {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 12px 14px;
}

.cash, .card-pay {
  min-height: 84px;
  color: #fff;
  font-size: 1.35rem;
}

.cash { background: var(--cash); }
.card-pay { background: var(--card); }
.cash:disabled, .card-pay:disabled { opacity: 0.4; }

.ghost {
  background: transparent;
  color: var(--blau);
  border: 1px solid var(--line);
}

.danger {
  background: transparent;
  color: var(--warn);
  border: 1px solid #f0b4b0;
}

.tonal {
  background: #d6e4f0;
  color: var(--navy);
}

.primary {
  background: var(--blau);
  color: #fff;
}

.setup {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  min-height: calc(100dvh - 72px);
  background: var(--paper);
}

.setup-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--navy);
}

.setup-page {
  padding: 16px;
  overflow: auto;
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(16, 42, 67, 0.08);
}

.panel h2 { margin: 0 0 8px; color: var(--navy); }

.lead { margin: 0 0 14px; font-weight: 400; }
.callout {
  background: #e3f6ec;
  border-left: 4px solid var(--reward);
  padding: 10px 12px;
  margin: 0 0 14px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form { display: grid; gap: 8px; margin-bottom: 14px; }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.list { display: grid; gap: 8px; }

.item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--tile);
  padding: 10px 12px;
  background: #fff;
}

.item .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.item .actions button { min-height: 56px; padding: 0 12px; }

.tree-group { display: grid; gap: 8px; margin-bottom: 12px; }
.tree-cat { margin-left: 18px; display: grid; gap: 8px; }

.day-box {
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

.dialog {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(480px, calc(100vw - 24px));
}

.dialog::backdrop { background: rgba(11, 29, 48, 0.55); }
.dialog-body { padding: 18px; }

.receipt {
  font-family: ui-monospace, monospace;
  text-align: center;
}

.receipt .left {
  display: flex;
  justify-content: space-between;
  text-align: left;
}

.hidden { display: none !important; }
.empty { color: var(--muted); text-align: center; padding: 28px 8px; }
.hint { min-height: 1.2em; }
.muted { color: var(--muted); }

.pin-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(11, 29, 48, 0.92);
  padding: 16px;
}

.pin-card {
  width: min(420px, 100%);
  background: var(--navy);
  color: #fff;
  border-radius: 16px;
  padding: 22px 22px 26px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.pin-card h2 { margin: 0 0 8px; }
.pin-card .lead { color: #c5d4e3; margin: 0 0 16px; }

.pin-dots {
  margin: 0 0 10px;
  text-align: center;
  font-size: 1.8rem;
  letter-spacing: 0.35em;
  color: #fff;
}

.pin-error {
  min-height: 1.4em;
  margin: 0 0 12px;
  text-align: center;
  color: #ffb4a8;
  font-weight: 700;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-pad button {
  min-height: 76px;
  font-size: 1.8rem;
  background: #1a3d5c;
  color: #fff;
}

.pin-pad button:active { filter: brightness(1.15); }
.pin-clear { background: #8b3a3a !important; }
.pin-ok { background: #c45c26 !important; }

@media (max-width: 980px) {
  .pos {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(220px, 1fr) minmax(280px, 42vh);
    height: auto;
    min-height: calc(100dvh - 72px);
  }
  .families {
    flex-direction: row;
    overflow-x: auto;
  }
  .family { flex: 1 0 140px; min-height: 72px; }
  .ticket-panel { border-left: 0; border-top: 1px solid var(--line); }
  .setup { grid-template-columns: 1fr; }
  .setup-nav { flex-direction: row; overflow-x: auto; }
  .split { grid-template-columns: 1fr; }
}
