/* ============================================================================
   Storyloom app chrome.
   Deliberately dark: the three carousel skins include a bone-paper one, and a
   light chrome around a light slide makes the preview stop reading as a canvas.
   Accent is the signature skin's brass, so the app looks like the product.
   Bootstrap is loaded for its reset, grid and utility classes; everything
   visual below is ours, because Bootstrap's default look is recognisably
   Bootstrap and that is a tell on a design tool.
   ========================================================================== */
:root {
  color-scheme: dark;
  --ink: #070708;
  --panel: #111113;
  --panel-2: #171719;
  --raise: #222226;
  --line: #222226;
  --line-soft: #1A1A1D;
  --text: #FFFFFF;
  --muted: #9A9AA0;
  --dim: #777780;
  --gold: #D6FF2B;
  --gold-soft: rgba(214, 255, 43, 0.13);
  --green: #3DDC84;
  --amber: #F5A524;
  --red: #E5484D;
  --field: #0A0E13;
  --canvas: #050505;
  --track: #131313;
  --hint: #73737C;
  --hover-line: #34343A;
  --scroll-thumb: #303036;
  --scroll-thumb-hover: #44444B;
  --r: 12px;
  --shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.75);
}
html[data-theme="light"] {
  color-scheme: light;
  --ink: #F8F7F2;
  --panel: #FFFFFF;
  --panel-2: #F2F1EB;
  --raise: #E9E8E1;
  --line: #E3E2DB;
  --line-soft: #ECEBE5;
  --text: #0A0A0B;
  --muted: #66666F;
  --dim: #777780;
  --gold: #718500;
  --gold-soft: rgba(113, 133, 0, 0.12);
  --green: #187749;
  --amber: #8C5100;
  --red: #B4232A;
  --field: #FFFFFF;
  --canvas: #ECEBE5;
  --track: #E4E3DC;
  --hint: #686871;
  --hover-line: #C8C7BF;
  --scroll-thumb: #C6C5BE;
  --scroll-thumb-hover: #AAA9A1;
  --shadow: 0 24px 60px -24px rgba(30, 28, 20, 0.2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .2s ease, color .2s ease;
}

/* view switching driven by <html data-view> */
.view { display: none; }
html[data-view="boot"] .view-boot { display: grid; }
html[data-view="auth"] .view-auth { display: block; }
html[data-view="dashboard"] .view-dashboard { display: block; }
html[data-view="admin"] .view-admin { display: block; }
html[data-view="not-found"] .view-not-found { display: grid; }
html[data-view="compose"] .view-compose { display: block; }
html[data-view="editor"] .view-editor { display: block; }

/* account controls in the header show only when signed in */
.acct { display: none; }
html[data-auth="out"] .acct { display: none; }
html[data-auth="in"] .acct { display: inline-flex; }
html[data-view="boot"] .acct,
html[data-view="auth"] .acct { display: none; }

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
code {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: .9em;
  background: var(--field);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--gold);
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  width: 100vw;
  min-height: 64px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0 6px;
  background: transparent;
  backdrop-filter: none;
  border-bottom: 1px solid transparent;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, backdrop-filter .2s ease;
}
.topbar.is-scrolled {
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
  box-shadow: 0 12px 28px -18px rgba(0, 0, 0, 0.45);
}
.topbar-inner{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 50px;
  margin: 0 auto;
  padding-inline: 14px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
  font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase;
}
.brand .mark { width: 22px; height: 22px; color: var(--gold); fill: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel);
  font-size: 12px; font-weight: 500; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 3px rgba(61, 220, 132, .16);
}
.pill.off .dot { background: var(--dim); box-shadow: none; }
.pill-quiet { border-style: dashed; color: var(--dim); }
.topbar .email { color: var(--muted); }
.topbar .linkbtn.acct {
  padding: 8px 10px; border: 1px solid transparent; border-radius: 999px;
  color: var(--text); text-decoration: none;
}
.topbar .linkbtn.acct:hover { border-color: var(--line); background: var(--panel); color: var(--text); }
.topbar .pill.credits b { color: var(--gold); }
.theme-toggle {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--text); cursor: pointer;
  transition: border-color .14s, background-color .14s;
}
.theme-toggle:hover { border-color: var(--muted); background: var(--panel-2); }
.theme-toggle svg { display: block; width: 17px; height: 17px; }

@media (max-width: 760px) {
  .topbar { width: 100%; max-width: none; min-height: 56px; padding: 8px 14px; }
  .topbar-inner { width: 100%; padding-inline: 0; grid-template-columns: minmax(0, 1fr) auto; }
  .topbar-right { gap: 6px; }
  .topbar .pill { height: 30px; padding: 0 8px; font-size: 11px; }
  .topbar .email, .topbar .pill-quiet { display: none !important; }
}
@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 9px 12px; }
  .topbar .brand { gap: 7px; font-size: 12px; }
  .topbar .brand .mark { width: 20px; height: 20px; }
  .topbar-right { gap: 4px; }
  .topbar #modelPill { display: none; }
  .topbar #dashLink { padding: 0 8px; }
  .topbar .linkbtn.acct { padding: 7px 8px; }
}
@media (max-width: 340px) {
  .topbar { gap: 6px; padding-inline: 6px; }
  .topbar .brand { gap: 5px; font-size: 11px; }
  .topbar .brand .mark { width: 18px; height: 18px; }
  .topbar-right { gap: 3px; }
  .topbar .pill { padding-inline: 6px; }
}
.admin-only { display: none !important; }
.admin-only.admin-ready { display: inline-flex !important; }

/* ---------------------------------------------------------- not found view */
.view-not-found {
  min-height: calc(100vh - 64px);
  place-items: center;
  padding: 48px 20px;
  text-align: center;
}
.view-not-found section { max-width: 520px; }
.view-not-found h1 { margin: 0 0 12px; font-size: clamp(30px, 5vw, 44px); }
.view-not-found p:not(.dash-eyebrow) { margin: 0 0 24px; color: var(--muted); line-height: 1.6; }

/* ======================================================== COMPOSE VIEW */
.view-compose { max-width: 900px; margin: 0 auto; padding: 74px 0px 0px; }

.hero { text-align: center; margin-bottom: 46px; }
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4.4vw, 41px);
  font-weight: 800; letter-spacing: -.032em; line-height: 1.08;
}
.hero h1 b { color: var(--gold); font-weight: 800; }
.hero p {
  margin: 0 auto; max-width: 540px;
  color: var(--muted); font-size: 15.5px; line-height: 1.55;
}
.hero p em { color: var(--text); font-style: normal; font-weight: 600; }

