/* NCG Location Counter — light professional theme */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: #ccfbf1;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --in: #047857;
  --out: #b45309;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --line: #e2e8f0;
  --online: #047857;
  --offline: #94a3b8;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --radius: 10px;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --head: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 56px;
}

.wrap.wide { max-width: 1180px; }

/* Top bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.topbar-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.topbar-store {
  font-family: var(--head);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.page-head { margin-bottom: 18px; }

.page-head h1 {
  font-family: var(--head);
  font-size: clamp(1.6rem, 3.5vw, 2rem);
  font-weight: 600;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.page-head .sub {
  color: var(--muted);
  margin: 8px 0 0;
  max-width: 36rem;
  font-size: 1.02rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.panel h2 {
  font-family: var(--head);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
}

.panel h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 10px;
}

label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}

input, select, textarea {
  font: inherit;
  width: 100%;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 14px 14px;
  min-height: 48px;
}

input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button, a.btn {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
}

button:hover, a.btn:hover { background: var(--accent-hover); color: #fff; }

button.secondary, a.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.secondary:hover, a.btn.secondary:hover {
  background: #f8fafc;
  color: var(--ink);
}

button.danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecaca;
}

button.danger:hover { background: var(--danger-soft); }

button:disabled, a.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.row > * { flex: 1; min-width: 140px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.stat .lbl {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.stat .val {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.stat .val.in { color: var(--in); }
.stat .val.out, .stat .val.warn { color: var(--out); }
.stat .val.profit { color: var(--in); }
.stat .val.loss { color: var(--danger); }
.stat.flash { box-shadow: 0 0 0 2px var(--warn); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
}

.pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.pill.on { color: var(--online); background: #d1fae5; }
.pill.off { color: #64748b; background: #f1f5f9; }
.pill.disabled { color: var(--danger); background: var(--danger-soft); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  background: #f8fafc;
}

.err { color: var(--danger); margin-top: 8px; font-weight: 600; }
.ok { color: var(--in); margin-top: 8px; font-weight: 600; }
.meta { color: var(--muted); font-size: 0.9rem; }
.empty {
  color: var(--muted);
  padding: 28px 12px;
  text-align: center;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed var(--line);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.pager .btns { display: flex; gap: 8px; }

.disabled-banner {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: #7f1d1d;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-weight: 600;
}

/* Home job tiles — two groups: machines | mobile */
.job-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.job-group {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.job-group-title {
  font-family: var(--head);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
}

.job-group-sub {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.job-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (max-width: 820px) {
  .job-groups { grid-template-columns: 1fr; }
}

a.job-tile {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  min-height: 120px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

a.job-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(15, 118, 110, 0.12);
  color: inherit;
}

a.job-tile .job-title {
  font-family: var(--head);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
}

a.job-tile .job-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

a.job-tile.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

a.job-tile.primary .job-title,
a.job-tile.primary .job-desc { color: #fff; }

a.job-tile.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Tickets / devices */
.ticket {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fafbfc;
}

.ticket.fresh {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ticket .amt {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ticket .no {
  font-family: var(--mono);
  font-size: 0.95rem;
  margin-top: 2px;
}

.ticket .when { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }

.ticket button.pay {
  min-width: 140px;
  font-size: 1.05rem;
}

.devices { display: grid; gap: 12px; }

.device {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #fafbfc;
}

.device.online { border-color: #a7f3d0; background: #f0fdf4; }
.device.disabled { opacity: 0.75; border-color: #fecaca; }

.device-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.device h3 { margin: 0; font-size: 1.1rem; }
.device .hw, .device .route-name {
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--mono);
  margin-top: 4px;
}

.device-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.device-stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.05rem;
  margin-top: 2px;
}

.device .rename {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.device .rename input { margin: 0; flex: 1; min-width: 160px; }
.device .actions-row { display: flex; flex-wrap: wrap; gap: 8px; }

.kiosk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kiosk-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  background: #fff;
}

.kiosk-card:hover { border-color: var(--accent); }
.kiosk-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.kiosk-card h3 { margin: 0 0 4px; font-size: 0.98rem; }
.kiosk-card p { margin: 0; color: var(--muted); font-size: 0.82rem; }

.mobile-qr-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.mobile-qr-card {
  width: 200px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.mobile-qr-card img { display: block; margin: 0 auto; max-width: 100%; }
.mobile-qr-card .code {
  font-family: var(--mono);
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  margin-top: 8px;
  font-weight: 700;
}

.mobile-code-lg {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: 0.14em;
  font-weight: 800;
  margin: 6px 0 10px;
}

.mobile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.player-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.verify-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

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

.quick-add button {
  min-height: 56px;
  font-size: 1.15rem;
  font-weight: 800;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--line);
}

.quick-add button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.amount-display {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin: 0 0 12px;
  color: var(--ink);
}

@media (max-width: 480px) {
  .quick-add { grid-template-columns: repeat(2, 1fr); }
}

/* Auth / login */
.auth-stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background:
    linear-gradient(180deg, #eef2f5 0%, #f4f6f8 40%, #e8eef2 100%);
}

.login-wrap {
  width: 100%;
  max-width: 420px;
}

.auth-panel h2 {
  font-family: var(--head);
  font-size: 1.6rem;
  margin: 0 0 6px;
  color: var(--ink);
}

button.auth-link, .auth-link {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: transparent;
  color: var(--accent);
  border: none;
  min-height: auto;
  padding: 8px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button.auth-link:hover, .auth-link:hover {
  background: transparent;
  color: var(--accent-hover);
  text-decoration: underline;
}

.type-cash_in, .type-bill_in, .type-credit { color: var(--in); }
.type-cash_out, .type-payout { color: var(--out); }

/* Audit checkbook */
.checkbook-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table.checkbook {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 980px;
}

table.checkbook th,
table.checkbook td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

table.checkbook th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
}

table.checkbook tbody tr:nth-child(even) { background: #fafbfc; }
table.checkbook tbody tr:hover { background: #f0fdfa; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt-in { color: var(--in); font-weight: 700; }
.amt-out { color: var(--out); font-weight: 700; }

.type-pill {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.type-pill.in { color: var(--in); background: #d1fae5; }
.type-pill.out { color: var(--out); background: var(--warn-soft); }

.chan {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.subline { color: var(--muted); font-size: 0.8rem; margin-top: 3px; line-height: 1.35; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.filters > * { flex: 1; min-width: 140px; }
.filters > .flt-dt { flex: 1.4; min-width: 240px; }
.filters > .flt-dt input[type="datetime-local"] { min-width: 220px; width: 100%; }

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  box-shadow: var(--shadow);
}

.till-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.till-summary .trow {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.95rem;
}

.till-summary .trow strong { font-family: var(--mono); font-weight: 600; }
.till-summary .expected {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 1.05rem;
  font-weight: 700;
}

@media print {
  body { background: #fff; }
  .topbar, .no-print, .pager, .filters button, #till-msg { display: none !important; }
  .wrap, .wrap.wide { max-width: none; padding: 0; margin: 0; }
  .panel { border: none; box-shadow: none; padding: 0; margin: 0 0 16px; }
  .stats { break-inside: avoid; }
  table.checkbook { font-size: 11px; }
  table.checkbook th, table.checkbook td { padding: 6px 4px; }
  .till-summary { background: #fff; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

@media (max-width: 600px) {
  .wrap { padding: 14px 12px 48px; }
  .ticket { flex-direction: column; align-items: stretch; }
  .ticket button.pay { width: 100%; }
}
