:root {
  --bg: #000000;
  --bg-deep: #0a0612;
  --card: rgba(18, 8, 28, 0.82);
  --card2: rgba(28, 12, 42, 0.9);
  --card-solid: #12081c;
  --text: #f0eaf8;
  --muted: #a89bb8;
  --accent: #c44dff;
  --accent2: #a020f0;
  --accent3: #7b2ff7;
  --neon: #d17aff;
  --cream: #f5e6c8;
  --gold: #e8d5a3;
  --gold-dim: #9a7f4a;
  --danger: #ff5c7a;
  --warn: #ffb84d;
  --ok: #3ecf8e;
  --border: rgba(160, 32, 240, 0.35);
  --border-strong: rgba(196, 77, 255, 0.55);
  --glow: 0 0 20px rgba(160, 32, 240, 0.45), 0 0 40px rgba(123, 47, 247, 0.2);
  --glow-sm: 0 0 12px rgba(160, 32, 240, 0.4);
  --touch: 56px;
  --pad-key: 72px;
  --app-pad: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}
body {
  padding-bottom: env(safe-area-inset-bottom);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(160, 32, 240, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(123, 47, 247, 0.12), transparent 50%),
    linear-gradient(180deg, #0a0612 0%, #000000 45%, #05030a 100%);
  background-attachment: fixed;
  touch-action: manipulation;
}
/* Phone-first single column */
#app {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.view {
  padding: var(--app-pad);
  padding-left: max(var(--app-pad), env(safe-area-inset-left));
  padding-right: max(var(--app-pad), env(safe-area-inset-right));
}
.login-card {
  margin-top: 2vh;
  text-align: center;
  max-width: 100%;
}

/* Hero logo — cyberpunk brand mark */
.logo-hero {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  margin: 0 auto 12px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  box-shadow:
    0 0 0 1px rgba(196, 77, 255, 0.15),
    0 0 28px rgba(160, 32, 240, 0.5),
    0 0 56px rgba(123, 47, 247, 0.25),
    inset 0 0 40px rgba(160, 32, 240, 0.08);
  background: #000;
}
.logo-hero.compact {
  max-height: 100px;
  margin-bottom: 10px;
  border-radius: 12px;
}

.logo-mark {
  width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 16px; border: 2px solid var(--accent);
  background: linear-gradient(145deg, #1a0a28, #050308);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow);
}
.logo-mark span {
  font-size: 1.55rem; font-weight: 900; letter-spacing: -0.04em;
  color: var(--accent); text-shadow: 0 0 12px rgba(196, 77, 255, 0.8);
}

.brand {
  font-size: 1.85rem; font-weight: 800; letter-spacing: 0.06em;
  color: var(--cream);
  text-transform: uppercase;
  text-shadow:
    0 0 12px rgba(160, 32, 240, 0.6),
    0 0 28px rgba(196, 77, 255, 0.35);
}
.brand-sub { color: var(--muted); margin-bottom: 8px; font-size: 0.95rem; }
.brand-tag {
  display: inline-block; margin-bottom: 16px;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--neon);
  border: 1px solid var(--border);
  background: rgba(160, 32, 240, 0.12);
  padding: 4px 12px; border-radius: 999px;
  box-shadow: var(--glow-sm);
}

.lbl { display: block; text-align: left; font-size: 0.85rem; color: var(--muted); margin: 10px 0 6px; }

/* >=16px prevents iOS focus zoom */
.pin-input, input, select, textarea {
  width: 100%;
  min-height: var(--touch);
  height: var(--touch);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(8, 4, 14, 0.9);
  color: var(--text);
  font-size: 16px;
  padding: 0 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
textarea { height: auto; min-height: 88px; padding: 12px 14px; }
.pin-input::placeholder, input::placeholder, select::placeholder, textarea::placeholder { color: #6e6280; }
.pin-input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(160, 32, 240, 0.35), var(--glow-sm);
}

/* Large spaced PIN digits for thumbs */
.pin-input {
  text-align: center;
  font-size: 1.75rem;
  letter-spacing: 0.55em;
  padding-left: 0.55em;
  margin-bottom: 8px;
  height: 64px;
  min-height: 64px;
  font-weight: 700;
  caret-color: var(--neon);
}
.pin-input.pin-hidden-a11y {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Visual PIN dots (synced from JS) */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 8px 0 14px;
  min-height: 28px;
}
.pin-dots .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  box-shadow: var(--glow-sm);
  transition: background 0.1s, transform 0.1s;
}
.pin-dots .dot.filled {
  background: var(--neon);
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(196, 77, 255, 0.7);
  transform: scale(1.08);
}

