/* BOZON.PRO — Shared components
 * Depends on tokens.css.
 * Screen-specific styles live in css/photo.css, css/video.css, etc.
 */

/* ─── Base reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

/* ─── Utilities ───────────────────────────────────────────────────────── */
.muted { color: var(--text-mut); }
.small { font-size: 12px; }
.num   { font-family: 'JetBrains Mono', ui-monospace, monospace; font-feature-settings: 'tnum' 1, 'lnum' 1; }
.dotsep { width: 2px; height: 2px; border-radius: 50%; background: currentColor; opacity: 0.4; }
.icon  { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ─── Root grid (sidebar + main) ──────────────────────────────────────── */
.root {
  display: grid;
  grid-template-columns: auto 1fr;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
}

/* Heading style switch (serif / sans) */
.root.h-sans  h1, .root.h-sans  h2, .root.h-sans  h3 { font-family: 'Inter', sans-serif; letter-spacing: -0.01em; }
.root.h-serif h1, .root.h-serif h2, .root.h-serif h3 { font-family: 'Newsreader', 'Source Serif Pro', Georgia, serif; letter-spacing: -0.005em; font-weight: 500; }

/* ─── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  transition: width 200ms cubic-bezier(.4, 0, .2, 1);
  position: relative;
}
.sidebar.is-collapsed { width: 64px; }
.sidebar__logo {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 18px;
}
.logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  flex-shrink: 0;
}
.logo-word {
  font-family: 'Newsreader', serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--text);
}
.sidebar__nav { flex: 1; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.sidebar.is-collapsed .sidebar__nav { gap: 8px; }
.sidebar__group { display: flex; flex-direction: column; gap: 1px; }
.sidebar__hd {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 10px 4px;
}
.navitem {
  display: flex; align-items: center; gap: 11px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-mut);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background 120ms, color 120ms;
  width: 100%;
  text-align: left;
}
.navitem:hover { background: var(--bg-sunken); color: var(--text); }
.navitem.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.navitem.is-active:hover { background: var(--accent-soft); color: var(--accent); }
.navitem.is-soon { color: var(--text-dim); cursor: not-allowed; }
.navitem.is-soon:hover { background: transparent; color: var(--text-dim); }
.navitem__icon { display: grid; place-items: center; width: 18px; height: 18px; flex-shrink: 0; }
.navitem__lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sidebar.is-collapsed .navitem { padding: 0; justify-content: center; }
.sidebar.is-collapsed .navitem__lbl,
.sidebar.is-collapsed .navitem .chip,
.sidebar.is-collapsed .logo-word,
.sidebar.is-collapsed .sidebar__hd { display: none; }
.sidebar__foot {
  border-top: 1px solid var(--border-soft);
  padding-top: 8px;
  display: flex; flex-direction: column; gap: 1px;
}

/* ─── Chips ───────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip--soft  { background: var(--bg-sunken);   color: var(--text-mut); }
.chip--brand { background: var(--accent-soft); color: var(--accent); }

/* ─── Main column ─────────────────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ─── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  height: 56px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
}
.topbar__search {
  flex: 1;
  max-width: 520px;
  height: 36px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 8px;
  color: var(--text-mut);
  transition: border-color 120ms;
}
.topbar__search:focus-within { border-color: var(--accent); }
.topbar__search input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 13px; color: var(--text);
}
.topbar__search input::placeholder { color: var(--text-dim); }
.topbar__search kbd {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  background: var(--bg-sunken);
}
.topbar__right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.iconbtn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--text-mut);
  transition: background 120ms, color 120ms;
  position: relative;
}
.iconbtn:hover { background: var(--bg-sunken); color: var(--text); }
.iconbtn .dot {
  position: absolute; top: 9px; right: 9px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}
.iconbtn--xs { width: 22px; height: 22px; border-radius: 5px; }

.userchip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  margin-left: 4px;
  transition: background 120ms;
}
.userchip:hover { background: var(--bg-sunken); }
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.userchip__meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.userchip__name {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  max-width: 180px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.userchip__sub { font-size: 11px; color: var(--text-mut); }

/* ─── Content scroll container ────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px 60px;
  display: flex; flex-direction: column;
  gap: 28px;
}

/* ─── Page header ─────────────────────────────────────────────────────── */
.page-hd {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.page-eyebrow {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mut);
  text-transform: lowercase;
  margin-bottom: 6px;
  font-variant: small-caps;
  letter-spacing: 0.04em;
}
.page-title {
  font-size: 32px;
  margin: 0 0 6px;
  font-weight: 500;
  line-height: 1.15;
}
.root.h-sans .page-title { font-weight: 600; font-size: 28px; }
.page-sub { color: var(--text-mut); font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; }

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms, border-color 120ms, color 120ms, filter 120ms;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}
.btn:disabled { cursor: not-allowed; }
.btn--sm    { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn--lg    { height: 44px; padding: 0 20px; font-size: 14px; font-weight: 600; }
.btn--block { width: 100%; justify-content: center; }
.btn--ghost {
  border-color: var(--border);
  background: var(--bg-elev);
  color: var(--text);
}
.btn--ghost:hover { background: var(--bg-sunken); }
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover { filter: brightness(0.95); }
.btn--primary:disabled {
  background: var(--bg-sunken);
  color: var(--text-dim);
  filter: none;
}

.textbtn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-mut);
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  border: 0;
}
.textbtn:hover { color: var(--text); background: var(--bg-sunken); }