.new-deck-choice {
  margin: 0 auto 18px; max-width: 900px; padding: 40px 20px 26px;
  border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.choice-header { margin-bottom: 26px; text-align: center; }
.choice-header .dash-eyebrow {
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.choice-header h2 {
  margin: 0; font-size: clamp(24px, 3vw, 34px); line-height: 1.08;
  font-weight: 700; letter-spacing: -.02em;
}
.choice-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.choice-card {
  width: 100%; min-height: 224px; padding: 22px 20px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--panel); color: var(--text); text-align: left;
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.choice-card:hover {
  border-color: var(--gold); transform: translateY(-1px);
  box-shadow: 0 14px 32px -20px rgba(214, 255, 43, 0.65);
}
.choice-card:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}
.choice-badge {
  display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold); font-size: 10px; font-weight: 700;
  font-family: "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.choice-badge-soft { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.choice-card h3 {
  margin: 18px 0 12px; font-size: clamp(20px, 2vw, 24px); line-height: 1.12;
  font-weight: 600; letter-spacing: -.02em;
}
.choice-card p {
  margin: 0; color: #A1A1AA; font-size: 14px; line-height: 1.55; font-weight: 400;
}
.choice-actions { display: flex; justify-content: center; margin-top: 20px; }
@media (max-width: 700px) {
  .choice-grid { grid-template-columns: 1fr; }
  .new-deck-choice { padding-inline: 16px; }
}

/* ------------------------------------------------------------- composer */
.composer {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.seg {
  display: inline-flex; gap: 2px;
  padding: 3px;
  background: var(--field);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.seg.wrap { flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent;
  padding: 6px 11px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raise); color: var(--text); box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 5%, transparent) inset; }

.seg-source { margin-bottom: 14px; }
.seg-source button.on { color: var(--gold); }

textarea, input[type="url"], input[type="text"], .f input:not([type]), .titlebox {
  width: 100%;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 15px;
  font-size: 15px; line-height: 1.55;
  outline: none;
  transition: border-color .14s, box-shadow .14s;
}
textarea { resize: vertical; min-height: 96px; }
textarea::placeholder, input::placeholder { color: var(--dim); }
textarea:focus, input:focus {
  border-color: color-mix(in srgb, var(--gold) 58%, transparent);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.microrow {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 7px;
  font-size: 12px; color: var(--dim);
}
.linkbtn {
  background: none; border: 0; padding: 0;
  color: var(--muted); font-size: 12px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--gold); }

.urlrow { display: flex; gap: 8px; }
.urlrow input { flex: 1; }

.btn-ghost {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0 15px; height: 46px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.btn-ghost:hover { background: var(--raise); border-color: var(--hover-line); }
.btn-ghost.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }

.peek {
  margin-top: 10px; padding: 12px 14px;
  background: var(--field); border: 1px solid var(--line-soft); border-radius: 10px;
  font-size: 13px; line-height: 1.6; color: var(--muted);
  max-height: 170px; overflow-y: auto; white-space: pre-wrap;
}
.peek b { color: var(--text); display: block; margin-bottom: 6px; font-size: 13.5px; }

/* ------------------------------------------------------------------ knobs */
.knobs {
  display: flex; flex-wrap: wrap; gap: 18px 26px;
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.knob label {
  display: block; margin-bottom: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--dim);
}
.knob label .hint {
  font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--hint);
}
.knob-style { margin-top: 18px; }

