:root {
  --bg: #0b1220;
  --card: #0f1b33;
  --text: #e7eefc;
  --muted: rgba(231, 238, 252, 0.7);
  --border: rgba(231, 238, 252, 0.12);
  --accent: #22c55e;
  --accent2: #60a5fa;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: #0b1220;
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
}

a { color: var(--accent2); text-decoration: none; }
a.link:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: #0b1730;
  position: sticky;
  top: 0;
}

.brand { font-weight: 700; color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.footer {
  padding: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin: 14px 0;
}

.row { display: flex; gap: 12px; }
.row-between { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }

label { display:block; margin-top: 12px; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b1730;
  color: var(--text);
  outline: none;
}
textarea { resize: vertical; }

.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b1730;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { border-color: rgba(231, 238, 252, 0.35); }
.btn-secondary { background: transparent; }
.btn-small { padding: 8px 10px; font-size: 13px; }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hidden { display: none !important; }

.field-error {
  color: rgba(239, 68, 68, 0.95);
  font-size: 12px;
  margin-top: 6px;
  min-height: 14px;
}

.store-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(11, 23, 48, 0.55);
  margin-bottom: 12px;
}
.store-banner-kicker {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}
.store-banner-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.store-code-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.10);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.store-tagline {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.10);
  color: rgba(231, 238, 252, 0.95);
  font-weight: 800;
  font-size: 12px;
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(11, 23, 48, 0.55);
}
.match-name { font-weight: 700; }

.alert {
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 10px;
  margin: 10px 0;
}
.alert-ok {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
}