/* ─── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--pad);
  display: flex; flex-direction: column;
}
.card__hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card__title { font-size: 16px; margin: 0; font-weight: 500; }
.root.h-sans .card__title { font-weight: 600; font-size: 15px; }
.card__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; margin-top: auto;
  border-top: 1px solid var(--border-soft);
}

/* ─── Section header ──────────────────────────────────────────────────── */
.section { display: flex; flex-direction: column; gap: 12px; }
.section__hd { display: flex; align-items: center; justify-content: space-between; }
.section__title { font-size: 18px; margin: 0; font-weight: 500; }
.root.h-sans .section__title { font-weight: 600; font-size: 16px; }

/* ─── Flash messages (auth/dashboard) ─────────────────────────────────── */
.flash {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 16px;
}
.flash-error   { background: color-mix(in oklch, var(--danger) 8%, transparent);  color: var(--danger);  border-color: color-mix(in oklch, var(--danger) 18%, transparent); }
.flash-success { background: color-mix(in oklch, var(--success) 8%, transparent); color: var(--success); border-color: color-mix(in oklch, var(--success) 18%, transparent); }

/* ─── Scrollbar ───────────────────────────────────────────────────────── */
.content::-webkit-scrollbar,
.sidebar__nav::-webkit-scrollbar { width: 10px; }
.content::-webkit-scrollbar-track,
.sidebar__nav::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb,
.sidebar__nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 3px solid var(--bg);
}
.content::-webkit-scrollbar-thumb:hover,
.sidebar__nav::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ═══════════════════════════════════════════════════════════════════════
 * DASHBOARD — hero, stats, modules grid, activity rows, pricing
 * ═══════════════════════════════════════════════════════════════════════ */

/* ─── Hero (balance + stats) ──────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: var(--gap);
}
@media (max-width: 980px) { .hero { grid-template-columns: 1fr; } }

.hero__balance {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--pad-lg);
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
  overflow: hidden;
}
.hero__balance::before {
  content: '';
  position: absolute;
  inset: -40% -20% auto auto;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--accent-soft), transparent 60%);
  pointer-events: none;
}
.hero__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mut);
}
.hero__num {
  display: flex; align-items: baseline; gap: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-feature-settings: 'tnum' 1;
}
.hero__big { font-size: 44px; font-weight: 500; line-height: 1; letter-spacing: -0.02em; color: var(--text); }
.hero__unit { font-size: 16px; color: var(--text-mut); font-weight: 500; }
.hero__hint { font-size: 12.5px; color: var(--text-mut); }
.hero__bar {
  height: 4px;
  background: var(--bg-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.hero__bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.hero__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }

/* ─── Stats grid ──────────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap);
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--pad);
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color 120ms;
}
.stat:hover { border-color: var(--border); }
.stat__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stat__icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--bg-sunken);
  display: grid; place-items: center;
  color: var(--text-mut);
}
.stat__delta {
  font-size: 11.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px;
}
.stat__delta--up { color: var(--success); background: color-mix(in oklch, var(--success) 12%, transparent); }
.stat__delta--down { color: var(--danger);  background: color-mix(in oklch, var(--danger) 12%, transparent); }
.stat__delta--neutral { color: var(--text-mut); background: var(--bg-sunken); }
.stat__value {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-feature-settings: 'tnum' 1;
  font-size: 24px; font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}
.stat__label { font-size: 12px; color: var(--text-mut); }

/* ─── Modules grid ────────────────────────────────────────────────────── */
.modgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
}
.modcard {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--pad);
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 150ms, transform 150ms, box-shadow 150ms;
  cursor: pointer;
  min-height: 148px;
  text-decoration: none;
  color: inherit;
}
.modcard:hover:not(.is-soon) {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: inherit;
}
.modcard.is-soon { cursor: default; opacity: 0.78; }
.modcard__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modcard__icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.modcard.is-soon .modcard__icon { background: var(--bg-sunken); color: var(--text-mut); }
.modcard__title { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 4px; }
.modcard__desc { font-size: 12.5px; color: var(--text-mut); flex: 1; }
.modcard__foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px dashed var(--border-soft);
  padding-top: 10px;
  margin-top: 6px;
}
.modcard__cost {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; font-weight: 500;
  color: var(--text);
}