/* Keep style tiles readable while letting new reusable styles join the row. */
.styles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-width: 700px;
}
.stylecard {
  background: none; border: 1px solid var(--line); border-radius: 12px;
  padding: 7px; text-align: left;
  transition: border-color .14s, transform .14s, background .14s;
}
.stylecard:hover { transform: translateY(-2px); border-color: var(--hover-line); }
.stylecard.on { border-color: var(--gold); background: var(--gold-soft); }
.stylecard .nm {
  display: block; margin-top: 7px; padding: 0 2px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.stylecard.on .nm { color: var(--gold); }

.style-admin {
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft);
}
.style-library {
  display: grid; gap: 8px; margin-top: 12px; margin-bottom: 14px;
}
.style-library-item {
  background: var(--panel-strong); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 8px 10px; display: flex; align-items: center; gap: 10px;
  text-align: left; cursor: pointer; transition: border-color .14s, transform .14s;
}
.style-library-item:hover { border-color: var(--gold); transform: translateY(-1px); }
.style-library-empty {
  font-size: 12px; color: var(--muted); background: rgba(255,255,255,.02);
  border: 1px dashed var(--line-soft); border-radius: 10px; padding: 10px 12px;
}
.style-swatch {
  width: 34px; height: 34px; border-radius: 8px; display: block;
  background: linear-gradient(135deg, var(--style-bg), var(--style-accent));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.style-copy {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.style-copy strong {
  font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.style-copy small {
  font-size: 11px; color: var(--muted); letter-spacing: .02em; text-transform: lowercase;
}
.style-form {
  margin-top: 12px; display: grid; gap: 10px;
}
.style-form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.style-form-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.style-form label {
  display: grid; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--dim);
}
.style-form input {
  background: var(--field); border: 1px solid var(--line-soft); border-radius: 10px;
  height: 38px; padding: 0 10px; color: var(--text); font-weight: 500;
}
.style-form textarea {
  background: var(--field); border: 1px solid var(--line-soft); border-radius: 10px;
  min-height: 64px; padding: 9px 10px; color: var(--text); font: inherit;
  font-size: 12px; font-weight: 500; resize: vertical;
}
.style-form input[type="color"] {
  min-height: 38px; padding: 4px; width: 100%;
}

/* miniature of each skin — not a screenshot, a token sample */
.sw {
  position: relative; aspect-ratio: 4 / 5; border-radius: 8px; overflow: hidden;
  padding: 13px 12px; display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.sw i { display: block; border-radius: 2px; }
.sw .eyebrow { width: 36%; height: 3px; margin-bottom: 5px; }
.sw .l1 { width: 88%; height: 7px; }
.sw .l2 { width: 58%; height: 7px; }
.sw .l3 { width: 72%; height: 3px; margin-top: 7px; opacity: .45; }

.sw[data-s="signature-african"] {
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(15, 107, 97, .3), transparent 60%),
    radial-gradient(90% 70% at -10% 110%, rgba(189, 74, 46, .26), transparent 55%),
    #101A33;
}
.sw[data-s="signature-african"]::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: repeating-linear-gradient(180deg, #D9A23B 0 11px, #0F6B61 11px 22px, #BD4A2E 22px 33px, #F0E7D4 33px 44px);
}
.sw[data-s="signature-african"] .eyebrow, .sw[data-s="signature-african"] .l2 { background: #D9A23B; }
.sw[data-s="signature-african"] .l1, .sw[data-s="signature-african"] .l3 { background: #F0E7D4; }

.sw[data-s="editorial-clean"] { background: #F7F4EC; }
.sw[data-s="editorial-clean"] .eyebrow, .sw[data-s="editorial-clean"] .l2 { background: #BD4A2E; }
.sw[data-s="editorial-clean"] .l1, .sw[data-s="editorial-clean"] .l3 { background: #1B1A17; }

.sw[data-s="mono-terminal"] {
  background: linear-gradient(180deg, rgba(61, 220, 132, .1), transparent 35%), #0A0C0B;
}
.sw[data-s="mono-terminal"] .eyebrow, .sw[data-s="mono-terminal"] .l2 { background: #3DDC84; }
.sw[data-s="mono-terminal"] .l1, .sw[data-s="mono-terminal"] .l3 { background: #E6EDE9; }

/* ------------------------------------------------------------------ extra */
.extra { margin-top: 16px; }
.extra summary {
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted);
  list-style: none; width: fit-content;
}
.extra summary::-webkit-details-marker { display: none; }
.extra summary::before { content: "+ "; color: var(--gold); }
.extra[open] summary::before { content: "− "; }
.extra summary:hover { color: var(--text); }
.extra summary .hint { color: var(--hint); font-weight: 500; }
.extra input { margin-top: 9px; }

/* ------------------------------------------------------------- go button */
.btn-go {
  width: 100%; margin-top: 18px;
  height: 50px; border: 0; border-radius: 12px;
  background: var(--gold);
  color: #17120A;
  font-size: 15px; font-weight: 700; letter-spacing: -.01em;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--gold) 60%, transparent);
  transition: filter .14s, transform .1s;
}
.btn-go:hover { filter: brightness(1.06); }
.btn-go:active { transform: translateY(1px); }
.btn-go:disabled { filter: grayscale(.7) brightness(.65); cursor: not-allowed; box-shadow: none; }
.btn-go .cost {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  background: rgba(23, 18, 10, .17); border-radius: 999px; padding: 3px 8px;
}
.btn-go.sm { width: auto; height: 32px; margin: 0; padding: 0 14px; font-size: 13px; border-radius: 8px; }
.btn-go.sm .cost { display: none; }

.nokey, .err {
  margin: 12px 0 0; font-size: 13px; line-height: 1.5;
  padding: 11px 13px; border-radius: 10px;
}
.nokey { color: var(--amber); background: rgba(245, 165, 36, .09); border: 1px solid rgba(245, 165, 36, .28); }
.err { color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); }
.err b { color: #fff; }

/* --------------------------------------------------------------- working */
.working { margin-top: 16px; }
.working .bar {
  height: 3px; border-radius: 999px; background: #131A22; overflow: hidden;
}
.working .bar i {
  display: block; height: 100%; width: 34%; border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: slide 1.25s ease-in-out infinite;
}
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(400%); } }
.working p {
  margin: 10px 0 0; font-size: 13px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 10px;
}
/* Pushed to the far edge so the message can grow without shoving the count. */
.working .clock { margin-left: auto; color: var(--dim); font-size: 12px; }

/* ------------------------------------------------------------------- boot */
.view-boot {
  min-height: calc(100vh - 56px);
  place-items: center;
  padding: 32px 20px;
}
.bootbox {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted);
  font-size: 13px; font-weight: 600;
}
.bootbox p { margin: 0; }
.bootmark {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- or line */
.orline {
  display: flex; align-items: center; gap: 16px;
  margin: 42px 0 20px;
  color: var(--dim); font-size: 12px; font-weight: 500;
}
.orline::before, .orline::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}

/* --------------------------------------------------------------- gallery */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.gallery-notice { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.gallery-notice[role="alert"] { color: #FF9EA1; }
.gcard {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; padding: 0;
  text-align: left;
  transition: border-color .14s, transform .14s;
}
.gcard:hover { transform: translateY(-3px); border-color: #33414F; }
.gcard .shot {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}
.gcard .shot iframe {
  border: 0; width: 1080px; height: 1350px;
  transform-origin: top left; display: block; pointer-events: none;
}
.gcard .meta { padding: 11px 13px 13px; }
.gcard .meta b {
  display: block; font-size: 13.5px; font-weight: 600; line-height: 1.35;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gcard .meta span { display: block; margin-top: 4px; font-size: 11.5px; color: var(--dim); }
.gcard .use {
  position: absolute; inset: auto 0 0; padding: 10px;
  background: linear-gradient(0deg, rgba(7, 9, 12, .96), transparent);
  opacity: 0; transition: opacity .16s;
  font-size: 12.5px; font-weight: 700; color: var(--gold); text-align: center;
}
.gcard:hover .use { opacity: 1; }

/* ========================================================= EDITOR VIEW */
.editbar {
  height: 52px; display: flex; align-items: center; gap: 12px;
  padding: 0 14px; border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
}
.titlebox {
  flex: 1; max-width: 420px;
  height: 34px; padding: 0 11px;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  font-size: 14.5px; font-weight: 600;
}
.titlebox:hover { border-color: var(--line); }
.editbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.badge-source {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 5px;
  border: 1px solid var(--line); color: var(--muted);
}
.badge-source[data-src="ai"] { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 42%, transparent); background: var(--gold-soft); }

.vstate { font-size: 12px; font-weight: 600; color: var(--dim); font-variant-numeric: tabular-nums; }
.vstate.ok { color: var(--green); }
.vstate.warn { color: var(--amber); }
.vstate.bad { color: var(--red); }

.workspace {
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr) 350px;
  /* minmax(0,1fr), not the default auto: an auto row is sized by its content,
     and the stage sizes its content from the row — the two chase each other and
     settle wherever the first paint happened to land. */
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - 56px - 52px);
}

/* ------------------------------------------------------------------- rail */
.rail {
  border-right: 1px solid var(--line-soft);
  padding: 12px 11px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 9px;
  background: var(--panel);
}
.rthumb {
  position: relative; padding: 0; border: 1.5px solid var(--line); border-radius: 9px;
  background: var(--canvas); overflow: hidden; flex: 0 0 auto;
  transition: border-color .14s;
}
.rthumb:hover { border-color: #3A4854; }
.rthumb.on { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.rthumb iframe {
  border: 0; width: 1080px; height: 1350px;
  transform-origin: top left; display: block; pointer-events: none;
}
.rthumb .n {
  position: absolute; top: 5px; left: 5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  background: rgba(5, 7, 10, .8); border-radius: 5px;
  font-size: 10px; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums;
}
.rthumb.on .n { background: var(--gold); color: #17120A; }

/* Drag-to-reorder. The shield is inert until a drag begins, then goes live so
   the iframe underneath (pointer-events:none) can't swallow the drag. */
.rthumb { cursor: grab; }
.rthumb .shield { position: absolute; inset: 0; pointer-events: none; }
.rail.dragging .rthumb .shield { pointer-events: auto; }
.rail.dragging .rthumb { cursor: grabbing; }
.rthumb.drag-src { opacity: .4; }
.rthumb.drag-over { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

/* Add / remove. Sticky so it stays reachable once ten thumbs make the rail
   scroll; margin-top:auto pins it to the floor when they don't. The bounds are
   the schema's, so at 5 or 10 slides a button simply disables — same idea as
   maxLength on the text inputs: the UI can't author an invalid deck. */
.railfoot {
  position: sticky; bottom: 0; z-index: 2;
  margin-top: auto; padding: 9px 0 2px;
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
}
.rbtn {
  width: 34px; height: 28px; flex: 0 0 auto;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-weight: 700; line-height: 1;
}
.rbtn:hover:not(:disabled) { background: var(--raise); border-color: #2C3945; }
.rbtn:disabled { opacity: .38; cursor: not-allowed; }
.rcount {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ stage */
.stage {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px; min-width: 0; min-height: 0; overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--gold) 6%, transparent), transparent 70%),
    var(--canvas);
}
.stage-frame {
  position: relative; overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .9), 0 0 0 1px var(--line);
}
.stage-frame iframe {
  border: 0; width: 1080px; height: 1350px;
  transform-origin: top left; display: block;
}
.stage-nav {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.stage-nav button {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-size: 17px; line-height: 1; display: grid; place-items: center;
}
.stage-nav button:hover:not(:disabled) { background: var(--raise); }
.stage-nav button:disabled { opacity: .35; cursor: default; }
.typepill {
  margin-left: 4px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted);
}
.stage-note {
  max-width: 460px; text-align: center;
  font-size: 12px; line-height: 1.5; color: var(--amber);
  min-height: 18px;
}

/* ------------------------------------------------------------------ panel */
.panel {
  border-left: 1px solid var(--line-soft);
  background: var(--panel);
  display: flex; flex-direction: column; min-height: 0;
}
.seg-tabs {
  margin: 12px 13px 0; border-radius: 9px;
}
.seg-tabs button { flex: 1; }
.panel-body { padding: 16px 15px 40px; overflow-y: auto; flex: 1; }

.theme-customize { display: grid; gap: 12px; }
.theme-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.theme-colors label, .theme-font-label {
  display: grid; gap: 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--dim);
}
.theme-colors input[type="color"] {
  width: 100%; height: 38px; padding: 4px;
  background: var(--field); border: 1px solid var(--line-soft); border-radius: 8px;
}
.theme-font-label select {
  width: 100%; height: 38px; padding: 0 10px;
  background: var(--field); border: 1px solid var(--line-soft); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 12px; font-weight: 500;
  letter-spacing: 0; text-transform: none;
}
.theme-typography { display: grid; gap: 10px; }
.theme-size-label {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
  color: var(--dim); font-size: 10.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
}
.theme-size-label output { color: var(--text); font-variant-numeric: tabular-nums; }
.theme-size-label input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--gold); }
.theme-actions { display: flex; justify-content: flex-end; }

.f { margin-bottom: 15px; }
.f > label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-bottom: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim);
}
.f .cnt {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--hint); font-variant-numeric: tabular-nums;
}
.f .cnt.near { color: var(--amber); }
.f .cnt.full { color: var(--red); }
.f input, .f textarea {
  padding: 9px 11px; font-size: 13.5px; border-radius: 9px; line-height: 1.5;
}
.f textarea { min-height: 0; }
.f .why { margin: 5px 0 0; font-size: 11.5px; color: var(--hint); line-height: 1.45; }

