/* =========================================================================
   AI Graphics Studio — EasyAI Solutions brand
   Swap the values in :root to re-brand the whole app.
   ========================================================================= */

:root {
  /* brand — change these three and the app follows */
  --ink:        #0e0f13;   /* deep charcoal */
  --paper:      #f6f6f7;   /* soft white */
  --accent:     #ff5a1f;   /* primary orange */

  --ink-soft:   #6b6f76;   /* slate gray */
  --ink-faint:  #9aa0a8;
  --line:       #e6e7ea;   /* light gray */
  --card:       #ffffff;
  --card-2:     #f1f2f4;
  --danger:     #b42318;
  --ok:         #067647;

  /* the dark sidebar keeps its own pair so it stays dark in both themes */
  --nav-bg:     #0e0f13;
  --nav-ink:    #f6f6f7;
  --nav-soft:   #9aa0a8;

  --radius:     10px;
  --radius-lg:  16px;
  --shadow:     0 1px 2px rgba(14,15,19,.05), 0 8px 24px rgba(14,15,19,.06);
  --shadow-lg:  0 24px 64px rgba(14,15,19,.22);

  --serif: "Playfair Display", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1080px;
  --sidebar: 248px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:      #f6f6f7;
    --paper:    #0e0f13;
    --accent:   #ff7a4d;
    --ink-soft: #a2a8b0;
    --ink-faint:#7a808a;
    --line:     #24262c;
    --card:     #16181d;
    --card-2:   #1d2026;
    --nav-bg:   #16181d;
    --shadow:   0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.28);
    --shadow-lg:0 24px 64px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink:      #f6f6f7;
  --paper:    #0e0f13;
  --accent:   #ff7a4d;
  --ink-soft: #a2a8b0;
  --ink-faint:#7a808a;
  --line:     #24262c;
  --card:     #16181d;
  --card-2:   #1d2026;
  --nav-bg:   #16181d;
  --shadow:   0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.28);
  --shadow-lg:0 24px 64px rgba(0,0,0,.55);
  color-scheme: dark;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.content { min-width: 0; }

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky; top: 0; align-self: start; z-index: 40;
  height: 100vh; display: flex; flex-direction: column; gap: 26px;
  padding: 26px 16px 20px max(16px, env(safe-area-inset-left));
  background: var(--nav-bg); color: var(--nav-ink);
}

/* the wordmark: "EasyAI" over "Solutions", with the product name beneath */
.brand { display: block; text-decoration: none; padding: 0 10px; }
.wordmark {
  display: block; font-weight: 700; font-size: 25px; line-height: 1.04;
  letter-spacing: -.03em;
}
.wordmark b { display: block; font-weight: 700; color: var(--nav-ink); }
.wordmark i { display: block; font-style: normal; color: var(--accent); }
.brand-sub {
  display: block; margin-top: 7px; font-size: 11.5px; letter-spacing: .01em;
  color: var(--nav-soft);
}

.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius);
  text-decoration: none; font-size: 14px; font-weight: 500; color: var(--nav-soft);
  transition: background .14s ease, color .14s ease;
}
.sidenav a:hover { background: rgba(255,255,255,.06); color: var(--nav-ink); }
.sidenav a.on { background: var(--accent); color: #fff; font-weight: 600; }
.sidenav .nav-ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .side-foot { margin-top: auto; padding: 0 4px; }
.sidebar #install {
  width: 100%; background: transparent; color: var(--nav-soft);
  border-color: rgba(255,255,255,.16);
}
.sidebar #install:hover { color: var(--nav-ink); border-color: rgba(255,255,255,.4); }

@media (max-width: 860px) {
  :root { --sidebar: 210px; }
  .wordmark { font-size: 22px; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 14px; padding: 12px max(16px, env(safe-area-inset-left));
  }
  .sidenav, .sidebar .side-foot { display: none; }
  .brand { padding: 0; }
  .wordmark { font-size: 19px; line-height: 1.05; }
  .brand-sub { margin-top: 3px; font-size: 11px; }
}

/* ---------- bottom tab bar (mobile) ---------- */
.tabbar { display: none; }
@media (max-width: 720px) {
  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 40;
    /* full: + Optimise · lite: + Upgrade — six either way */
    display: grid; grid-template-columns: repeat(6, 1fr);
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    text-align: center; text-decoration: none; font-size: 11.5px; padding: 12px 2px;
    color: var(--ink-faint);
  }
  .tabbar a.on { color: var(--accent); font-weight: 600; }
  body { padding-bottom: 76px; }
}