/* ─── Two-column section ──────────────────────────────────────────────── */
.twocol {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--gap);
}
@media (max-width: 1100px) { .twocol { grid-template-columns: 1fr; } }

/* ─── Activity list ───────────────────────────────────────────────────── */
.actlist { display: flex; flex-direction: column; }
.actrow {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  height: var(--row-h);
  padding: 0 6px;
  border-radius: 8px;
  border-bottom: 1px solid var(--border-soft);
  transition: background 120ms;
}
.actrow:last-child { border-bottom: 0; }
.actrow:hover { background: var(--bg-sunken); }
.actrow__thumb {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: grid; place-items: center;
  background: var(--bg-sunken);
  color: var(--text-mut);
}
.actrow__thumb--photo { background: color-mix(in oklch, var(--accent) 14%, transparent); color: var(--accent); }
.actrow__thumb--video { background: var(--bg-sunken); color: var(--text); }
.actrow__main { min-width: 0; }
.actrow__title {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.actrow__meta { font-size: 11.5px; color: var(--text-mut); display: flex; align-items: center; gap: 6px; }
.actrow__cost {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; font-weight: 500;
  color: var(--text-mut);
}
.actrow__status {
  display: flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
}
.actrow__status--done { color: var(--success); background: color-mix(in oklch, var(--success) 12%, transparent); }
.actrow__status--fail { color: var(--danger);  background: color-mix(in oklch, var(--danger)  14%, transparent); }

/* ─── Pricing list ────────────────────────────────────────────────────── */
.pricing { display: flex; flex-direction: column; gap: 1px; margin-bottom: 8px; }
.priceitem {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border-soft);
}
.priceitem:last-child { border-bottom: 0; }
.priceitem.is-hl {
  background: var(--accent-soft);
  border-radius: 8px;
  padding-left: 10px; padding-right: 10px;
  border-bottom: 0;
}
.priceitem__main { display: flex; flex-direction: column; gap: 1px; }
.priceitem__lbl { font-size: 13px; font-weight: 500; color: var(--text); }
.priceitem__model {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-mut);
}
.priceitem__cost {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.priceitem.is-hl .priceitem__cost { color: var(--accent); font-weight: 600; }

/* ─── Bare shell (auth pages: login, register, verify) ───────────────── */
.root.root--bare {
  display: block;
  grid-template-columns: none;
}
.root.root--bare .main {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}
.root.root--bare .content {
  max-width: 480px;
  margin: 0 auto;
  padding: 60px 24px;
}

/* ─── Alpine.js cloak (hide x-cloak elements until Alpine initialises) ── */
[x-cloak] { display: none !important; }

/* ─── Segmented control (theme/density/headings toggles, model FAST/PRO) ─ */
.seg {
  display: inline-flex;
  background: var(--bg-sunken);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.seg__opt {
  height: 26px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-mut);
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
  transition: background 120ms, color 120ms;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.seg__opt:hover { color: var(--text); }
.seg__opt.is-on {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ─── Settings popover (theme · accent · density · headings) ─────────── */
.settings-trigger {
  position: relative;
}

.iconbtn.is-on {
  background: var(--bg-sunken);
  color: var(--text);
}

.settings-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-row__lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mut);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.settings-swatches {
  display: flex;
  gap: 8px;
}

.settings-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform 120ms, border-color 120ms;
}
.settings-swatch:hover { transform: translateY(-1px); }
.settings-swatch.is-on { border-color: var(--text); }
.settings-swatch.is-on::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.settings-swatch--ochra  { background: #C96442; }
.settings-swatch--forest { background: #5A7A5B; }
.settings-swatch--slate  { background: #3F4A57; }

.settings-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--border-soft);
}

/* ─── Responsive (mobile fallback) ────────────────────────────────────── */
@media (max-width: 760px) {
  .sidebar { display: none; }
  .root { grid-template-columns: 1fr; }
  .content { padding: 20px; }
  .page-title { font-size: 24px !important; }
}