.subhead {
  margin: 22px 0 11px; padding-top: 15px;
  border-top: 1px solid var(--line-soft);
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim);
  display: flex; justify-content: space-between; align-items: center;
}
.subhead:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.bulletrow { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.bulletrow input { flex: 1; }
.iconbtn {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  font-size: 14px; line-height: 1; display: grid; place-items: center;
}
.iconbtn:hover { background: var(--raise); color: var(--text); border-color: #2C3945; }
.addbtn {
  width: 100%; margin-top: 4px; height: 30px;
  background: transparent; border: 1px dashed var(--line); border-radius: 8px;
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.addbtn:hover { border-color: var(--gold); color: var(--gold); }
.addbtn:disabled { opacity: .4; cursor: not-allowed; border-style: dashed; }

/* tag editor for highlight_words */
.tagbox {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 38px; padding: 7px 8px;
  background: var(--field); border: 1px solid var(--line); border-radius: 9px;
}
.tagbox:focus-within { border-color: color-mix(in srgb, var(--gold) 58%, transparent); box-shadow: 0 0 0 3px var(--gold-soft); }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 5px 3px 8px; border-radius: 6px;
  background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  font-size: 12px; font-weight: 600; color: var(--gold);
  font-style: italic;
}
.tag button { border: 0; background: none; color: var(--gold); opacity: .65; font-size: 13px; line-height: 1; padding: 0 1px; }
.tag button:hover { opacity: 1; }
.tag.dud { background: color-mix(in srgb, var(--red) 10%, transparent); border-color: color-mix(in srgb, var(--red) 32%, transparent); color: var(--red); font-style: normal; text-decoration: line-through; }
.tagbox input {
  flex: 1 1 70px; min-width: 70px;
  background: none; border: 0; outline: none; box-shadow: none !important;
  color: var(--text); font-size: 13px; padding: 3px 2px;
}

.switchrow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0;
}
.switchrow span { font-size: 13px; color: var(--text); }
.switchrow small { display: block; font-size: 11.5px; color: var(--hint); margin-top: 2px; }
.sw-toggle {
  flex: 0 0 auto; width: 38px; height: 22px; border-radius: 999px; border: 0;
  background: var(--raise); position: relative; transition: background .16s;
}
.sw-toggle i {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform .16s, background .16s;
}
.sw-toggle.on { background: color-mix(in srgb, var(--gold) 35%, transparent); }
.sw-toggle.on i { transform: translateX(16px); background: var(--gold); }

.warnlist { margin: 4px 0 0; padding: 0; list-style: none; }
.warnlist li {
  font-size: 11.5px; line-height: 1.5; color: var(--amber);
  padding: 7px 9px; margin-bottom: 5px;
  background: rgba(245, 165, 36, .07); border-left: 2px solid rgba(245, 165, 36, .5);
  border-radius: 0 6px 6px 0;
}
.warnlist li.bad { color: var(--red); background: color-mix(in srgb, var(--red) 7%, transparent); border-left-color: color-mix(in srgb, var(--red) 55%, transparent); }

/* Default scrollbars are light-on-light and cut a bright stripe down the middle
   of a dark editor. Firefox gets the standard property, Chrome the ::-webkit- one. */
.rail, .panel-body, .peek, .sheet-card { scrollbar-width: thin; scrollbar-color: #253039 transparent; }
.rail::-webkit-scrollbar,
.panel-body::-webkit-scrollbar,
.peek::-webkit-scrollbar,
.sheet-card::-webkit-scrollbar { width: 9px; height: 9px; }
.rail::-webkit-scrollbar-thumb,
.panel-body::-webkit-scrollbar-thumb,
.peek::-webkit-scrollbar-thumb,
.sheet-card::-webkit-scrollbar-thumb {
  background: #253039; border-radius: 999px;
  border: 2px solid transparent; background-clip: content-box;
}
.rail::-webkit-scrollbar-thumb:hover,
.panel-body::-webkit-scrollbar-thumb:hover,
.sheet-card::-webkit-scrollbar-thumb:hover { background: #36444F; background-clip: content-box; }
.rail::-webkit-scrollbar-track,
.panel-body::-webkit-scrollbar-track,
.peek::-webkit-scrollbar-track,
.sheet-card::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------- render sheet */
.sheet {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 24px;
  background: rgba(4, 6, 8, .78); backdrop-filter: blur(6px);
}
.sheet-card {
  position: relative; width: 100%; max-width: 700px; max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow);
}
.sheet-x {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  font-size: 17px; line-height: 1;
}
.sheet-card h3 { margin: 0 0 5px; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.sheet-sub { margin: 0 0 18px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.shots a { display: block; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; line-height: 0; }
.shots a:hover { border-color: var(--gold); }
.shots img { width: 100%; height: auto; display: block; }
.sheet-foot { margin: 18px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--hint); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 132px minmax(0, 1fr) 310px; }
}
@media (max-width: 940px) {
  .gallery { grid-template-columns: 1fr 1fr; }
  .workspace {
    grid-template-columns: 1fr; grid-template-rows: auto auto auto; height: auto;
  }
  /* The stage still needs a bounded height here — fitStage measures it. */
  .stage { height: 68vh; }
  .rail { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .panel { border-left: 0; border-top: 1px solid var(--line-soft); }
  .panel-body { max-height: none; }
}

/* ============================================================ AUTH VIEW */
.view-auth {
  max-width: 500px; margin: 0 auto; padding: 60px 16px;
}
.authcard {
  border: 1px solid #000000; border-radius: 22px;
  background: rgba(17, 17, 19, 0.9);
  box-shadow: var(--shadow);
  padding: 40px 40px 40px;
}
.auth-shell { display: grid; gap: 10px; }
.auth-topline {
  font-size: 10px; font-weight: 700; letter-spacing: .16em;
  color: var(--muted); text-transform: uppercase;
}
.authcard h1 {
  margin: 0; font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: .96; letter-spacing: -.06em; font-weight: 800;
}
.authsub {
  margin: 0; color: var(--muted); font-size: 13px; font-weight: 500;
}
#authForm { display: grid; gap: 12px; }
.authfield {
  display: block; padding-top: 12px;
  margin: 0;
  font-size: 11px; color: var(--muted); letter-spacing: .02em;
}
.input-wrap {
  display: flex; align-items: center; gap: 10px; min-height: 48px;
  padding: 0 12px; border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px; background: rgba(255,255,255,0.03);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.input-wrap:focus-within {
  border-color: rgba(214, 255, 43, 0.9);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 3px rgba(214, 255, 43, 0.12);
}
.input-wrap svg {
  width: 16px; height: 16px; fill: var(--muted); flex-shrink: 0;
}
#authForm input {
  display: block; width: 100%; border: 0; background: transparent; color: var(--text);
  font-size: 14px; padding: 11px 0; outline: none;
}
#authForm input::placeholder { color: var(--muted); }
.password-toggle {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: .95rem; padding: 0; min-width: 18px;
}
.auth-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 1px;
  margin-bottom: 25px;
}
.checkrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 11px;
  white-space: nowrap;
}
.checkrow input {
  accent-color: var(--gold); width: 14px; height: 14px;
}
#authResetLink, #authBackToSignIn, #authToggle {
  display: inline-flex; justify-content: center; align-items: center;
  color: var(--text); opacity: 0.9; font-size: 12px;
}
#authForm .btn-go {
  width: 100%; min-height: 50px; margin-top: 2px; border: 1px solid rgba(214,255,43,0.35);
  border-radius: 12px; background: var(--gold); color: var(--ink);
  font-size: 17px; font-weight: 700; letter-spacing: -.03em;
  box-shadow: 0 18px 24px -18px rgba(214,255,43,0.8);
}
#authForm .btn-go:hover { filter: brightness(0.98); }
#authForm .btn-go:disabled { opacity: .7; cursor: wait; }
.authmsg {
  margin: 0; font-size: 12px; line-height: 1.5; padding: 9px 10px; border-radius: 10px;
  color: var(--green); background: rgba(61, 220, 132, .08); border: 1px solid rgba(61, 220, 132, .25);
}
.auth-inline { margin: 0 auto; }
.auth-footer-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.authnotice { margin: 0; color: var(--muted); font-size: 11px; text-align: center; }

