/* ==========================================================================
   Fun3ds — design tokens
   Palette: workshop pegboard, not SaaS card kit.
   ink navy background, warm paper panels, hot-end orange accent,
   mint "ready" accent for success/stock states.
   ========================================================================== */

:root {
  --ink: #12161d;
  --ink-raised: #1b212b;
  --line: #2a3240;
  --paper: #f1efe9;
  --paper-dim: #d9d6cc;
  --text: #e9e8e3;
  --text-dim: #9aa3af;
  --text-on-paper: #14161a;
  --heat: #ff6a35;
  --heat-dim: #c94f22;
  --mint: #37c98d;
  --danger: #e0503b;

  --font-display: 'Space Grotesk', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-tag: 'IBM Plex Mono', 'Courier New', monospace;

  --radius-s: 6px;
  --radius-m: 10px;
  --max-w: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(18, 22, 29, 0.92);
  backdrop-filter: blur(8px);
  z-index: 40;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--heat); display: inline-block; }

.nav-links { display: flex; align-items: center; gap: 28px; font-size: 15px; }
.nav-links a { text-decoration: none; color: var(--text-dim); transition: color .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--text-dim); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--heat);
  border-color: var(--heat);
  color: #1a0d05;
}
.btn-primary:hover { background: var(--heat-dim); border-color: var(--heat-dim); }
.btn-primary:disabled { background: var(--paper-dim); border-color: var(--paper-dim); color: #6b6b66; cursor: not-allowed; }

.btn-ghost { border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); }

.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(224,80,59,.12); }

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  max-width: 16ch;
}
.hero p { color: var(--text-dim); max-width: 52ch; font-size: 17px; margin: 0 0 22px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.status-strip {
  margin-top: 36px;
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
}
.status-cell {
  flex: 1;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}
.status-cell:last-child { border-right: none; }
.status-cell .num { font-family: var(--font-tag); font-size: 22px; color: var(--mint); }
.status-cell .label { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

/* ---------- Product grid ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 48px 0 20px;
}
.section-head h2 { font-family: var(--font-display); font-size: 24px; margin: 0; }
.section-head .sub { color: var(--text-dim); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding-bottom: 64px;
}

.card {
  background: var(--paper);
  color: var(--text-on-paper);
  border-radius: var(--radius-m);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card .thumb {
  aspect-ratio: 1 / 1;
  background: var(--paper-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 15.5px; margin: 0; font-weight: 600; }
.card-body .desc { font-size: 13px; color: #57584f; flex: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.price-tag { font-family: var(--font-tag); font-size: 16px; }
.stock { font-size: 12px; color: #6a6c60; }
.stock.low { color: var(--heat-dim); }
.stock.out { color: var(--danger); }

/* ---------- Forms ---------- */
.panel {
  background: var(--ink-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 28px;
}

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13.5px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-s);
  font-family: var(--font-body);
  font-size: 14.5px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--heat);
  outline-offset: 1px;
}
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 5px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--line); cursor: pointer;
}
.swatch.selected { border-color: var(--heat); box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--heat); }

.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tabbar button {
  background: none; border: none; color: var(--text-dim);
  font-family: var(--font-body); font-size: 14.5px; font-weight: 600;
  padding: 12px 4px; margin-right: 24px; cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tabbar button.active { color: var(--text); border-bottom-color: var(--heat); }

.mode-toggle { display: flex; gap: 10px; margin-bottom: 22px; }
.mode-toggle button {
  flex: 1;
  padding: 16px;
  text-align: left;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
}
.mode-toggle button strong { display: block; font-size: 15px; margin-bottom: 3px; }
.mode-toggle button span { font-size: 12.5px; color: var(--text-dim); }
.mode-toggle button.active { border-color: var(--heat); background: rgba(255,106,53,.08); }

/* ---------- Admin ---------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  text-align: left; font-size: 12px; letter-spacing: .02em; color: var(--text-dim);
  border-bottom: 1px solid var(--line); padding: 10px 10px;
}
.admin-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table tr:hover td { background: rgba(255,255,255,.02); }

.badge {
  display: inline-block; font-size: 11.5px; font-family: var(--font-tag);
  padding: 2px 8px; border-radius: 100px; border: 1px solid var(--line);
}
.badge.paid, .badge.accepted { color: var(--mint); border-color: var(--mint); }
.badge.pending { color: var(--heat); border-color: var(--heat); }
.badge.declined, .badge.failed { color: var(--danger); border-color: var(--danger); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--ink-raised);
  border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 12px 16px; font-size: 14px; z-index: 200; max-width: 320px;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--mint); color: var(--mint); }

.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--text-dim); font-size: 13px; }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .status-strip { flex-direction: column; }
  .status-cell { border-right: none; border-bottom: 1px solid var(--line); }
}
