:root {
  --ink: #08090d;
  --ink-2: #0e1016;
  --panel: #13151d;
  --panel-2: #191c26;
  --line: rgba(244, 228, 188, 0.1);
  --line-strong: rgba(232, 195, 106, 0.28);
  --gold: #e8c36a;
  --gold-2: #f6e2a4;
  --gold-dim: rgba(232, 195, 106, 0.12);
  --cream: #f4efe6;
  --muted: #9a917f;
  --red: #e3350d;
  --go: #3ddc97;
  --warn: #f0b429;
  --bad: #ff5d6c;
  --info: #6cb6ff;
  --cyan: #5ce1e6;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --font: "Figtree", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Figtree", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --rail: 268px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--ink);
  color: var(--cream);
  letter-spacing: -0.01em;
  overflow: hidden;
  touch-action: pan-y;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(232, 195, 106, 0.14), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(227, 53, 13, 0.08), transparent 50%),
    radial-gradient(600px 400px at 80% 100%, rgba(92, 225, 230, 0.05), transparent 45%);
  z-index: 0;
}

#app {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ——— Rail ——— */
.rail {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(19, 21, 29, 0.92), rgba(8, 9, 13, 0.96));
  backdrop-filter: blur(18px);
  padding: 22px 18px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 18px;
}
.mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    conic-gradient(from 210deg, #e3350d, #f4efe6 38%, #e8c36a 62%, #e3350d);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 1px rgba(232, 195, 106, 0.35), 0 10px 30px rgba(227, 53, 13, 0.25);
  position: relative;
}
.mark::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 3px #f4efe6, 0 0 0 5px var(--gold);
}
.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.countdown {
  margin: 4px 6px 18px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(232, 195, 106, 0.1), rgba(232, 195, 106, 0.03));
}
.countdown .kicker {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.countdown .big {
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 2px 0 4px;
  background: linear-gradient(180deg, #fff6d6, #e8c36a 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.countdown .sub { color: var(--muted); font-size: 0.78rem; }
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-2);
  background: var(--gold-dim);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 9px;
}
.mode-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(232, 195, 106, 0.15);
  animation: pulse 1.8s ease-out infinite;
}

nav.menu { display: flex; flex-direction: column; gap: 4px; overflow: auto; min-height: 0; }
nav.menu button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font: inherit;
  font-weight: 560;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: 0.18s ease;
}
nav.menu button:hover { background: rgba(244, 239, 230, 0.04); color: var(--cream); }
nav.menu button.active {
  background: linear-gradient(90deg, rgba(232, 195, 106, 0.16), transparent);
  color: var(--cream);
  box-shadow: inset 2px 0 0 var(--gold);
}
nav.menu .count {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--gold);
  background: var(--gold-dim);
  padding: 2px 7px;
  border-radius: 999px;
}

.rail-foot {
  margin-top: auto;
  padding: 14px 8px 4px;
  color: var(--muted);
  font-size: 0.75rem;
}
.health {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.health .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--go);
  box-shadow: 0 0 12px var(--go);
}
.health.watch .dot { background: var(--warn); box-shadow: 0 0 12px var(--warn); }
.health.off .dot { background: var(--bad); box-shadow: 0 0 12px var(--bad); }

/* ——— Stage ——— */
.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 9, 13, 0.55);
  backdrop-filter: blur(16px);
}
.search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.search input {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--cream);
  padding: 0 14px 0 38px;
  font: inherit;
  outline: none;
}
.search input:focus { border-color: var(--line-strong); }
.search svg {
  position: absolute;
  left: 12px;
  top: 11px;
  opacity: 0.55;
}
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.btn, .icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--cream);
  font: inherit;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.15s ease;
}
.btn { padding: 9px 14px; }
.btn:hover, .icon-btn:hover { border-color: var(--line-strong); background: #1f2330; }
.btn.gold {
  background: linear-gradient(180deg, #f3d78a, #d7a63a);
  color: #1a1408;
  border-color: transparent;
}
.btn.gold:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}
.live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 6px;
}
.live b { color: var(--go); font-weight: 700; }