html[data-theme="light"] .view-auth {
  filter: none;
}
html[data-theme="light"] .authcard {
  background: rgba(255, 255, 255, 0.78);
  border-color: #000000;
  box-shadow: 0 20px 50px -26px rgba(18, 21, 20, 0.28);
}
html[data-theme="light"] .auth-topline,
html[data-theme="light"] .authsub,
html[data-theme="light"] .authfield,
html[data-theme="light"] .checkrow,
html[data-theme="light"] .authnotice,
html[data-theme="light"] #authResetLink,
html[data-theme="light"] #authBackToSignIn,
html[data-theme="light"] #authToggle,
html[data-theme="light"] .password-toggle,
html[data-theme="light"] .input-wrap svg {
  color: var(--muted);
  fill: var(--muted);
}
html[data-theme="light"] .authcard h1,
html[data-theme="light"] #authForm input,
html[data-theme="light"] #authResetLink,
html[data-theme="light"] #authBackToSignIn,
html[data-theme="light"] #authToggle {
  color: var(--text);
}
html[data-theme="light"] .input-wrap {
  background: rgba(17, 17, 19, 0.02);
  border-color: rgba(17, 17, 19, 0.12);
  box-shadow: inset 0 0 0 1px rgba(17, 17, 19, 0.02);
}
html[data-theme="light"] .input-wrap:focus-within {
  border-color: rgba(113, 133, 0, 0.7);
  background: rgba(17, 17, 19, 0.015);
  box-shadow: 0 0 0 3px rgba(113, 133, 0, 0.08);
}
html[data-theme="light"] #authForm .btn-go {
  background: var(--gold);
  border-color: rgba(113, 133, 0, 0.25);
  box-shadow: 0 18px 26px -20px rgba(113, 133, 0, 0.85);
}
html[data-theme="light"] .authmsg {
  background: rgba(24, 119, 73, 0.06);
  border-color: rgba(24, 119, 73, 0.2);
}

@media (max-width: 520px) {
  .view-auth { padding: 28px 12px; }
  .authcard { padding: 18px 14px 14px; border-radius: 18px; }
}