/* ---------- layout ---------- */
main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 8px max(18px, env(safe-area-inset-left)) 64px max(18px, env(safe-area-inset-right));
}
.foot {
  max-width: var(--wrap); margin: 0 auto 40px; padding: 24px 18px 0;
  border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 13px;
}
@media (max-width: 720px) { .foot { margin-bottom: 90px; } }

/* ---------- typography ---------- */
h1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 44px); line-height: 1.1; letter-spacing: -.015em; margin: 0 0 12px; font-weight: 700; }
h1 em { font-style: italic; color: var(--accent); }
h2 { font-size: 19px; letter-spacing: -.01em; margin: 0 0 6px; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
p  { margin: 0 0 12px; }
.eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 650; margin-bottom: 10px; }
.lede { font-size: 17px; color: var(--ink-soft); max-width: 60ch; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.xs { font-size: 12.5px; }
.prose p { max-width: 68ch; color: var(--ink-soft); }
.prose h3 { margin-top: 18px; color: var(--ink); }

/* ---------- hero ---------- */
.hero { padding: 48px 0 32px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.hero.small { padding: 36px 0 20px; }
.hero .row { margin-top: 22px; }

/* ---------- dashboard ---------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; padding: 34px 0 24px;
}
.page-head > div:first-child { flex: 1 1 360px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { margin: 0; }
.page-head .row { flex: 0 0 auto; padding-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 34px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow);
}
.stat-badge {
  width: 38px; height: 38px; border-radius: 50%; margin-bottom: 14px;
  display: grid; place-items: center; background: var(--card-2);
}
.stat-badge .ic { width: 18px; height: 18px; margin: 0; stroke: var(--ink-soft); }
.stat.hot .stat-badge { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.stat.hot .stat-badge .ic { stroke: var(--accent); }
.stat b {
  display: block; font-size: 30px; font-weight: 700; line-height: 1.1;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.stat span { display: block; margin-top: 5px; font-size: 13px; color: var(--ink-soft); line-height: 1.35; }

/* ---------- blocks & panels ---------- */
.block { margin-bottom: 44px; }
.block > h2 { margin-bottom: 14px; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.panel > .muted:last-child { margin-bottom: 0; }
.panel.note { background: var(--card-2); }
.panel-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.panel-head p { margin-bottom: 0; }
.cat-head { display: flex; align-items: center; gap: 10px; }
.cat-head h2 { margin: 0; }
.ic { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 100px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font-size: 14.5px; font-weight: 550; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: transparent; }
.btn.tiny { padding: 5px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { background: none; border: 0; font-size: 18px; cursor: pointer; padding: 6px 10px; border-radius: 8px; color: var(--ink-soft); }
.icon-btn:hover { background: var(--card-2); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cards.small { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card {
  display: block; text-align: left; text-decoration: none; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--ink-faint); }
.card h3 { margin-bottom: 6px; }
.card p { margin-bottom: 8px; }
.card-top { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.pill {
  display: inline-block; font-size: 11.5px; font-weight: 650; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 100px; background: var(--card-2);
  border: 1px solid var(--line); color: var(--ink-soft); white-space: nowrap;
}
.pill.soft { background: transparent; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 12px 0 8px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s ease; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.panel .list { margin-top: 14px; }
.row-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 14px 16px; cursor: pointer; transition: background .12s ease;
}
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: var(--card-2); }
.row-item.static { cursor: default; }
.row-item.static:hover { background: none; }
.row-item p { margin: 2px 0 0; }
.row-item strong { font-weight: 600; }
.row-actions { display: flex; gap: 6px; flex: none; }
.chev { color: var(--ink-faint); font-size: 20px; flex: none; }
.star { color: var(--line); font-size: 18px; flex: none; padding: 2px 6px; border-radius: 6px; }
.star:hover { color: var(--ink-faint); }
.star.on { color: var(--accent); }
.tag { display: inline-block; margin-top: 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }

.empty { text-align: center; padding: 36px 20px; border: 1px dashed var(--line); border-radius: var(--radius-lg); color: var(--ink-soft); }
.empty p { max-width: 46ch; margin: 0 auto 16px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink-soft); }
.field.wide { grid-column: 1 / -1; }
.field.inline { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.field.inline > span { margin: 0; white-space: nowrap; }
.field.compact > span { font-size: 12px; }
input[type="text"], input:not([type]), input[type="password"], input[type="search"], textarea, select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 15px;
  background: var(--card-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.disabled { opacity: .45; pointer-events: none; }

.switch { position: relative; display: inline-block; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 100px; cursor: pointer; transition: background .18s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; background: #fff; border-radius: 50%; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(19px); }

.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chips.wrap { gap: 6px; }
.chip {
  padding: 6px 13px; border-radius: 100px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--ink-faint); font-size: 13px; cursor: pointer;
  transition: all .12s ease;
}
.chip:hover { border-color: var(--ink-faint); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.ptypes { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.ptype {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px; text-align: left;
  padding: 14px; background: var(--card-2); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer; font: inherit; color: inherit;
  transition: all .12s ease;
}
.ptype:hover { border-color: var(--ink-faint); }
.ptype.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ptype.locked { opacity: .62; }
.ptype strong { font-size: 14.5px; }
.ptype .ic { margin-bottom: 2px; }

.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stage { display: flex; align-items: center; gap: 9px; padding: 11px 13px; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; cursor: pointer; }
.stage input { accent-color: var(--accent); width: 17px; height: 17px; }

.checks { display: grid; gap: 8px; margin-bottom: 18px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: 14.5px; }
.check input { accent-color: var(--accent); width: 17px; height: 17px; margin-top: 2px; flex: none; }
.check:hover { border-color: var(--ink-faint); }
.sticky-actions { justify-content: flex-end; }
.sticky-actions .muted { margin-right: auto; }

.danger-zone { display: flex; gap: 10px; flex-wrap: wrap; background: transparent; box-shadow: none; border-style: dashed; }

.warn-note {
  font-size: 13.5px; color: var(--ink-soft); background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin: 12px 0 0;
}

/* ---------- project ---------- */
.proj-head { padding: 26px 0 14px; }
.proj-head .back { font-size: 13.5px; color: var(--ink-soft); text-decoration: none; }
.proj-head .back:hover { color: var(--ink); }
.proj-head h1 { margin: 10px 0 4px; font-size: clamp(26px, 4vw, 36px); outline: none; border-radius: 6px; }
.proj-head h1:focus { box-shadow: 0 0 0 2px var(--accent); padding: 0 6px; margin-left: -6px; }
.tabs {
  display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line);
  margin-bottom: 24px; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 10px 15px; text-decoration: none; font-size: 14.5px; color: var(--ink-soft);
  white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.preview {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; max-height: 320px; overflow: auto; color: var(--ink-soft);
}
.count { margin: -6px 0 12px; }
.filters { margin-bottom: 18px; }
.filters input { margin-bottom: 12px; }

/* ---------- help / quick reference ---------- */
.jump {
  display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px;
  padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.jump a {
  text-decoration: none; font-size: 13px; padding: 6px 13px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
}
.jump a:hover { border-color: var(--ink-faint); color: var(--ink); }
.jump a.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.panel.help { scroll-margin-top: 80px; }
.panel.help > h2 { font-family: var(--serif); font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.panel.help > *:last-child { margin-bottom: 0; }
.panel.help p { max-width: 68ch; }

.steps { counter-reset: step; list-style: none; margin: 0 0 14px; padding: 0; }
.steps li {
  counter-increment: step; position: relative; padding: 0 0 14px 42px;
  color: var(--ink-soft); max-width: 66ch;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 27px; height: 27px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card-2); border: 1px solid var(--line);
  color: var(--accent); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.steps li:last-child { padding-bottom: 0; }
.steps strong { color: var(--ink); }

.deflist { margin: 0 0 8px; display: grid; grid-template-columns: minmax(140px, 210px) 1fr; gap: 0; }
.deflist dt {
  font-weight: 650; font-size: 14.5px; padding: 11px 16px 11px 0;
  border-top: 1px solid var(--line);
}
.deflist dd {
  margin: 0; padding: 11px 0; color: var(--ink-soft); font-size: 14.5px;
  border-top: 1px solid var(--line);
}
.deflist dt:first-of-type, .deflist dd:first-of-type { border-top: 0; }
@media (max-width: 640px) {
  .deflist { grid-template-columns: 1fr; }
  .deflist dt { padding: 12px 0 2px; }
  .deflist dd { padding: 0 0 12px; border-top: 0; }
}
.deflist.keys dt { padding-top: 12px; }
kbd {
  display: inline-block; font-family: var(--mono); font-size: 12.5px;
  padding: 3px 9px; border-radius: 6px; background: var(--card-2);
  border: 1px solid var(--line); box-shadow: 0 1px 0 var(--line); color: var(--ink);
}

.faq details {
  border-top: 1px solid var(--line);
}
.faq details:first-child { border-top: 0; }
.faq summary {
  cursor: pointer; padding: 13px 26px 13px 0; font-weight: 600; font-size: 14.5px;
  list-style: none; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 11px;
  color: var(--accent); font-size: 19px; font-weight: 400; line-height: 1;
  transition: transform .18s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--accent); }
.faq details p { padding: 0 0 14px; margin: 0; font-size: 14.5px; }

.table-wrap { overflow-x: auto; margin-bottom: 12px; }
table.ref { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.ref th {
  text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 650; padding: 0 14px 8px 0;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.ref td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
table.ref tr:last-child td { border-bottom: 0; }
table.ref td:first-child { color: var(--ink); }
table.ref .num { font-family: var(--mono); font-size: 13px; white-space: nowrap; }

.layers { list-style: none; counter-reset: layer; margin: 0 0 14px; padding: 0; }
.layers li {
  counter-increment: layer; position: relative;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  padding: 12px 14px 12px 46px; margin-bottom: 5px;
  background: var(--card-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
}
.layers li::before {
  content: counter(layer);
  position: absolute; left: 16px; top: 12px;
  color: var(--accent); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.layers span { color: var(--ink-soft); font-size: 14px; }

/* ---------- Lite tier & upgrade UI ---------- */
.lite-only { display: none; }
html[data-tier="lite"] .full-only { display: none; }
/* .sidenav a sets display:flex, so the hide rule has to match that specificity */
.sidenav a.lite-only { display: none; }
html[data-tier="lite"] .sidenav a.lite-only { display: flex; }
html[data-tier="lite"] .tabbar .lite-only { display: block; }
html[data-tier="lite"] .tabbar { grid-template-columns: repeat(6, 1fr); }

.sidenav a.upgrade-link { color: var(--accent); font-weight: 600; }
.sidenav a.upgrade-link:hover { color: #fff; }
.sidenav a.upgrade-link.on { background: var(--accent); color: #fff; }

.btn.small { padding: 7px 15px; font-size: 13.5px; }

.pro {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .08em;
  padding: 2px 6px; border-radius: 5px; vertical-align: middle; margin-left: 6px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

.ribbon {
  display: block; width: 100%; text-align: left; text-decoration: none; cursor: pointer;
  font: inherit; margin-bottom: 28px;
  padding: 13px 18px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  color: var(--ink-soft); font-size: 14px; line-height: 1.5;
}
.ribbon strong { color: var(--ink); }
.ribbon span { color: var(--accent); font-weight: 650; white-space: nowrap; }
.ribbon:hover { border-color: var(--accent); }

.row-item.locked strong { color: var(--ink-soft); }
.row-item.locked:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.card.kit.locked h3, .card.locked h3 { color: var(--ink-soft); }
.card.kit.locked:hover, .card.locked:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.locked-panel { cursor: pointer; border-style: dashed; }
.locked-panel:hover { border-color: var(--accent); }
.locked-panel h2 { margin-bottom: 6px; }
.preview-locked { opacity: .45; pointer-events: none; margin: 12px 0 16px; }
.lead-blurb { font-size: 16px; color: var(--ink); }

.lock-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; margin-left: 3px; }

.upgrade-cta {
  display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.upgrade-cta h2 { margin-bottom: 4px; }
.upgrade-cta > div { flex: 1 1 300px; }
.upgrade-cta p { margin-bottom: 0; }

.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.ticks li { position: relative; padding-left: 28px; color: var(--ink-soft); }
.ticks li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--accent); font-weight: 800; }

table.compare th:not(:first-child), table.compare td:not(.feat) { text-align: center; }
table.compare td.feat { color: var(--ink); }
table.compare .yes { color: var(--ok); font-weight: 700; }
table.compare .no  { color: var(--ink-faint); }
table.compare th, table.compare td { padding: 9px 12px; }

/* ---------- image optimiser ---------- */
.opt-drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--card-2); padding: 26px 18px; text-align: center;
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.opt-drop:hover, .opt-drop.over, .opt-drop:focus-visible {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--card));
}
.opt-drop strong { display: block; font-size: 16px; margin-bottom: 4px; }
.opt-drop p { margin: 0; }
.opt-thumb {
  width: 56px; height: 56px; flex: none; object-fit: contain; border-radius: 8px;
  border: 1px solid var(--line); margin-right: 12px;
  background: var(--card-2) repeating-conic-gradient(#0000 0% 25%, rgba(128,128,128,.13) 0% 50%) 50% / 12px 12px;
}
.opt-meta { flex: 1; min-width: 0; }
.opt-meta strong { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.opt-save { color: var(--ok); font-weight: 650; }
.opt-grow { color: var(--danger); font-weight: 650; }
.opt-bar { height: 5px; background: var(--card-2); border-radius: 100px; overflow: hidden; margin-top: 14px; }
.opt-bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
.opt-tweaks details { border-top: 1px solid var(--line); margin-top: 6px; }
.opt-tweaks summary { padding-bottom: 14px; }
.opt-tweaks .field.inline input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
/* these labels are sentences, not field names — let them wrap on a phone */
.opt-tweaks .field.inline > span { white-space: normal; }
.opt-tweaks input[type="range"] { accent-color: var(--accent); padding: 0; }

/* ---------- studio sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: rgba(14, 15, 19, .5); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 24px;
}
.overlay.open { display: flex; }
.sheet {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 720px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: rise .22s cubic-bezier(.2,.8,.3,1);
}
.sheet.wide { max-width: 820px; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 700; }
.sheet-head p { margin: 4px 0 0; }
.sheet-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.sheet-body .list { margin-top: 0; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--card); }
#studio-text { font-family: var(--mono); font-size: 13px; line-height: 1.6; min-height: 240px; }
.studio-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 12px; }
.studio-meta .field { margin-bottom: 0; }
.studio-meta select { padding: 5px 28px 5px 10px; font-size: 13px; }
.kit-row strong { font-weight: 600; }

/* ---------- creative direction ---------- */
.mod-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px 18px; margin: 12px 0 4px;
}
.mod-field { margin-bottom: 0; }
.mod-field > span { display: flex; align-items: center; gap: 6px; min-width: 78px; }
.mod-field select { flex: 1 1 auto; min-width: 0; padding: 6px 28px 6px 10px; font-size: 13px; }
.mod-field optgroup { font-style: normal; color: var(--ink-faint); }

.studio-direction {
  margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card-2);
}
.dir-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.dir-head h3 { margin: 0; font-size: 14px; font-weight: 600; }

.dir-preview { margin: 10px 0 0; font-size: 13px; }
.dir-preview > summary {
  cursor: pointer; color: var(--ink-soft); font-size: 12px;
  padding: 4px 0; list-style: none;
}
.dir-preview > summary::-webkit-details-marker { display: none; }
.dir-preview > summary::before { content: "▸ "; color: var(--ink-faint); }
.dir-preview[open] > summary::before { content: "▾ "; }
.dir-preview dl { margin: 6px 0 0; }
.dir-preview dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin-top: 8px; }
.dir-preview dd { margin: 2px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-soft); }
.dir-none { margin: 8px 0 0; }

.dir-recipes { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.dir-recipes .field { margin-bottom: 0; }
.dir-recipes select { padding: 5px 28px 5px 10px; font-size: 13px; }

.basemode { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.bm-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.basemode .chips { margin-bottom: 0; }

.scene-builder {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 18px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}

.extract-row { flex-direction: column; align-items: flex-start; gap: 8px; }
.extract-row p { margin: 0; }

@media (max-width: 640px) {
  .mod-grid, .scene-builder { grid-template-columns: 1fr; }
}

.generating { display: flex; align-items: center; gap: 10px; padding: 20px; color: var(--ink-soft); font-size: 14px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result { margin: 16px 0 0; }
.result img { border-radius: var(--radius); border: 1px solid var(--line); }
.result figcaption { margin-top: 10px; }

@media (max-width: 640px) {
  .overlay { padding: 0; align-items: flex-end; }
  .sheet { max-height: 94vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .sheet-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .sheet-foot .btn { flex: 1 1 auto; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: 100px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 80;
  box-shadow: var(--shadow-lg); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: var(--danger); color: #fff; }
@media (max-width: 640px) { .toast { bottom: 90px; } }

/* ---------- print ---------- */
@media print {
  .sidebar, .tabbar, .foot, .overlay, .toast, .tabs, .btn, .row-actions, .jump, .hero .row { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
  .panel { break-inside: avoid; border: 0; box-shadow: none; padding: 0; margin-bottom: 22px; }
  .panel.help > h2 { border-bottom: 1px solid #ccc; padding-bottom: 4px; }
  .faq summary::after { content: ""; }
  .layers li, .check, .stage { border-left-color: #888; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
