/* ───────────────────────────────────────────────────
   TIRED · STUDIO — shared chrome + primitives
   Used by studio.html (the SPA) and any studio-embedded page.
   Sits on top of colors_and_type.css + components.css.
   ─────────────────────────────────────────────────── */

:root {
  --studio-sidebar: 240px;
  --studio-topbar: 56px;
}

body.studio {
  display: grid;
  grid-template-columns: var(--studio-sidebar) 1fr;
  grid-template-rows: var(--studio-topbar) 1fr;
  grid-template-areas: "logo   topbar"
                       "side   main";
  min-height: 100vh;
  background: var(--bg);
}

/* ── LOGO CELL (corner) ── */
.st-logo {
  grid-area: logo;
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-family: var(--font-display); font-style: italic; font-size: 22px; letter-spacing: -0.02em;
  cursor: pointer; background: var(--bg);
}
.st-logo .dot { color: var(--accent); }
.st-logo .kind { font-family: var(--font-mono); font-style: normal; font-size: 9px; letter-spacing: .14em; color: var(--ink-dim); padding: 3px 7px; border: 1px solid var(--line-strong); border-radius: 999px; margin-left: 6px; text-transform: uppercase; }

/* ── TOPBAR ── */
.st-topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px; border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.st-topbar__crumb { display: flex; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; color: var(--ink-dim); }
.st-topbar__crumb a { cursor: pointer; }
.st-topbar__crumb a:hover { color: var(--ink); }
.st-topbar__crumb .sep { color: var(--ink-faint); }
.st-topbar__spacer { flex: 1; }
.st-topbar__cmdk {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 14px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); letter-spacing: .04em;
  cursor: pointer; min-width: 280px;
}
.st-topbar__cmdk:hover { border-color: var(--line-strong); background: var(--bg-elev-2); }
.st-topbar__cmdk .kbd { margin-left: auto; padding: 2px 7px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; font-size: 10px; color: var(--ink); font-weight: 500; }
.st-topbar__account {
  display: flex; align-items: center; gap: 10px; padding-left: 16px; border-left: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
}
.st-topbar__account .av { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: var(--bg); font-family: var(--font-display); font-style: italic; font-size: 14px; }

/* ── SIDEBAR ── */
.st-side {
  grid-area: side;
  border-right: 1px solid var(--line);
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg);
}
.st-side h4 { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); padding: 14px 12px 8px; margin: 0; font-weight: 500; }
.st-side h4:first-child { padding-top: 0; }
.st-nav {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--ink-dim); cursor: pointer;
  transition: background .1s, color .1s;
  font-family: var(--font-sans); letter-spacing: .01em;
}
.st-nav:hover { background: var(--bg-elev); color: var(--ink); }
.st-nav.is-active { background: var(--bg-elev-2); color: var(--ink); }
.st-nav.is-active .st-nav__dot { background: var(--accent); }
.st-nav__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex-shrink: 0; }
.st-nav__num { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); letter-spacing: .08em; }

.st-side__event {
  padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 12px; color: var(--ink-dim);
  display: flex; flex-direction: column; gap: 3px;
  border-left: 2px solid transparent;
}
.st-side__event:hover { background: var(--bg-elev); color: var(--ink); }
.st-side__event.is-active { background: var(--bg-elev-2); color: var(--ink); border-left-color: var(--accent); }
.st-side__event .t { font-family: var(--font-display); font-style: italic; font-size: 14px; line-height: 1.15; }
.st-side__event .d { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); letter-spacing: .04em; }

.st-side__new {
  margin: 16px 0 4px;
  width: 100%; justify-content: flex-start; gap: 10px;
  background: var(--accent); color: var(--bg); border-color: var(--accent);
}

/* ── MAIN PANE ── */
.st-main {
  grid-area: main;
  overflow: auto;
  min-height: 0;
}
.st-main__inner { padding: 32px 40px 64px; max-width: 1480px; margin: 0 auto; }