/* ========================================================= DASHBOARD VIEW */
.view-dashboard { width: 80vw; max-width: 1280px; margin: 0 auto; padding: 28px 24px 9px; }
.dash-eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.dashhero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .96fr);
  gap: 40px;
  align-items: stretch;
  margin-bottom: 42px;
}
.dashhero-copy { display: flex; flex-direction: column; justify-content: center; padding: 15px 0; }
.dashhero-copy h1 { margin: 0; font-size: 64px; font-weight: 800; line-height: .99; }
.dashhero-copy h1 span { color: var(--gold); }
.dashhero-copy > p:last-child { max-width: 420px; margin-top: 18px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.dashhero-action {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 230px;
  padding: 28px;
  border-radius: 4px 4px 32px 4px;
  background: #d6ff2b;
  color: #070708;
}
.dashhero-mark { display: flex; align-items: flex-end; gap: 5px; height: 28px; }
.dashhero-mark i { display: block; width: 11px; border: 1px solid currentColor; border-bottom: 0; border-radius: 8px 8px 0 0; }
.dashhero-mark i:nth-child(1) { height: 16px; }
.dashhero-mark i:nth-child(2) { height: 27px; }
.dashhero-mark i:nth-child(3) { height: 21px; }
.dashhero-action-copy h2 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.15; }
.dashhero-action-copy p { margin: 9px 0 20px; font-size: 14px; }
.dashhero-start {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  width: min(100%, 220px); min-height: 48px; padding: 0 14px;
  border: 1px solid rgba(7, 7, 8, .38); border-radius: 3px;
  background: transparent; color: inherit; font-size: 14px; font-weight: 700;
  text-align: left; transition: background-color .14s, border-color .14s;
}
.dashhero-start:hover { background: rgba(7, 7, 8, .06); border-color: rgba(7, 7, 8, .75); }
.dashhero-start:focus-visible { outline: 2px solid #070708; outline-offset: 3px; }
.dashhero-arrow { font-size: 18px; line-height: 1; }
.dashsectionhead {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 18px; padding-top: 22px; border-top: 1px solid var(--line);
}
.dashsectionhead h2 { margin: 0; color: var(--text); font-size: 20px; font-weight: 700; }
.dashsectionhead p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.dashsection-tools { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.dashsection-tools > span { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashfilter { padding: 2px; border-radius: 8px; }
.dashfilter button { padding: 5px 9px; font-size: 11.5px; }
.dashempty {
  margin: 0 0 18px; padding: 15px 17px; border: 1px dashed var(--line);
  border-radius: 10px; color: var(--muted); font-size: 13px; line-height: 1.5;
}
.dashempty.error { border-style: solid; border-color: color-mix(in srgb, var(--red) 42%, transparent); color: var(--red); }
.deckgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.deckcard {
  min-width: 0; min-height: 184px; display: flex; flex-direction: column; gap: 14px;
  padding: 15px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel);
  transition: border-color .15s, transform .15s;
}
.deckcard:hover { border-color: var(--hover-line); transform: translateY(-1px); }
.deckcard:focus-within { border-color: var(--gold); }
.deckcard h2 { margin: 0; font-size: inherit; }
.deck-open {
  width: 100%; min-width: 0; padding: 0; border: 0; background: none; color: inherit;
  display: flex; flex-direction: column; align-items: flex-start; gap: 11px; text-align: left;
}
.deck-open-title { width: 100%; color: var(--text); font-size: 15px; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.deck-open-cta { color: var(--gold); font-size: 12px; font-weight: 700; }
.deck-open:hover .deck-open-cta { text-decoration: underline; text-underline-offset: 3px; }
.deck-open:focus-visible, .deckcard .del:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.deckcard-foot {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.deckcard .meta { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; color: var(--dim); font-size: 11px; }
.deckcard .meta .badge-source { margin: 0; }
.deckcard .del {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 36px; height: 36px; margin: 0; padding: 0;
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--dim); text-decoration: none;
}
.deckcard .del svg { display: block; width: 17px; height: 17px; }
.deckcard .del:hover { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); background: color-mix(in srgb, var(--red) 8%, transparent); }

/* ========================================================= USER FEEDBACK */
.feedback-dialog {
  width: min(560px, calc(100vw - 28px)); max-height: min(760px, calc(100dvh - 28px));
  padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--text); box-shadow: 0 24px 90px rgba(0, 0, 0, .4);
}
.feedback-dialog::backdrop { background: rgba(3, 5, 10, .68); backdrop-filter: blur(3px); }
.feedback-dialog form { display: grid; gap: 9px; padding: 24px; }
.feedback-dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin-bottom: 9px; }
.feedback-dialog-head h2 { margin: 0; font-size: 27px; font-weight: 700; letter-spacing: -.04em; }
.feedback-dialog label { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 650; }
.feedback-dialog select, .feedback-dialog textarea {
  width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--field); color: var(--text); font: inherit; font-size: 13px;
}
.feedback-dialog select { min-height: 42px; }
.feedback-dialog textarea { min-height: 140px; resize: vertical; line-height: 1.55; }
.feedback-dialog :is(button, select, textarea):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.feedback-form-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--dim); font-size: 10px; line-height: 1.5; }
.feedback-form-meta span:first-child { max-width: 34ch; }
.feedback-form-meta span:last-child { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.feedback-privacy { margin: 2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.feedback-result { margin: 2px 0 0; padding: 9px 11px; border-left: 2px solid var(--gold); background: var(--panel-2); font-size: 12px; line-height: 1.5; }
.feedback-result.error { border-color: var(--red); color: var(--red); }
.feedback-dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 8px; }
.feedback-fab {
  position: fixed; z-index: 20; right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center;
  justify-content: center; gap: 10px; min-height: 54px; padding: 0 20px;
  border: 1px solid #bce51d; border-radius: 999px; background: #d6ff2b;
  color: #10120a; box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
  font: inherit; font-size: 13px; font-weight: 750; letter-spacing: -.01em;
  cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.feedback-fab svg { width: 20px; height: 20px; flex: 0 0 20px; }
.feedback-fab:hover { transform: translateY(-2px); background: #e0ff68; box-shadow: 0 12px 34px rgba(0, 0, 0, .34); }
.feedback-fab:active { transform: translateY(0); }
.feedback-fab:focus-visible { outline: 3px solid var(--text); outline-offset: 4px; }

/* ======================================================= ADMIN CATALOGS */
.view-admin { width: min(96vw, 1440px); margin: 0 auto; padding: 38px 28px 72px; }
.admin-catalog { display: grid; gap: 20px; }
.admin-catalog-head {
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  padding-bottom: 25px; border-bottom: 1px solid var(--line-soft);
}
.admin-catalog-head h1 { margin: 0; font-size: clamp(36px, 4.6vw, 56px); letter-spacing: -.055em; line-height: 1; }
.admin-catalog-head > div > p:last-child { max-width: 56ch; margin: 12px 0 0; color: var(--muted); line-height: 1.55; }
.admin-nav { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line-soft); }
.admin-nav button {
  min-height: 46px; padding: 0 15px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  transition: color .15s ease, border-color .15s ease;
}
.admin-nav button:hover { color: var(--text); }
.admin-nav button[aria-current="page"] { border-bottom-color: var(--gold); color: var(--gold); }
.admin-nav .admin-back { margin-left: auto; border: 0; }
.admin-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.admin-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.admin-filters button {
  min-height: 35px; padding: 0 12px; border: 1px solid transparent; border-radius: 7px;
  background: var(--panel); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.admin-filters button:hover { border-color: var(--line); color: var(--text); }
.admin-filters button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--gold) 40%, transparent); background: var(--gold-soft); color: var(--gold); }
.admin-search {
  flex: 1 1 230px; min-width: 180px; max-width: 360px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-soft); border-radius: 7px; background: var(--panel);
  color: var(--text); font: inherit; font-size: 13px;
}
.admin-template-list { display: grid; gap: 10px; }
.admin-template-row {
  display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; gap: 18px;
  padding: 14px; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--panel);
  transition: border-color .15s ease, background-color .15s ease;
}
.admin-template-row:hover { border-color: var(--hover-line); background: var(--panel-2); }
.admin-template-preview { width: 104px; height: 130px; overflow: hidden; background: var(--canvas); border: 1px solid var(--line); border-radius: 6px; }
.admin-template-preview iframe { display: block; width: 1080px; height: 1350px; border: 0; transform-origin: top left; pointer-events: none; }
.admin-template-copy { min-width: 0; }
.admin-template-copy h2 { margin: 0 0 5px; font-size: 17px; font-weight: 650; letter-spacing: -.02em; overflow-wrap: anywhere; }
.admin-template-copy p { max-width: 68ch; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.admin-template-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; margin-top: 10px; color: var(--dim); font-size: 11px; }
.admin-template-actions { display: flex; align-items: center; justify-content: end; flex-wrap: wrap; gap: 7px; }
.admin-status { display: inline-flex; padding: 4px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: capitalize; }
.admin-style-layout { display: grid; grid-template-columns: minmax(235px, .68fr) minmax(0, 1.8fr); gap: 18px; align-items: start; }
.admin-style-list { min-width: 0; padding: 15px; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--panel); }
.admin-style-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.admin-style-list-head h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.015em; }
.admin-style-count { display: inline-grid; min-width: 24px; height: 24px; place-items: center; padding-inline: 6px; border-radius: 6px; background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 650; }
.admin-style-rows { display: grid; gap: 6px; }
.admin-style-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.admin-style-row > button:last-child { min-height: 32px; padding-inline: 8px; font-size: 10px; }
.admin-style-row .style-library-item {
  width: 100%; min-width: 0; min-height: 54px; padding: 8px; border: 1px solid transparent;
  border-radius: 7px; background: transparent; gap: 10px; text-align: left;
}
.admin-style-row .style-library-item:hover { border-color: var(--line); background: var(--panel-2); transform: none; }
.admin-style-row .style-library-item[aria-pressed="true"] { border-color: color-mix(in srgb, var(--gold) 42%, transparent); background: var(--gold-soft); }
.admin-style-row .style-swatch { width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid color-mix(in srgb, var(--style-fg) 22%, transparent); border-radius: 6px; }
.admin-style-row .style-copy { gap: 4px; }
.admin-style-row .style-copy strong { font-size: 12px; }
.admin-style-row .style-copy small { color: var(--muted); font-size: 11px; letter-spacing: 0; text-transform: none; }
.admin-style-workbench { display: grid; grid-template-columns: minmax(250px, .82fr) minmax(0, 1.18fr); gap: 14px; align-items: start; }
.admin-style-preview, .admin-style-editor { min-width: 0; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--panel); }
.admin-style-preview { position: sticky; top: 82px; display: grid; justify-items: center; gap: 14px; padding: 14px; }
.admin-style-preview-frame { width: min(100%, 360px); aspect-ratio: 4 / 5; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); }
.admin-style-preview iframe { display: block; width: 1080px; height: 1350px; border: 0; transform-origin: top left; pointer-events: none; }
.admin-style-preview label { display: grid; width: 100%; max-width: 360px; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 600; }
.admin-style-preview select { width: 100%; }
.admin-style-editor { padding: 16px; }
.admin-style-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.admin-style-editor-head h2 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.035em; overflow-wrap: anywhere; }
.admin-style-editor-head p { max-width: 38ch; margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.admin-style-editor-state { flex: 0 0 auto; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 10px; font-weight: 650; text-transform: capitalize; }
.admin-style-form { display: grid; gap: 12px; }
.admin-style-form fieldset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin: 0; padding: 13px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel-2); }
.admin-style-form legend { float: none; width: auto; grid-column: 1 / -1; margin: 0; padding: 0 5px; color: var(--text); font-size: 11px; font-weight: 700; }
.admin-style-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 600; }
.admin-style-form input, .admin-style-form select, .admin-style-form textarea {
  width: 100%; min-width: 0; min-height: 38px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--field);
  color: var(--text); font: inherit; font-size: 12px;
}
.admin-style-form input[type="color"] { min-height: 42px; padding: 4px; cursor: pointer; }
.admin-style-form .admin-form-wide { grid-column: 1 / -1; }
.admin-style-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; padding-top: 2px; }
.admin-empty { padding: 24px 0; color: var(--muted); }
.feedback-admin-toolbar { display: flex; flex-wrap: wrap; gap: 9px; }
.feedback-admin-toolbar select, .feedback-admin-toolbar input {
  min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-soft); border-radius: 7px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 12px;
}
.feedback-admin-toolbar input { flex: 1 1 220px; min-width: 180px; }
.feedback-admin-list { display: grid; gap: 10px; }
.feedback-admin-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--panel); }
.feedback-admin-card-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.feedback-admin-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.feedback-admin-meta strong { color: var(--text); font-weight: 650; }
.feedback-admin-card select { min-height: 35px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--text); font: inherit; font-size: 11px; }
.feedback-admin-message { margin: 0; color: var(--text); font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-admin-context { color: var(--dim); font-size: 10px; }
.admin-style-empty { margin: 0; padding: 14px 4px; font-size: 12px; }
.admin-message { margin: 0; padding: 11px 13px; border-left: 2px solid var(--gold); background: var(--panel); color: var(--text); font-size: 13px; line-height: 1.5; }
.admin-message.error { border-left-color: var(--red); }
.admin-catalog :is(button, input, select, textarea):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (max-width: 1120px) {
  .view-admin { width: min(100%, 1080px); padding-inline: 22px; }
  .admin-style-layout { grid-template-columns: minmax(210px, .68fr) minmax(0, 1.7fr); gap: 14px; }
  .admin-style-workbench { grid-template-columns: minmax(0, 1fr); }
  .admin-style-preview { position: static; grid-template-columns: minmax(0, 1fr) minmax(160px, .8fr); align-items: end; }
  .admin-style-preview-frame { width: min(100%, 300px); }
  .admin-style-preview label { max-width: none; }
}

@media (max-width: 960px) {
  .admin-style-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-style-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .admin-style-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-style-rows { grid-template-columns: minmax(0, 1fr); }
  .admin-style-workbench { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
  .admin-style-preview { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }
  .admin-style-preview-frame { width: min(100%, 260px); }
}

@media (prefers-reduced-motion: reduce) {
  .admin-catalog *,
  .admin-catalog *::before,
  .admin-catalog *::after { scroll-behavior: auto; transition-duration: .01ms; }
}

@media (max-width: 560px) {
  .view-dashboard { width: 100%; padding: 28px 24px 64px; }
  .dashhero { grid-template-columns: minmax(0, 1fr); gap: 22px; margin-bottom: 30px; }
  .dashhero-copy { padding: 6px 0; }
  .dashhero-copy h1 { font-size: 44px; }
  .dashhero-copy > p:last-child { margin-top: 12px; font-size: 14px; }
  .dashhero-action { min-height: 220px; padding: 22px; }
  .dashhero-action-copy h2 { font-size: 24px; }
  .dashsectionhead { align-items: center; flex-wrap: wrap; padding-top: 18px; }
  .dashsection-tools { width: 100%; justify-content: space-between; }
  .dashsection-tools { flex-wrap: wrap; }
  .feedback-fab {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    min-height: 50px; padding-inline: 16px;
  }
  .feedback-admin-card-head { flex-direction: column; }
  .feedback-dialog form { padding: 20px; }
  .deckgrid { grid-template-columns: 1fr; }
  .view-admin { width: 100%; padding: 26px 14px 56px; }
  .admin-catalog-head { align-items: start; flex-direction: column; gap: 16px; }
  .admin-nav { gap: 0; }
  .admin-nav button { min-height: 42px; padding-inline: 10px; font-size: 12px; }
  .admin-template-row { grid-template-columns: 62px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .admin-template-preview { width: 62px; height: 78px; }
  .admin-template-actions { grid-column: 1 / -1; justify-content: start; }
  .admin-style-workbench { grid-template-columns: minmax(0, 1fr); }
  .admin-style-preview { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .admin-style-preview-frame { width: min(100%, 220px); }
  .admin-style-editor { padding: 13px; }
  .admin-style-form fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 11px; }
  .admin-style-form .admin-form-wide { grid-column: 1 / -1; }
  .admin-style-row { grid-template-columns: minmax(0, 1fr) auto; }
  .admin-style-row > button:last-child { min-height: 34px; }
  .admin-toolbar { align-items: stretch; }
  .admin-filters { overflow-x: auto; flex-wrap: nowrap; padding: 2px 0 4px; }
  .admin-filters button { flex: 0 0 auto; }
  .admin-search { flex-basis: 100%; max-width: none; }

  .view-auth { padding: 36px 16px 56px; }
  .authcard { padding: 24px 20px; border-radius: 12px; }

  .view-compose { padding: 36px 12px 56px; }
  .hero { margin-bottom: 30px; }
  .hero p { font-size: 14.5px; }
  .hero p br { display: none; }
  .composer { padding: 14px; border-radius: 14px; }
  .urlrow { flex-direction: column; }
  .urlrow input { min-width: 0; }
  #peekBtn { width: 100%; height: 40px; }
  .knobs { gap: 14px 12px; }
  .styles { max-width: none; gap: 8px; }
  .gallery { grid-template-columns: 1fr; }

  .editbar {
    height: auto; min-height: 52px; flex-wrap: wrap;
    gap: 8px; padding: 8px 14px;
  }
  #backBtn { flex: 0 0 auto; }
  .titlebox { min-width: 0; max-width: none; }
  .editbar-right {
    order: 3; width: 100%; min-width: 0; margin-left: 0; gap: 8px;
    overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 3px;
  }
  .editbar-right > * { flex: 0 0 auto; }
  .workspace { height: auto; }
  .rail {
    min-height: 120px; padding: 8px; gap: 8px;
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity;
  }
  .rthumb { scroll-snap-align: start; }
  .railfoot {
    position: sticky; right: 0; bottom: auto; align-self: stretch;
    flex-direction: column; justify-content: center; margin: 0; padding: 8px;
    border-left: 1px solid var(--line-soft); background: var(--panel);
  }
  .stage { height: min(58svh, 520px); min-height: 360px; padding: 12px; gap: 10px; }
  .panel { min-height: 560px; }
  .panel-body { padding: 14px 14px 28px; }
}
@media (max-width: 480px) { .editbar { padding-inline: 12px; } }
@media (max-width: 340px) { .editbar { padding-inline: 6px; } }
@media (prefers-reduced-motion: reduce) {
  .feedback-fab { transition: none; }
}

/* header credits pill */
.pill.credits b { color: var(--gold, #c8a24a); }
.email { color: var(--dim); font-size: 13px; align-items: center; }

/* ============================================================= WEEK B — EDITBAR */

/* Autosave state. Deliberately quiet: it is reassurance, not a control, so it
   never takes colour except while something is actually pending. */
.autostate { font-size: 12px; font-weight: 600; color: var(--dim); }
.autostate.pending { color: var(--amber); }
.autostate.saved { color: var(--dim); }
.autostate.failed { color: var(--red); }

.undogroup { display: flex; gap: 4px; }
.btn-ghost.icon { width: 30px; padding: 0; font-size: 15px; line-height: 1; }
.btn-ghost.icon:disabled { opacity: .32; cursor: default; }

/* Download menu. A popup rather than three buttons in the bar: the bar is
   already at five controls and only one of the three is ever wanted at a time. */
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 190px; padding: 5px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px;
}
.menu-pop button {
  all: unset; box-sizing: border-box;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--text); text-align: left;
}
.menu-pop button:hover { background: var(--raise); }
.menu-pop button:disabled { color: var(--dim); cursor: default; background: none; }
.caret { font-size: 10px; opacity: .8; }

/* ======================================================= WEEK B — BRAND + AI */

/* Saved brands. Rows, not cards: this is a list you scan and pick from, and the
   panel is 300px wide — a card grid here would fit one card per row anyway. */
.brandrow {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.brandrow:last-of-type { border-bottom: 0; }
.brandrow .who { min-width: 0; font-size: 13px; }
.brandrow .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brandrow .who span { color: var(--dim); font-size: 11.5px; }
.brandrow-logo, .brand-logo-preview {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  object-fit: cover; overflow: hidden;
}
.brand-logo-field { margin: 4px 0 16px; }
.brand-logo-label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 600; }
.brand-logo-row { display: flex; align-items: center; gap: 10px; }
.brand-logo-preview {
  display: grid; place-items: center; background: var(--gold); color: var(--ink);
  font-size: 15px; font-weight: 700;
}
.brand-logo-preview img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.brand-logo-upload { position: relative; display: inline-flex; align-items: center; }
.brand-logo-upload input {
  position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0;
  clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.brand-logo-upload:focus-within { outline: 2px solid var(--gold); outline-offset: 3px; }
.brand-logo-status { margin: 7px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.brand-logo-status:empty { display: none; }
.brandrow .acts { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.brandrow .acts .linkbtn { font-size: 11.5px; }
.brandrow.isdefault .who b::after { content: " ★"; color: var(--gold); font-size: 11px; }
.defaultflag { font-size: 11px; color: var(--gold); }
.brandactions { display: flex; gap: 14px; margin-top: 12px; }
.brandactions .linkbtn { font-size: 12px; }

/* AI tab. Presets wrap into a soft grid; each one is a whole action, so they get
   real buttons rather than chips that look like filters. */
.aipresets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.aipresets .btn-ghost.sm { font-size: 12px; padding: 6px 11px; }
#tabAi .btn-go { height: 44px; margin-top: 4px; }
.ainote { margin: 12px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); min-height: 1em; }
.ainote.good { color: var(--gold); }
.ainote.bad { color: var(--red); }