.views {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 195, 106, 0.35) transparent;
}
.view { display: none; animation: fade 0.28s ease; }
.view.active { display: block; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}
.section-head p { margin: 4px 0 0; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 11px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.chip.on, .chip:hover { color: var(--cream); border-color: var(--line-strong); background: var(--gold-dim); }

/* ——— Dashboard ——— */
.dash {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 18px;
  align-items: start;
}
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(120% 90% at 90% -10%, rgba(227, 53, 13, 0.22), transparent 50%),
    linear-gradient(160deg, #1a140c, #0e1018 55%);
  padding: 26px 26px 22px;
  min-height: 210px;
}
.hero h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(1.6rem, 2.4vw, 2.35rem);
  letter-spacing: -0.045em;
  max-width: 16ch;
}
.hero p { margin: 0; color: #cfc3a8; max-width: 46ch; line-height: 1.5; }
.hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.orb {
  position: absolute;
  right: -30px;
  top: -40px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, #fff6d6, #e8c36a 32%, #e3350d 58%, transparent 62%);
  opacity: 0.55;
  filter: blur(2px);
  animation: spin 28s linear infinite;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}
.kpi span { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; }
.kpi strong {
  display: block;
  margin-top: 6px;
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card h3 {
  margin: 0 0 12px;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.hunt-list { display: flex; flex-direction: column; gap: 10px; }
.hunt-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  cursor: pointer;
}
.hunt-row:hover { border-color: var(--line-strong); }
.thumb {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  color: #1a1408;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.thumb img,
.product-art img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-position: center;
  z-index: 0;
}
.thumb img { object-fit: cover; }
.product-art img { object-fit: contain; }
.thumb small {
  position: absolute;
  bottom: 4px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  opacity: 0.8;
}
.hunt-row b { display: block; font-size: 0.95rem; }
.hunt-row .meta { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 5px 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.go { background: rgba(61, 220, 151, 0.12); color: var(--go); }
.badge.info { background: rgba(108, 182, 255, 0.12); color: var(--info); }
.badge.warn { background: rgba(240, 180, 41, 0.12); color: var(--warn); }
.badge.bad { background: rgba(255, 93, 108, 0.12); color: var(--bad); }
.badge.mute { background: rgba(154, 145, 127, 0.12); color: var(--muted); }

.feed { display: flex; flex-direction: column; gap: 10px; max-height: 620px; overflow: auto; }
.event {
  padding: 12px;
  border-radius: 16px;
  background: var(--ink-2);
  border: 1px solid var(--line);
}
.event.P0 { border-color: rgba(227, 53, 13, 0.45); box-shadow: inset 3px 0 0 var(--red); }
.event.P1 { box-shadow: inset 3px 0 0 var(--gold); }
.event header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.event h4 { margin: 6px 0 4px; font-size: 0.95rem; }
.event p { margin: 0; color: #c9c0b0; font-size: 0.84rem; line-height: 1.45; }
.event footer {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.matrix-wrap { overflow: auto; margin-top: 18px; }
table.matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1360px;
}
.matrix th, .matrix td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  text-align: center;
}
.matrix th { color: var(--muted); font-weight: 650; }
.matrix td:first-child, .matrix th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--ink-2);
  min-width: 190px;
}
.cell {
  display: inline-flex;
  min-width: 78px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 7px;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

/* ——— Products ——— */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.product {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
  transition: 0.18s ease;
  display: flex;
  flex-direction: column;
}
.product:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.product-art {
  height: 200px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  overflow: hidden;
}
.product-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(8, 9, 13, 0.55));
}
.product-art .wave {
  position: relative;
  z-index: 1;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #1a1408;
  background: rgba(255, 246, 214, 0.85);
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 800;
}
.star {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(8, 9, 13, 0.45);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}
.star.on { color: var(--gold); }
.product-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.product-body h3 { margin: 0 0 6px; font-size: 1.05rem; letter-spacing: -0.03em; }
.product-body .row { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem; }
.offers-mini { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* ——— Calendar ——— */
.timeline { display: flex; flex-direction: column; gap: 16px; }
.wave-block {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
}
.wave-block .date {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}
.wave-block .soon { color: var(--gold); font-size: 0.78rem; margin-top: 6px; }

/* ——— Shops / sources ——— */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  align-items: center;
}
.list-item h3 { margin: 0 0 4px; font-size: 1rem; }
.list-item p { margin: 0; color: var(--muted); font-size: 0.84rem; }

/* ——— Settings ——— */
.form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}
.field label { color: var(--muted); }
.field input, .field select, .field textarea {
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: var(--cream);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}
.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.toggle:last-child { border: 0; }

/* ——— Drawer ——— */
.drawer-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 20;
}
.drawer-bg.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(460px, 100%);
  background: #11131a;
  border-left: 1px solid var(--line-strong);
  transform: translateX(100%);
  transition: 0.28s cubic-bezier(.2,.8,.2,1);
  z-index: 21;
  overflow: auto;
  padding: 22px;
}
.drawer.on { transform: none; }

/* ——— Onboarding ——— */
.ob-bg {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 10, 0.82);
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.ob {
  width: min(720px, 100%);
  background: #14161e;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.ob h2 { font-family: var(--display); margin: 0 0 8px; font-size: 1.8rem; letter-spacing: -0.04em; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 16px 0 20px; }
.pick {
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--cream);
  border-radius: 14px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.pick.on { border-color: var(--gold); background: var(--gold-dim); }

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
}
.toast {
  min-width: 280px;
  max-width: 360px;
  background: #1a130f;
  border: 1px solid rgba(227, 53, 13, 0.5);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.toast.p0 { border-color: var(--bad); }
.toast b { display: block; margin-bottom: 4px; }

.push-nudge {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(640px, calc(100vw - 32px));
  background: #1a130f;
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 10px 12px 10px 16px;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
}

.empty { color: var(--muted); padding: 24px; text-align: center; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 195, 106, 0.45); }
  100% { box-shadow: 0 0 0 10px transparent; }
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

.mobile-nav { display: none; }

@media (max-width: 1080px) {
  :root { --rail: 0px; }
  html, body {
    height: auto;
    min-height: 100%;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .rail { display: none; }
  #app {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  .stage { min-height: 0; }
  .dash, .kpis, .wave-block { grid-template-columns: 1fr; }
  .topbar {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 8;
  }
  .top-actions .live { display: none; }
  .search { max-width: none; }
  .views {
    overflow: visible;
    flex: none;
    min-height: 0;
    padding: 16px 14px calc(96px + env(safe-area-inset-bottom, 0px));
  }
  .feed { max-height: none; overflow: visible; }
  .ob {
    margin: auto 0;
  }
  .drawer {
    height: 100dvh;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-nav {
    display: flex;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    background: rgba(19, 21, 29, 0.92);
    border: 1px solid var(--line);
    border-radius: 18px;
    backdrop-filter: blur(16px);
    z-index: 15;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-nav button {
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 12px 8px;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
  }
  .mobile-nav button.active { color: var(--gold); }
  .toasts { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); right: 12px; left: 12px; }
  .toast { max-width: none; min-width: 0; }
}