.st-page-head {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  padding-bottom: 20px; margin-bottom: 32px; border-bottom: 1px solid var(--line);
}
.st-page-head h1 { font-family: var(--font-display); font-style: italic; font-size: clamp(40px, 4.5vw, 64px); line-height: 0.95; letter-spacing: -0.02em; margin: 0; }
.st-page-head h1 em { font-style: normal; color: var(--accent); }
.st-page-head .c-meta { margin-top: 8px; }
.st-page-head__actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ── KPI CARDS ── */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 40px; }
.kpi {
  padding: 22px 24px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
  display: flex; flex-direction: column; gap: 10px;
}
.kpi__lbl { font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); letter-spacing: .12em; text-transform: uppercase; font-weight: 500; }
.kpi__n { font-family: var(--font-display); font-style: italic; font-size: 48px; line-height: 1; letter-spacing: -0.02em; color: var(--ink); }
.kpi__n.accent { color: var(--accent); }
.kpi__foot { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); display: flex; justify-content: space-between; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); }
.kpi__foot .up { color: oklch(0.62 0.14 150); }
.kpi__foot .dn { color: oklch(0.6 0.26 330); }

/* ── DATA TABLES ── */
.st-table {
  width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: 13px;
}
.st-table th {
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); letter-spacing: .12em; text-transform: uppercase; font-weight: 500;
}
.st-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.st-table tr:hover td { background: var(--bg-elev); }
.st-table tr.sel td { background: color-mix(in oklab, var(--accent) 12%, var(--bg-elev)); }
.st-table td.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12px; }
.st-table td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.st-table .pill { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.st-table .pill.live { background: oklch(0.78 0.14 150 / 0.2); color: oklch(0.58 0.14 150); }
.st-table .pill.draft { background: var(--bg-elev-2); color: var(--ink-dim); }
.st-table .pill.sold { background: color-mix(in oklab, var(--accent) 18%, var(--bg)); color: var(--accent); }
.st-table .pill.paid { background: oklch(0.78 0.14 150 / 0.18); color: oklch(0.58 0.14 150); }
.st-table .pill.queued { background: oklch(0.78 0.14 80 / 0.18); color: oklch(0.62 0.14 80); }
.st-table .pill.refunded { background: oklch(0.7 0.22 330 / 0.20); color: oklch(0.58 0.24 330); }
.st-table .pill.comp { background: oklch(0.6 0.14 310 / 0.18); color: oklch(0.65 0.14 310); }
.st-table .pill.scanned { background: oklch(0.78 0.14 150 / 0.2); color: oklch(0.58 0.14 150); }

/* ── TAB STRIP ── */
.st-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 32px;
}
.st-tabs button {
  padding: 14px 20px; background: transparent; color: var(--ink-dim); cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.st-tabs button:hover { color: var(--ink); }
.st-tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.st-tabs button .n { margin-left: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); font-weight: 400; }
.st-tabs button.on .n { color: var(--accent); }

/* ── ACTIVITY ── */
.activity {
  padding: 24px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.activity h3 { font-family: var(--font-display); font-style: italic; font-size: 22px; margin: 0 0 16px; }
.activity ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; }
.activity li { padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 13px; display: flex; gap: 14px; align-items: baseline; }
.activity li:last-child { border-bottom: none; }
.activity li .t { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); letter-spacing: .04em; min-width: 70px; }
.activity li .m { color: var(--ink); flex: 1; }

/* ── SHELL FOR FLOATING MODULES (cmdk, wizard, door) ── */
.st-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
  display: none; align-items: flex-start; justify-content: center; padding: 96px 24px 24px;
}
.st-overlay.on { display: flex; }

/* ── FORMS ── */
.st-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.st-field label { font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); letter-spacing: .12em; text-transform: uppercase; }
.st-field input, .st-field textarea, .st-field select {
  width: 100%; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font-family: var(--font-sans); font-size: 14px; color: var(--ink); transition: border-color .12s;
}
.st-field input:focus, .st-field textarea:focus, .st-field select:focus { outline: none; border-color: var(--accent); }
.st-field .hint { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); letter-spacing: .04em; margin-top: 2px; }

/* responsive-ish: collapse sidebar on narrow viewports */
@media (max-width: 900px) {
  body.studio { grid-template-columns: 1fr; grid-template-areas: "logo" "topbar" "main"; }
  .st-side { display: none; }
}
