/* NANO — space/arcade theme. All assets local; no CDNs (MDM-locked Mac). */

:root {
  --bg: #0b1026;
  --bg2: #111736;
  --card: #151c3f;
  --card-edge: #232c5c;
  --ink: #eef1ff;
  --ink-dim: #9aa3c7;
  --cyan: #2dd4ef;
  --purple: #8b5cf6;
  --gold: #fbbf24;
  --green: #84cc16;
  --red: #fb7185;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1px 1px at 20% 30%, #ffffffaa 0, transparent 50%),
    radial-gradient(1px 1px at 70% 12%, #ffffff88 0, transparent 50%),
    radial-gradient(1.5px 1.5px at 84% 64%, #ffffff66 0, transparent 50%),
    radial-gradient(1px 1px at 40% 80%, #ffffff77 0, transparent 50%),
    radial-gradient(1px 1px at 8% 70%, #ffffff55 0, transparent 50%),
    radial-gradient(1.5px 1.5px at 55% 45%, #ffffff44 0, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, #0d1230 60%, #0a0e22 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.7rem 1.2rem;
  background: #0b1026cc;
  border-bottom: 1px solid var(--card-edge);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--cyan); }
.brand-atom { width: 34px; height: 34px; }
.brand-n { font: 800 20px sans-serif; fill: var(--purple); }
.brand-name {
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  background: linear-gradient(90deg, var(--cyan), #4ba3f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.admin-tag { color: var(--gold); font-weight: 700; letter-spacing: 0.08em; }

.mainnav { display: flex; gap: 0.3rem; flex: 1; }
.mainnav a {
  color: var(--ink-dim);
  text-decoration: none;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
}
.mainnav a:hover { color: var(--ink); background: #ffffff10; }
.mainnav a.active { color: var(--bg); background: var(--cyan); }

.topbar-right { display: flex; align-items: center; gap: 0.8rem; }

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #2a2207, #3d3208);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-weight: 800;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.nb-label { font-size: 0.75rem; opacity: 0.8; }

.ghost-btn {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--card-edge);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.85rem;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--ink-dim); }
.inline-form { display: inline; }

/* ── layout ─────────────────────────────────────────────────────────────── */

.page { flex: 1; width: min(1060px, 94vw); margin: 1.4rem auto; }
.page-title { font-size: 1.7rem; margin: 0.2rem 0 1rem; }

.card {
  background: linear-gradient(180deg, var(--card), #121838);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.1rem;
}
.card h2 { margin: 0 0 0.7rem; font-size: 1.05rem; letter-spacing: 0.02em; }
.glow { box-shadow: 0 0 24px #2dd4ef22, 0 0 60px #8b5cf614; border-color: #2dd4ef55; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  /* Phones: let the topbar stack instead of running off-screen. The nav drops to
     its own full-width row below the brand + balance/sign-out. */
  .topbar { flex-wrap: wrap; }
  .mainnav { order: 3; flex-basis: 100%; flex-wrap: wrap; }
}

.empty { color: var(--ink-dim); font-style: italic; }

/* ── hero ───────────────────────────────────────────────────────────────── */

.hero { display: flex; gap: 2rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hero-label { color: var(--ink-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.75rem; }
.hero-number {
  font-size: 4.2rem;
  font-weight: 900;
  line-height: 1.05;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px #fbbf2444;
}
.hero-nb { font-size: 1.4rem; margin-left: 0.5rem; color: #fbbf24aa; }
.hero-side { display: flex; gap: 2rem; flex-wrap: wrap; }

.stat-label { color: var(--ink-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; }
.stat-value { font-size: 1.5rem; font-weight: 800; margin: 0.15rem 0; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--ink-dim); font-size: 0.8rem; }

/* ── meters ─────────────────────────────────────────────────────────────── */

.meter {
  height: 8px;
  background: #0b1026;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--card-edge);
  margin: 0.4rem 0;
  min-width: 140px;
}
.meter.big { height: 14px; flex: 1; }
.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), #4ba3f7);
  border-radius: 999px;
  transition: width 0.6s ease;
}
.meter.purple .meter-fill { background: linear-gradient(90deg, var(--purple), #c084fc); }

.goal-row { display: flex; align-items: center; gap: 0.8rem; margin: 0.55rem 0; }
.goal-row > span:first-child { width: 3.4rem; color: var(--ink-dim); font-weight: 600; }
.goal-num { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 7ch; text-align: right; }
.goal-hint { color: var(--ink-dim); margin-top: 0.6rem; font-size: 0.9rem; }

/* ── buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  color: var(--bg);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.btn-primary { background: linear-gradient(135deg, var(--cyan), #4ba3f7); }
.btn-gold { background: linear-gradient(135deg, var(--gold), #f59e0b); box-shadow: 0 0 18px #fbbf2433; }
.btn-outline { background: transparent; border: 1.5px solid var(--cyan); color: var(--cyan); }
.btn-wide { width: 100%; }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.8rem; border-radius: 8px; }
.btn-danger { background: var(--red); }

/* ── feed / lists ───────────────────────────────────────────────────────── */

.feed, .orders, .teaser { list-style: none; margin: 0; padding: 0; }
.feed-item, .orders li, .teaser li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid #ffffff0d;
}
.feed-item:last-child, .orders li:last-child, .teaser li:last-child { border-bottom: none; }
.feed-icon { font-size: 1.1rem; }
.feed-desc { flex: 1; }
.feed-when { color: var(--ink-dim); font-size: 0.75rem; white-space: nowrap; }
.feed-amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed-item.earn .feed-amount { color: var(--green); }
.feed-item.spend .feed-amount { color: var(--red); }
.feed-item.flash { animation: feedflash 1.6s ease; }
@keyframes feedflash { 0% { background: #fbbf2426; } 100% { background: transparent; } }

.teaser-emoji { font-size: 1.4rem; }
.teaser-name { flex: 1; }

.price-pill {
  background: #fbbf2419;
  border: 1px solid #fbbf2477;
  color: var(--gold);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-weight: 800;
  font-size: 0.85rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.price-pill.small { font-size: 0.75rem; }

.chip {
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: #ffffff14;
  color: var(--ink-dim);
  white-space: nowrap;
}
.chip-pending { background: #fbbf2422; color: var(--gold); }
.chip-fulfilled, .chip-ok, .chip-won { background: #84cc1622; color: var(--green); }
.chip-canceled, .chip-muted { background: #ffffff14; color: var(--ink-dim); }
.chip-err, .chip-lost { background: #fb718522; color: var(--red); }
.chip-needs_review, .chip-pending_settlement { background: #8b5cf622; color: #c084fc; }
.chip-active { background: #2dd4ef22; color: var(--cyan); }

/* ── banners / toasts ───────────────────────────────────────────────────── */

.banner { border-radius: 10px; padding: 0.7rem 1rem; margin: 0.8rem 0; font-weight: 600; }
.banner-ok { background: #84cc1618; border: 1px solid #84cc1655; color: var(--green); }
.banner-err { background: #fb718518; border: 1px solid #fb718555; color: var(--red); }
.banner a { color: inherit; }

#toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
}
.toast {
  background: linear-gradient(135deg, #1a2150, #141a3e);
  border: 1px solid var(--cyan);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.75rem 1.1rem;
  font-weight: 700;
  box-shadow: 0 6px 24px #00000088, 0 0 18px #2dd4ef22;
  animation: toast-in 0.25s ease, toast-out 0.4s ease 4.6s forwards;
  max-width: 340px;
}
.toast.err { border-color: var(--red); }
.toast.gold { border-color: var(--gold); box-shadow: 0 6px 24px #00000088, 0 0 18px #fbbf2433; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

.hidden { display: none !important; }

/* ── login ──────────────────────────────────────────────────────────────── */

.login-body .topbar, .login-body .footer-mark { display: none; }
.login-card { max-width: 380px; margin: 9vh auto 0; text-align: center; padding: 2rem; }
.login-atom { width: 72px; height: 72px; }
.login-card h1 { letter-spacing: 0.2em; margin: 0.4rem 0 0.2rem; }
.login-sub { color: var(--ink-dim); margin-top: 0; }
.login-form { display: flex; flex-direction: column; gap: 0.9rem; text-align: left; margin-top: 1rem; }
.login-form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; color: var(--ink-dim); font-size: 0.85rem; }
.login-hint { color: var(--ink-dim); font-size: 0.8rem; margin-top: 1.2rem; }

input, select {
  background: #0b1026;
  border: 1px solid var(--card-edge);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
}
input:focus, select:focus { outline: 2px solid var(--cyan); border-color: transparent; }

/* ── shop ───────────────────────────────────────────────────────────────── */

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; margin-bottom: 1.4rem; }
.shop-item { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0; position: relative; }
.shop-item:hover { border-color: var(--cyan); }
.shop-item.soldout { opacity: 0.55; }
.shop-emoji { font-size: 2.6rem; line-height: 1; }
.shop-name { font-weight: 800; font-size: 1.05rem; }
.shop-desc { color: var(--ink-dim); font-size: 0.85rem; flex: 1; }
.shop-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.4rem; }
.shop-stock { color: var(--ink-dim); font-size: 0.72rem; }

/* ── lock-in ────────────────────────────────────────────────────────────── */

.lockin-pitch { color: var(--ink-dim); max-width: 640px; }
.lockin-stage { text-align: center; padding: 2rem 1.3rem; }
.lockin-live { color: var(--cyan); font-weight: 700; }
.lockin-reminder { color: var(--cyan); font-weight: 700; font-size: 0.9rem; margin: 0.2rem 0 0; }
.duration-grid { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; margin: 1.2rem 0 0.4rem; }
.duration-btn {
  background: #0b1026;
  border: 2px solid var(--purple);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
  font-weight: 800;
  cursor: pointer;
  min-width: 130px;
  transition: transform 0.08s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.duration-btn:hover { border-color: var(--gold); box-shadow: 0 0 18px #fbbf2433; transform: translateY(-2px); }
.duration-btn .d-min { font-size: 1.5rem; display: block; }
.duration-btn .d-bonus { color: var(--gold); font-size: 0.9rem; }

.ring-wrap { position: relative; width: 220px; height: 220px; margin: 0.6rem auto; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #232c5c; stroke-width: 12; }
.ring-fg { fill: none; stroke: var(--gold); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-time { font-size: 2.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.ring-sub { color: var(--ink-dim); font-size: 0.8rem; }

.lockin-status { font-size: 1.2rem; font-weight: 800; margin: 0.8rem 0; }
.lockin-rules ol { color: var(--ink-dim); line-height: 1.7; margin: 0; padding-left: 1.2rem; }
.lockin-fineprint { color: var(--ink-dim); font-size: 0.8rem; }
.pulse { animation: pulse 1.6s ease infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ── tables / admin ─────────────────────────────────────────────────────── */

.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--card-edge); border-radius: var(--radius); overflow: hidden; }
.table th { text-align: left; color: var(--ink-dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--card-edge); }
.table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid #ffffff0a; font-size: 0.9rem; vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.row-muted { opacity: 0.5; }
.row-flag { background: #8b5cf61a; }
.row-actions { white-space: nowrap; display: flex; gap: 0.35rem; align-items: flex-start; }
.amount-pos { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-neg { color: var(--red); font-weight: 700; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; }

.admin-stats { display: flex; gap: 2.2rem; flex-wrap: wrap; }
.admin-kid-card h2 { color: var(--cyan); }

.form-grid fieldset { border: 1px solid var(--card-edge); border-radius: 10px; margin: 0 0 1rem; padding: 0.8rem 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem; }
.form-grid legend { font-weight: 800; padding: 0 0.4rem; }
.form-grid label, .form-row label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--ink-dim); font-weight: 600; }
.form-grid .hint { color: var(--gold); font-weight: 400; }
.form-row { display: flex; gap: 0.8rem; align-items: flex-end; flex-wrap: wrap; margin: 0.6rem 0; }
.form-row .check { flex-direction: row; align-items: center; gap: 0.4rem; }
.filter-row { margin: 1rem 0 0.6rem; }
.edit-details summary { list-style: none; }
.edit-details[open] { background: #0b1026; border-radius: 8px; padding: 0.5rem; }

code { background: #0b1026; border: 1px solid var(--card-edge); padding: 0.1rem 0.35rem; border-radius: 5px; font-size: 0.85em; }

/* ── footer ─────────────────────────────────────────────────────────────── */

.footer { text-align: center; padding: 1.6rem 0 2rem; }
.footer-mark { letter-spacing: 0.3em; font-weight: 800; color: var(--ink-dim); font-size: 0.85rem; }
.footer-tag { color: #4b5379; font-size: 0.78rem; margin-top: 0.35rem; }

/* ── confetti canvas ────────────────────────────────────────────────────── */

#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 99; }
