/* Star Service — gold on obsidian */
:root {
  --bg:         #0a0a0b;
  --bg-elev:    #111113;
  --bg-elev-2:  #16161a;
  --bg-elev-3:  #1c1c22;
  --border:     #26262d;
  --border-strong: #3a3a44;
  --text:       #f5f5f7;
  --text-muted: #a1a1aa;
  --text-dim:   #71717a;

  --gold:       #f5c542;
  --gold-soft:  #ffd76b;
  --gold-deep:  #c99a1e;
  --gold-dim:   rgba(245,197,66,.14);

  --silver:     #d9d9df;
  --silver-dim: #9b9ba3;

  --ok:   #22c55e;
  --warn: #f59e0b;
  --bad:  #ef4444;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow: 0 20px 60px -20px rgba(0,0,0,.7), 0 0 0 1px rgba(245,197,66,.03);
  --glow: 0 0 40px rgba(245,197,66,.18);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter", -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  background:
    radial-gradient(1200px 600px at 80% -100px, rgba(245,197,66,.08), transparent 50%),
    radial-gradient(900px 500px at 10% 100px, rgba(245,197,66,.04), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; transition: color .12s; }
a:hover { color: var(--gold); }

.container { max-width: 1200px; margin: 0 auto; padding-inline: clamp(16px, 3vw, 24px); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(10,10,11,.78);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 36px; width: auto; display: block; }
.nav-links { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-links a {
  padding: 7px 10px; border-radius: 999px;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--bg-elev-2); }
.nav-links a.active { color: var(--gold); background: var(--gold-dim); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.online-dot { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; padding: 4px 10px; background: var(--bg-elev); border-radius: 999px; border: 1px solid var(--border); }
.online-dot::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}
.who { color: var(--text-muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.who .me { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.nav .who { min-width: 0; max-width: 210px; flex-wrap: wrap; gap: 2px 8px; }
.nav .who .me { max-width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500; font-size: 14px;
  cursor: pointer; transition: all .15s ease;
  font-family: var(--font);
  text-decoration: none;
  max-width: 100%; text-align: center; overflow-wrap: anywhere;
}
.btn:hover { border-color: var(--border-strong); color: var(--text); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-soft) 0%, var(--gold) 50%, var(--gold-deep) 100%);
  color: #1a1400; border-color: transparent;
  font-weight: 600;
  box-shadow: 0 6px 20px -8px rgba(245,197,66,.6);
}
.btn-primary:hover { color: #1a1400; filter: brightness(1.08); box-shadow: 0 8px 24px -6px rgba(245,197,66,.8); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: transparent; border-color: rgba(239,68,68,.3); color: var(--bad); }
.btn-danger:hover { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.5); color: var(--bad); }
.btn-ok { background: transparent; border-color: rgba(34,197,94,.3); color: var(--ok); }
.btn-ok:hover { background: rgba(34,197,94,.1); color: var(--ok); }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 90px 0 110px;
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(58,58,68,.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58,58,68,.3) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: ''; position: absolute; top: -200px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,197,66,.14), transparent 60%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }
.hero .mark { height: 110px; margin-bottom: 24px; filter: drop-shadow(0 10px 40px rgba(245,197,66,.4)); }
.eyebrow {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.22em; color: var(--gold); text-transform: uppercase;
  margin-bottom: 20px;
  padding: 6px 14px; background: var(--gold-dim); border-radius: 999px;
  border: 1px solid rgba(245,197,66,.25);
}
.hero h1 {
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 800; letter-spacing: -0.035em; line-height: 1.02;
  margin: 0 0 20px;
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero p { color: var(--text-muted); font-size: 18px; max-width: 580px; margin: 0 auto 32px; }
.hero-cta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* Trust strip */
.trust {
  display: flex; justify-content: center; gap: 48px; margin-top: 56px;
  color: var(--text-dim); font-size: 13px; flex-wrap: wrap;
}
.trust .item { display: flex; align-items: center; gap: 8px; }
.trust .item strong { color: var(--text); font-weight: 600; }

/* ---------- Sections ---------- */
.section { padding-block: 80px; border-bottom: 1px solid var(--border); }
.section:last-of-type { border-bottom: none; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 36px; flex-wrap: wrap; gap: 16px; }
.section-head .label { font-size: 11px; letter-spacing: 0.18em; color: var(--gold); text-transform: uppercase; font-weight: 700; }
.section-head h2 { margin: 8px 0 0; font-size: 38px; letter-spacing: -0.025em; font-weight: 700; }
.section-head p { color: var(--text-muted); margin: 8px 0 0; font-size: 15px; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.grid > * { min-width: 0; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 2.4vw, 24px);
  min-width: 0;
  transition: border-color .18s ease;
}
.card, .product-card, .key-card, .review, .page-header, .flash { overflow-wrap: anywhere; }
.card h3 { margin-top: 0; letter-spacing: -0.01em; }
.card.stat { padding: 20px 24px; }
.card.stat .n { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0 0; }
.card.stat .lbl { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.card.stat .delta { color: var(--gold); font-size: 13px; margin-top: 4px; }

/* Product card */
.product-card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg-elev-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  transition: all .18s ease;
  display: flex; flex-direction: column;
}
.product-card:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: var(--shadow); }
.product-card .thumb {
  aspect-ratio: 16/10;
  background:
    linear-gradient(135deg, rgba(245,197,66,.08), rgba(0,0,0,.4)),
    radial-gradient(circle at 30% 30%, rgba(245,197,66,.3), transparent 60%),
    var(--bg-elev-3);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .thumb .ph { font-size: 72px; font-weight: 800; color: rgba(245,197,66,.3); letter-spacing: -0.04em; }
.product-card .state {
  position: absolute; top: 14px; left: 14px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; padding: 5px 10px; border-radius: 999px;
  background: rgba(34,197,94,.14); color: var(--ok); text-transform: uppercase;
  border: 1px solid rgba(34,197,94,.3); backdrop-filter: blur(8px);
}
.product-card .state.updating { background: rgba(245,158,11,.14); color: var(--warn); border-color: rgba(245,158,11,.3); }
.product-card .state.down { background: rgba(239,68,68,.14); color: var(--bad); border-color: rgba(239,68,68,.3); }
.product-card .body { padding: 20px 22px; }
.product-card .kicker { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.product-card h3 { font-size: 22px; margin: 4px 0 6px; letter-spacing: -0.02em; }
.product-card .tag { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; }
.product-card .price { color: var(--text-muted); font-size: 13px; }
.product-card .price strong { color: var(--gold); font-weight: 700; font-size: 16px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; background: var(--bg-elev-2); }
.table tr:hover td { background: rgba(255,255,255,.015); }
.table td code { background: var(--bg-elev-2); padding: 4px 8px; border-radius: 4px; font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.table-wrap {
  max-width: 100%; min-width: 0; overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev);
}
.table-wrap:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.table-wrap .table tbody tr:last-child > * { border-bottom: 0; }
.table-compact { font-size: 13px; }
.table-compact th, .table-compact td { padding: 10px clamp(5px, 1vw, 12px); }
.table-compact th { letter-spacing: .05em; }
.table .amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-date { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .transaction-time { color: var(--text-muted); white-space: nowrap; }
.table .credit-change { font-weight: 600; }
.credit-change.positive { color: var(--ok); }
.credit-change.negative { color: var(--bad); }
/* Actions column — td must stay table-cell; use an inner wrapper for flex. */
.table td.table-actions { white-space: nowrap; text-align: right; width: 1%; }
.table .actions-inner { display: inline-flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
/* Form inside a table cell should not add vertical margin */
.table form { display: inline-block; margin: 0; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.form input, .form select, .form textarea {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px;
  transition: border-color .12s;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.form .row { display: flex; gap: 12px; }
.form .row > * { flex: 1; min-width: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.inline-form > input:not([type=hidden]) { flex: 1 1 12rem; min-width: 0; }
.inline-form > .ss-select { flex: 1 1 8rem; min-width: 0; }
.inline-form select, .inline-form input {
  background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 6px; font-size: 13px; font-family: var(--font);
}

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: 0.06em; text-transform: uppercase; }
.badge-ok { background: rgba(34,197,94,.12); color: var(--ok); }
.badge-warn { background: rgba(245,158,11,.12); color: var(--warn); }
.badge-bad { background: rgba(239,68,68,.12); color: var(--bad); }
.badge-muted { background: var(--bg-elev-2); color: var(--text-muted); }
.badge-gold { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(245,197,66,.3); }
.badge-silver { background: rgba(217,217,223,.08); color: var(--silver); border: 1px solid rgba(217,217,223,.2); }

/* role chips */
.role-owner { background: linear-gradient(135deg, var(--gold-soft), var(--gold-deep)); color: #1a1400; padding: 3px 10px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.role-admin { background: var(--gold-dim); color: var(--gold); padding: 3px 10px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid rgba(245,197,66,.3); }
.role-reseller { background: rgba(34,197,94,.12); color: var(--ok); padding: 3px 10px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.role-user { background: var(--bg-elev-2); color: var(--text-muted); padding: 3px 10px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- Flash ---------- */
.flash { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.flash.ok { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.25); color: var(--ok); }
.flash.error { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25); color: var(--bad); }
.flash::before { content: ''; flex: 0 0 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Auth pages ---------- */
.auth {
  min-height: calc(100vh - 68px);
  display: grid; place-items: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
}
.auth-card .brand { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-card .brand img { height: auto; max-height: 48px; max-width: 100%; }
.auth-card h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.02em; text-align: center; }
.auth-card p.sub { color: var(--text-muted); font-size: 14px; margin: 0 0 28px; text-align: center; }
.auth-card .hint { color: var(--text-dim); font-size: 13px; margin-top: 20px; text-align: center; }
.auth-card .hint a { color: var(--gold); }

/* ---------- Reviews ---------- */
.review { padding: 22px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.review .head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.review .who { font-weight: 600; font-size: 14px; }
.review .when { color: var(--text-dim); font-size: 12px; }
.review .stars { color: var(--gold); font-size: 14px; letter-spacing: 2px; }
.review .body { color: var(--text-muted); font-size: 14px; line-height: 1.65; }
.review .tag { display: inline-block; margin-top: 12px; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

/* ---------- Status ---------- */
.status-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 20px; overflow-wrap: anywhere;
  padding: 16px clamp(14px, 2.4vw, 24px); border-bottom: 1px solid var(--border);
}
.status-row > :first-child { flex: 1 1 12rem; min-width: 0; }
.status-row:last-child { border-bottom: none; }
.status-row .pname { font-weight: 600; font-size: 15px; }
.status-row .pnote { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.status-row .pstate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status-row .pstate .dim { min-width: 88px; text-align: right; font-variant-numeric: tabular-nums; }
.state-dot { flex: 0 0 8px; height: 8px; border-radius: 50%; }
.state-dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.state-dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.state-dot.bad { background: var(--bad); box-shadow: 0 0 10px var(--bad); }

/* ---------- Footer ---------- */
.footer { padding: 48px 0 60px; color: var(--text-dim); font-size: 13px; border-top: 1px solid var(--border); margin-top: 60px; background: #050506; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 40px; margin-bottom: 36px; overflow-wrap: anywhere; }
.footer-grid h4 { color: var(--text); font-size: 12px; margin: 0 0 14px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.footer-grid a { display: block; color: var(--text-dim); padding: 4px 0; font-size: 13px; }
.footer-grid a:hover { color: var(--gold); }
.footer .brand-col img { display: block; width: auto; height: auto; max-width: 100%; max-height: 36px; margin-bottom: 14px; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 28px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }

/* ---------- Dashboard ---------- */
.page-header { padding-block: 56px 28px; }
.page-header .crumb { color: var(--gold); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; margin-bottom: 8px; }
.page-header h1 { font-size: 42px; margin: 0 0 8px; letter-spacing: -0.025em; font-weight: 700; }
.page-header p { color: var(--text-muted); margin: 0; font-size: 16px; }

.key-card {
  padding: 22px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); display: grid; gap: 14px;
  transition: border-color .15s;
}
.key-card:hover { border-color: var(--border-strong); }
.key-card .top { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; align-items: center; }
.key-card .product-name { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.key-str {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px;
  background: var(--bg-elev-2); padding: 11px 14px; border-radius: var(--radius-sm);
  overflow-wrap: anywhere; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border: 1px solid var(--border);
}
.key-str > span { min-width: 0; }
.key-str .copy-btn { flex-shrink: 0; }
.key-card .meta { display: flex; gap: 24px; flex-wrap: wrap; color: var(--text-muted); font-size: 13px; }
.key-card .meta div span { color: var(--text-dim); display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 2px; font-weight: 600; }
.key-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Admin tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 32px; overflow-x: auto; }
.tabs a {
  padding: 14px 20px; color: var(--text-muted);
  border-bottom: 2px solid transparent; font-size: 14px; font-weight: 500;
  white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--gold); border-color: var(--gold); }

.empty {
  text-align: center; padding: 56px 24px;
  color: var(--text-dim);
  border: 1px dashed var(--border); border-radius: var(--radius);
  font-size: 14px;
}

.copy-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  cursor: pointer; padding: 4px 10px; font-size: 11px; font-weight: 600;
  border-radius: 4px; text-transform: uppercase; letter-spacing: 0.06em;
  transition: all .12s;
}
.copy-btn:hover { color: var(--gold); border-color: var(--gold); }

/* mini form inside admin tables */
.mini-form { display: inline-flex; gap: 6px; align-items: center; }
.mini-form select, .mini-form input {
  background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text);
  padding: 5px 8px; border-radius: 5px; font-size: 12px; font-family: var(--font);
}

/* ---------- Mobile ---------- */
@media (max-width: 1199px) {
  .nav-inner.is-signed-in { flex-wrap: wrap; gap: 4px 12px; padding-block: 10px; }
  .is-signed-in .nav-links { order: 1; flex: 0 0 100%; }
}
@media (max-width: 820px) {
  .nav { position: static; }
  .nav-inner { flex-wrap: wrap; gap: 4px 12px; padding-block: 10px; }
  .nav-links { order: 1; flex: 0 0 100%; }
  .nav .online-dot { display: none; }
  .hero { padding: 60px 0 80px; }
  .hero .mark { height: 80px; }
  .section { padding-block: 56px; }
  .form .row { flex-direction: column; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
  .page-header h1 { font-size: 32px; }
}
@media (max-width: 480px) {
  .nav .brand img { height: 28px; }
  .nav-right .btn { padding-inline: 9px; }
  .nav-links a { font-size: 13px; }
  .section-head { margin-bottom: 24px; }
  .section-head h2 { font-size: 28px; line-height: 1.2; }
  .page-header { padding-top: 32px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card.stat { padding: 14px 16px; }
  .card.stat .n { font-size: 26px; }
  .status-row .pstate .dim { min-width: 0; text-align: left; }
}

/* ---------- Animations ---------- */
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
/* Flash slides in from the top */
.flash { animation: slide-in-right .35s ease both; }

/* Tabs active underline animated */
.tabs a { position: relative; transition: color .15s ease; }
.tabs a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--gold); transform: scaleX(0); transform-origin: center;
  transition: transform .25s ease;
}
.tabs a.active::after { transform: scaleX(1); }
.tabs a:hover::after { transform: scaleX(.4); }

/* Product card: smooth lift with gold edge glow */
.product-card { transition: transform .25s cubic-bezier(.2,.8,.2,1), border-color .25s, box-shadow .25s; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 20px 50px -20px rgba(245,197,66,.25), 0 0 0 1px rgba(245,197,66,.4); }
.product-card .thumb { transition: transform .5s ease; }
.product-card:hover .thumb { transform: scale(1.03); }

/* Key card hover */
.key-card { transition: transform .2s ease, border-color .2s, box-shadow .2s; }
.key-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); }

/* Button press micro */
.btn { transition: transform .08s ease, background .15s, border-color .15s, color .15s, box-shadow .2s; }
.btn:active { transform: scale(.97); }

/* Spinner (for inline loading states) */
.spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: currentColor; border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Submitting state */
form.submitting { pointer-events: none; opacity: .75; }
form.submitting button { position: relative; }

/* Smooth scroll */
html { scroll-behavior: smooth; }

/* Reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* small utilities */
.hstack { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.vstack { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.mono { font-family: ui-monospace, Menlo, monospace; }
.hidden { display: none; }
small { color: var(--text-dim); font-size: 12px; }

/* Checkout mini */
.price-tier { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elev-2); cursor: pointer; transition: border-color .12s; }
.price-tier:hover { border-color: var(--gold); }
.price-tier .lbl { font-weight: 600; }
.price-tier .pop { font-size: 10px; background: var(--gold-dim); color: var(--gold); padding: 2px 8px; border-radius: 999px; margin-left: 8px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.price-tier .amt { color: var(--gold); font-weight: 700; }

/* ---------- Custom select (replaces browser <select>) ---------- */
/* Hide the real <select> but keep it in the DOM for submission/accessibility. */
select.ss-upgraded {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  margin: -1px !important; padding: 0 !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important;
  white-space: nowrap !important; border: 0 !important;
}
.ss-select {
  position: relative;
  display: block;
  width: 100%;
  font-family: var(--font);
}
.ss-select-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 38px 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: border-color .12s, box-shadow .12s;
  font-family: var(--font);
}
.ss-select-btn:hover { border-color: var(--border-strong); }
.ss-select-btn:focus-visible,
.ss-select.open .ss-select-btn {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.ss-select-btn .ss-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-select-btn .ss-value.placeholder { color: var(--text-dim); }
.ss-select-btn::after {
  content: '';
  position: absolute; right: 14px; top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .15s ease;
  pointer-events: none;
}
.ss-select.open .ss-select-btn::after { transform: translateY(-30%) rotate(-135deg); border-color: var(--gold); }
.ss-select-btn.mini { padding: 6px 28px 6px 10px; font-size: 12px; border-radius: 5px; }
.ss-select-btn.mini::after { right: 10px; width: 6px; height: 6px; }

.ss-select-panel {
  position: absolute; z-index: 60;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 40px -10px rgba(0,0,0,.7), 0 0 0 1px rgba(245,197,66,.04);
  padding: 6px;
  max-height: 260px; overflow-y: auto;
  transform-origin: top;
  animation: ss-panel-in .14s ease;
}
@keyframes ss-panel-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ss-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 5px;
  color: var(--text); font-size: 14px;
  cursor: pointer; user-select: none;
  transition: background .08s;
}
.ss-opt:hover, .ss-opt.active { background: var(--bg-elev-2); }
.ss-opt.selected { color: var(--gold); font-weight: 600; }
.ss-opt.selected::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex-shrink: 0;
}
.ss-opt:not(.selected)::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: transparent; flex-shrink: 0;
}

/* Inside the admin mini-forms (small variant) */
.mini-form .ss-select-btn { padding: 5px 24px 5px 8px; font-size: 12px; border-radius: 5px; }
.mini-form .ss-select-btn::after { right: 8px; width: 6px; height: 6px; }
.mini-form .ss-select { width: auto; min-width: 100px; }

/* ---------- Custom modal (replaces browser confirm/alert) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 5, 7, 0.75);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 16px; overflow-y: auto;
  opacity: 0;
  animation: modal-fade-in .18s ease forwards;
}
@keyframes modal-fade-in { to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 420px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 22px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.85), 0 0 0 1px rgba(245,197,66,.06);
  transform: translateY(14px) scale(.97);
  animation: modal-rise .22s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes modal-rise { to { transform: translateY(0) scale(1); } }
.modal-card .modal-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--gold-dim); color: var(--gold);
  margin-bottom: 16px;
  font-weight: 800; font-size: 22px;
}
.modal-card.danger .modal-icon { background: rgba(239,68,68,.12); color: var(--bad); }
.modal-card .modal-title { font-size: 18px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.015em; }
.modal-card .modal-body { color: var(--text-muted); font-size: 14px; line-height: 1.55; margin: 0 0 22px; }
.modal-card { overflow-wrap: anywhere; }
.modal-card .modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.modal-card .modal-actions .btn { min-width: 92px; }

/* ---------- Toasts (post-action feedback) ---------- */
#star-toasts {
  position: fixed; inset: 16px 16px auto; z-index: 110;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.star-toast {
  min-width: min(100%, 260px); max-width: min(100%, 380px);
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.6);
  display: flex; align-items: center; gap: 10px;
  pointer-events: auto;
  transform: translateX(30px); opacity: 0;
  animation: toast-in .25s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes toast-in { to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateX(30px); opacity: 0; } }
.star-toast.out { animation: toast-out .2s ease forwards; }
.star-toast::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.star-toast.ok { border-color: rgba(34,197,94,.3); color: var(--ok); }
.star-toast.error { border-color: rgba(239,68,68,.3); color: var(--bad); }
.star-toast .msg { color: var(--text); flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Reseller shop */
.shop-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr)); }
.shop-card { container-type: inline-size; }
.shop-card .shop-heading { justify-content: space-between; }
.shop-tier {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 7ch) minmax(0, 94px);
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .12s;
}
.shop-tier:hover { border-color: var(--border-strong); }
.shop-tier.affordable:hover { border-color: var(--gold); }
.shop-tier .st-label { font-weight: 600; font-size: 14px; }
.shop-tier .st-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.shop-tier .st-price { color: var(--gold); font-weight: 700; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.shop-tier .st-btn { width: 100%; min-height: 32px; padding-inline: 6px; }
.shop-tier .st-btn:disabled { opacity: 1; color: var(--text-muted); background: transparent; }
@container (max-width: 265px) {
  .shop-tier { grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
  .shop-tier .st-btn { grid-column: 1 / -1; }
}