.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--border); text-align:left; }
.badge {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.kpi {
  background: #0b1730;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.kpi-label { color: var(--muted); font-size: 12px; }
.kpi-value { font-size: 26px; font-weight: 800; margin-top: 4px; }

.timeline { list-style: none; padding-left: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--border); }

.ticket-big {
  font-size: 28px;
  font-weight: 900;
  padding: 10px 14px;
  border: 1px dashed rgba(231,238,252,0.35);
  border-radius: 12px;
  display: inline-block;
  margin: 8px 0 18px 0;
}

/* Print label layout */
.label {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding: 6px 8px;
  width: 2in;
  height: 1in;
  border: 1px dashed rgba(0,0,0,0.2);
  background: white;
  color: black;
  font-family: Arial, sans-serif;
}
.label-ticket { font-weight: 800; font-size: 14px; }
.label-line { font-size: 10px; margin-top: 2px; }
.label-right img { width: 0.7in; height: 0.7in; }

.print-actions { display:flex; gap: 10px; justify-content:center; padding: 14px; }

/* Kiosk */
.kiosk-body { background: #0b1220; }
.kiosk { display:flex; justify-content:center; align-items:center; min-height: 100vh; padding: 20px; }
.kiosk-card { width: min(720px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 18px; }
.kiosk-btn { width: 100%; padding: 14px; font-size: 18px; margin-top: 14px; }

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .row-between { flex-direction: column; align-items: stretch; }
}

/* Hide elements when printing */
@media print {
  .no-print, .topbar, .footer { display: none !important; }
  body { background: white; }
}

/* -------------------------
   Device / Issue wizard
-------------------------- */
.wiz-title { font-weight: 800; font-size: 18px; }
.wiz-crumbs {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
}
.wiz-crumb {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.wiz-crumb.active {
  border-color: rgba(96, 165, 250, 0.6);
  color: var(--text);
}
.wiz-crumb.done {
  border-color: rgba(34, 197, 94, 0.55);
}
.wiz-sep { margin: 0 8px; color: rgba(231, 238, 252, 0.35); }

.wiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.wiz-tile {
  text-align: left;
  padding: 12px 12px;
  border-radius: 14px;
  background: #0b1730;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}
.wiz-tile:hover { border-color: rgba(231, 238, 252, 0.35); }
.wiz-tile.selected {
  border-color: rgba(34, 197, 94, 0.65);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}
.wiz-tile-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 8px;
}
.wiz-tile-label { font-weight: 800; font-size: 14px; }

.wiz-search { margin-top: 8px; }

.wiz-issue-list {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.wiz-issue {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.wiz-issue:last-child { border-bottom: none; }
.wiz-issue input { width: auto; }
.wiz-issue-name { flex: 1; }
.wiz-issue-price { color: var(--muted); font-variant-numeric: tabular-nums; }

.wiz-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  background: #0b1730;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.wiz-summary-line { margin: 4px 0; }

/* New wizard tiles */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.tile {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #0b1730;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.tile:hover { border-color: rgba(96,165,250,0.35); }
.tile-active { border-color: var(--accent2); box-shadow: 0 0 0 1px rgba(96,165,250,0.35); }
.tile-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(96,165,250,0.25), rgba(34,197,94,0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  overflow: hidden;
}
.tile-icon img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.tile-label { font-weight: 700; }

.issue-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #0b1730;
  color: var(--text);
  cursor: pointer;
  max-width: 320px;
  white-space: normal;
}
.issue-pill-label {
  white-space: normal;
  line-height: 1.3;
}
.issue-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.issue-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.issue-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #0b1730;
  color: var(--text);
  cursor: pointer;
  width: 100%;
  margin: 0;
}
.issue-chip input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border-radius: 4px;
  background: transparent;
  border: 1px solid var(--border);
  -webkit-appearance: auto;
  appearance: auto;
  accent-color: var(--accent2);
  flex: 0 0 auto;
}
.issue-chip-active { border-color: var(--accent2); box-shadow: 0 0 0 1px rgba(96,165,250,0.25); }
.issue-chip-text { white-space: normal; flex: 1; min-width: 0; }
.issue-chip-price { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.issue-total { margin-top: 10px; text-align: right; font-weight: 800; }
.issue-pill input { margin: 0; }
.issue-pill-active { border-color: var(--accent2); box-shadow: 0 0 0 1px rgba(96,165,250,0.25); }
.wiz-money { text-align: right; }
.wiz-money-total { font-weight: 900; }

.wiz-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

/* Top navigation links (admin) */
.topnav {
  display: flex;
  gap: 10px;
  margin-left: 18px;
}
.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 10px;
}
.topnav a:hover {
  color: var(--text);
  background: rgba(231, 238, 252, 0.08);
}

/* Store settings tabs */
.tab-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tab-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b1730;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}
.tab-btn.active {
  color: var(--text);
  border-color: rgba(96,165,250,0.6);
  box-shadow: 0 0 0 1px rgba(96,165,250,0.2);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Inline input + button (e.g. Passcode + Pattern) */
.field-inline {
  display: flex;
  gap: 10px;
  align-items: center;
}
.field-inline input {
  flex: 1;
}

/* Note visibility toggle (Internal vs Customer) */
.note-visibility {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}
.note-visibility label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #0b1730;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}
.note-visibility input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent2);
}

/* Stepper */
.stepper {
  background: transparent;
  border: none;
  padding: 0;
}
.stepper-header {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.stepper-header .step-btn {
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
}
.stepper-header .step-btn:disabled {
  opacity: 0.4;
}
.step-btn.active {
  border-color: rgba(96,165,250,0.6);
  box-shadow: 0 0 0 1px rgba(96,165,250,0.2);
  background: rgba(96,165,250,0.12);
  color: var(--text);
}
.step-panel { display: none; }
.step-panel.active { display: block; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1000;
}
.modal-overlay.open { display: flex; }
.modal-card { width: min(520px, 100%); }
.pattern-wrap { margin-top: 12px; display: grid; gap: 10px; justify-items: center; }
.pattern-canvas {
  width: 320px;
  height: 320px;
  border-radius: 14px;
  border: 1px solid var(--border);
  touch-action: none;
}
.pattern-preview { text-align: center; }