/* Big on-screen numeric keypad */
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 8px 0 16px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
}
.pin-pad button {
  height: var(--pad-key);
  min-height: var(--pad-key);
  border-radius: 18px;
  background: var(--card);
  color: var(--text);
  font-size: 1.65rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s, transform 0.08s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.pin-pad button:active {
  background: var(--card2);
  border-color: var(--accent);
  box-shadow: var(--glow-sm);
  transform: scale(0.96);
}
.pin-pad button.pad-action {
  font-size: 1.15rem;
  color: var(--neon);
}

/* Sticky thumb-reach login CTA */
.login-actions {
  position: sticky;
  bottom: 0;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  margin-top: 4px;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 3, 10, 0.92) 28%, rgba(5, 3, 10, 0.98) 100%);
  z-index: 5;
}

.btn {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  background: #3a2a4a;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s, filter 0.15s;
  touch-action: manipulation;
  min-height: 48px;
}
.btn.big {
  width: 100%;
  height: var(--touch);
  min-height: var(--touch);
  font-size: 1.1rem;
  margin-top: 8px;
}
.btn.sm {
  height: 44px;
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.85rem;
}
.btn.primary {
  background: linear-gradient(135deg, #a020f0 0%, #7b2ff7 55%, #5a1fc7 100%);
  color: #fff;
  border-color: rgba(209, 122, 255, 0.6);
  box-shadow: 0 0 18px rgba(160, 32, 240, 0.45);
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.btn.primary:hover, .btn.primary:active {
  filter: brightness(1.08);
  box-shadow: 0 0 28px rgba(196, 77, 255, 0.65), 0 0 48px rgba(123, 47, 247, 0.3);
}
.btn.success {
  background: linear-gradient(135deg, #2aad6e, #1e8a55);
  color: #04140c;
  border-color: rgba(62, 207, 142, 0.5);
  box-shadow: 0 0 14px rgba(62, 207, 142, 0.3);
}
.btn.danger {
  background: linear-gradient(135deg, #e03a5a, #b02040);
  color: #fff;
  border-color: rgba(255, 92, 122, 0.5);
  box-shadow: 0 0 14px rgba(255, 92, 122, 0.28);
}
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn.ghost:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: var(--glow-sm);
}
.btn.gold-outline {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 12px rgba(232, 213, 163, 0.15);
}
.btn.gold-outline:hover {
  border-color: var(--cream);
  box-shadow: 0 0 18px rgba(232, 213, 163, 0.3);
}
.btn:disabled { opacity: 0.4; filter: none; box-shadow: none; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  box-shadow: 0 8px 24px -16px rgba(160, 32, 240, 0.4);
}
.topbar-brand {
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--neon); font-weight: 700; margin-bottom: 2px;
  text-shadow: 0 0 10px rgba(196, 77, 255, 0.5);
}
.who { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.role-badge {
  display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--neon);
  background: rgba(160, 32, 240, 0.18);
  padding: 2px 8px; border-radius: 999px; margin-top: 2px;
  border: 1px solid var(--border);
}

.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  height: 48px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.12s, color 0.12s, box-shadow 0.12s, border-color 0.12s;
  touch-action: manipulation;
  scroll-snap-align: start;
}
.tab.active {
  background: linear-gradient(135deg, #a020f0, #7b2ff7);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--glow-sm);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(196, 77, 255, 0.08);
}
.form input, .form select { margin-bottom: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-inline { display: flex; gap: 8px; }
.form-inline input { flex: 1; }

h2 {
  font-size: 0.95rem;
  color: var(--cream);
  font-weight: 700;
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(160, 32, 240, 0.35);
}
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); margin-top: 10px; text-shadow: 0 0 8px rgba(255, 92, 122, 0.35); }
.banner.warn {
  background: rgba(80, 50, 10, 0.65);
  color: var(--warn);
  padding: 10px 12px;
  border-radius: 10px;
  margin-top: 8px;
  font-weight: 600;
  border: 1px solid rgba(255, 184, 77, 0.35);
}

.clock-state { font-size: 1.15rem; font-weight: 700; margin-bottom: 12px; text-align: center; }
.list { list-style: none; padding: 0; margin: 0; }
.list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.list.compact li { padding: 10px 12px; }
.list .title { font-weight: 700; color: var(--text); }
.list .meta { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.task-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-row.done { opacity: 0.65; }
.check-btn { flex: 0 0 auto; min-width: 96px; height: 48px; min-height: 48px; }

.totals {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center;
}
.totals strong {
  display: block; font-size: 1.15rem; margin-top: 4px;
  color: var(--neon);
  text-shadow: 0 0 12px rgba(196, 77, 255, 0.55);
}

.pay-step { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: linear-gradient(135deg, #a020f0, #7b2ff7);
  color: #fff;
  padding: 12px 18px; border-radius: 12px;
  font-weight: 700; z-index: 50; max-width: 90%;
  box-shadow: var(--glow);
  border: 1px solid rgba(209, 122, 255, 0.5);
}

.status-owed { color: var(--warn); font-weight: 700; }
.badge {
  display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 8px; font-weight: 700;
}
.badge.cash { background: #0e2a1c; color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.badge.card { background: #0e1a2e; color: #7eb6ff; border: 1px solid rgba(126, 182, 255, 0.3); }
.badge.ok { background: #0e2a1c; color: var(--ok); border: 1px solid rgba(62, 207, 142, 0.3); }
.badge.pending { background: #2a220c; color: var(--warn); border: 1px solid rgba(255, 184, 77, 0.3); }
.badge.paid {
  background: rgba(160, 32, 240, 0.2);
  color: var(--neon);
  border: 1px solid var(--border);
}
.badge.denied { background: #2a1018; color: var(--danger); border: 1px solid rgba(255, 92, 122, 0.3); }
.geo-hint { text-align: center; margin: 0 0 10px; font-size: 0.8rem; line-height: 1.35; }
#clock-error { text-align: center; margin-bottom: 8px; font-weight: 600; }

.pay-choice.active-pay {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--glow-sm);
}
#report-summary-totals strong { font-size: 1.05rem; }

.owed-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.owner-spend-block { margin-bottom: 18px; }
.owner-spend-block > .owner-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin: 14px 0 8px; flex-wrap: wrap;
}
.owner-spend-block > .owner-head .name {
  font-weight: 700; color: var(--neon); letter-spacing: 0.02em;
  text-shadow: 0 0 10px rgba(196, 77, 255, 0.4);
}
.tier-list { list-style: none; padding: 0; margin: 10px 0 0; }
.tier-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.tier-list li:last-child { border-bottom: none; }
.tier-list .unlocked { color: var(--ok); font-weight: 700; }
.tier-list .locked { color: var(--muted); }

.hint-box {
  background: rgba(160, 32, 240, 0.12);
  border: 1px solid var(--border-strong);
  color: #e8dcf5;
  border-radius: 12px;
  padding: 12px;
  margin: 14px 0;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: inset 0 0 24px rgba(160, 32, 240, 0.08), var(--glow-sm);
}

.staff-logo-strip { margin: 0 0 10px; }
.staff-logo-strip .logo-hero {
  max-height: 88px;
  margin-bottom: 0;
}

/* Auth tabs on rewards (shared sizing) */
.auth-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.auth-tabs button {
  flex: 1;
  height: 48px;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.auth-tabs button.active {
  background: linear-gradient(135deg, #a020f0, #7b2ff7);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--glow-sm);
}

/* Narrow phones (~390px and below): even less waste, bigger keys */
@media (max-width: 430px) {
  :root {
    --app-pad: 10px;
    --pad-key: 76px;
    --touch: 56px;
  }
  #app { max-width: 100%; }
  .logo-hero { max-height: 150px; }
  .row2 { grid-template-columns: 1fr; }
  .pin-dots { gap: 16px; }
  .pin-dots .dot { width: 20px; height: 20px; }
}

/* Desktop: slightly wider, still centered */
@media (min-width: 600px) {
  #app { max-width: 480px; }
  :root { --app-pad: 18px; --pad-key: 68px; }
  .logo-hero { max-height: 220px; }
  .login-actions {
    position: static;
    background: none;
    padding: 0;
  }
}

/* Prefer pointer fine = desktop mouse: keep pad usable but not oversized */
@media (hover: hover) and (pointer: fine) {
  .pin-pad button:hover {
    background: var(--card2);
    border-color: var(--accent);
    box-shadow: var(--glow-sm);
  }
}
