/* The AI Vault: premium editorial, flat, no gradients */
:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --panel-2: #efece4;
  --line: #e2dcd0;
  --line-2: #d4cdbe;
  --ink: #191713;
  --ink-2: #524d44;
  --ink-3: #8b8474;
  --accent: #175d4d;
  --accent-ink: #f5faf8;
  --accent-soft: #e3eeea;
  --star: #a97d10;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(25, 23, 19, .05);
  --shadow-lift: 0 6px 18px -6px rgba(25, 23, 19, .14);
  --sidebar-w: 256px;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  --bg: #141519;
  --panel: #1b1d22;
  --panel-2: #23262c;
  --line: #2d3138;
  --line-2: #3a3f48;
  --ink: #eae8e3;
  --ink-2: #b2ada4;
  --ink-3: #7f8894;
  --accent: #57c3ab;
  --accent-ink: #0e211d;
  --accent-soft: #1e302c;
  --star: #d9a441;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lift: 0 8px 22px -8px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--accent-soft); }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 24px 14px 18px;
  z-index: 40;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px 22px; }
.brand-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 9px; font-size: 16px; letter-spacing: -1px;
}
.brand h1 { font-family: var(--display); font-size: 19px; margin: 0; font-weight: 600; letter-spacing: .1px; }
.brand-sub { margin: 2px 0 0; font-size: 10.5px; color: var(--ink-3); letter-spacing: .07em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left;
  padding: 9px 10px;
  background: none; border: 0; border-radius: 8px;
  color: var(--ink-2); font-size: 14px;
}
.nav-item:hover { background: var(--panel-2); color: var(--ink); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-count { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nav-item.is-active .nav-count { color: var(--accent); }

.nav-sep {
  margin: 14px 0 4px; padding: 0 10px;
  font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
}

.side-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.side-stat { margin: 0; padding: 0 8px; font-size: 11.5px; color: var(--ink-3); }
.ghost-btn {
  width: 100%; padding: 8px 10px;
  background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-2); font-size: 13px;
}
.ghost-btn:hover { background: var(--panel-2); color: var(--ink); }

/* ---------- main ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.search-wrap { position: relative; flex: 1; max-width: 660px; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round;
}
#search {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font: inherit; font-size: 14px;
  outline: none;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#search::-webkit-search-cancel-button { display: none; }
.clear-kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px;
}
.icon-btn { background: none; border: 0; font-size: 19px; padding: 4px 8px; color: var(--ink-2); }
.only-mobile { display: none; }

.content { padding: 30px 28px 90px; max-width: 1220px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { font-family: var(--display); font-size: 29px; font-weight: 600; margin: 0 0 3px; letter-spacing: .1px; }
.sec-sub { margin: 0; color: var(--ink-3); font-size: 13px; }

/* export menu */
.dl { position: relative; flex: none; }
.dl summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 7px 14px; font-size: 13px; color: var(--ink-2);
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.dl summary::-webkit-details-marker { display: none; }
.dl summary::after { content: " ▾"; font-size: 10px; color: var(--ink-3); }
.dl summary:hover { border-color: var(--accent); color: var(--accent); }
.dl-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  min-width: 200px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column;
}
.dl-menu button {
  text-align: left; padding: 8px 10px; font-size: 13px;
  background: none; border: 0; border-radius: 7px; color: var(--ink-2);
}
.dl-menu button:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.chip {
  padding: 5px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-2); font-size: 12.5px; white-space: nowrap;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 13px; }
.card {
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 17px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-2); }
.card-top { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.card-title { font-family: var(--display); font-size: 16px; font-weight: 600; margin: 0; flex: 1; line-height: 1.35; }
.card-body {
  font-size: 13.5px; color: var(--ink-2); margin: 0;
  white-space: pre-wrap; word-break: break-word;
  max-height: 7.6em; overflow: hidden; position: relative;
}
.card-body.is-open { max-height: none; }
.card.is-clamped .card-body::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2em;
  background: var(--panel); opacity: .92;
}
.card-body.is-open::after { display: none !important; }
.card-body.mono { font-family: var(--mono); font-size: 12.2px; }

.tag {
  display: inline-block; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 2px 6px; margin: 0 5px 5px 0;
}
.tag.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.tags { margin-top: 10px; }

.card-actions { display: flex; gap: 6px; align-items: center; margin-top: 12px; }
.act {
  padding: 6px 12px; font-size: 12.5px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-2);
}
.act:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.act.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.act.primary:hover { opacity: .9; color: var(--accent-ink); }
.act.done { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.act.big { padding: 10px 20px; font-size: 14px; border-radius: 9px; }
.star {
  margin-left: auto; background: none; border: 0; font-size: 15px; line-height: 1;
  color: var(--ink-3); padding: 4px;
}
.star.is-on { color: var(--star); }
.link { color: var(--accent); text-decoration: none; font-size: 12.5px; word-break: break-all; }
.link:hover { text-decoration: underline; }

.thumb {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 8px; margin-bottom: 11px; background: var(--panel-2);
  border: 1px solid var(--line);
}
.thumb-ph {
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  color: var(--ink-3); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
}

.more-wrap { display: flex; justify-content: center; padding: 30px 0 10px; }
.more-btn {
  padding: 10px 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  color: var(--ink-2); font-size: 13.5px;
}
.more-btn:hover { border-color: var(--accent); color: var(--accent); }
.empty { color: var(--ink-3); font-size: 14px; }

/* ---------- home ---------- */
.home { display: flex; flex-direction: column; gap: 34px; }
.kicker {
  margin: 0 0 10px; font-size: 11px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
.hero { padding: 18px 0 4px; max-width: 760px; }
.hero-h {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(30px, 4.6vw, 46px); line-height: 1.12; letter-spacing: -.2px;
  margin: 0 0 14px;
}
.hero-sub { margin: 0 0 22px; color: var(--ink-2); font-size: 15.5px; max-width: 620px; }
.hero-cta { display: flex; gap: 8px; flex-wrap: wrap; }

.home-h { font-family: var(--display); font-size: 21px; font-weight: 600; margin: 0 0 4px; }
.home-sub { margin: 0 0 14px; color: var(--ink-3); font-size: 13px; }

.value {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; box-shadow: var(--shadow);
}
.value-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.value-head h3 { font-family: var(--display); font-size: 20px; font-weight: 600; margin: 0; }
.value-badge {
  flex: none; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 5px 12px;
}
.vrow {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.vrow:last-of-type { border-bottom: 0; }
.vname { font-weight: 500; }
.vmeta { color: var(--ink-3); font-size: 12.5px; }
.vdots { flex: 1; border-bottom: 1px dotted var(--line-2); transform: translateY(-4px); }
.vprice { color: var(--ink-3); font-variant-numeric: tabular-nums; text-decoration: line-through; text-decoration-color: var(--ink-3); }
.vtotal {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 14px; border-top: 2px solid var(--ink);
}
.vtotal strong { font-family: var(--display); font-size: 19px; }
.vtotal .strike { text-decoration: line-through; color: var(--ink-3); font-weight: 400; }
.vfree {
  margin-left: auto; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 8px; padding: 6px 14px;
}

.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 13px; }
.pack {
  text-align: left; display: flex; flex-direction: column; gap: 7px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.pack:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.pack-n { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.pack h4 { font-family: var(--display); font-size: 17.5px; font-weight: 600; margin: 0; }
.pack p { margin: 0; font-size: 13px; color: var(--ink-2); }
.pack-go { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--accent); }

.grid.one { grid-template-columns: minmax(0, 560px); }

/* ---------- image → prompt ---------- */
.rev { display: flex; flex-direction: column; gap: 18px; max-width: 860px; }
.rev-embed {
  grid-column: 1 / -1; max-width: none; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 8px;
}
.rev-embed-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.rev-embed-title h3 { font-family: var(--display); font-size: 19px; font-weight: 600; margin: 0 0 3px; }
.rev-embed-title p { margin: 0; font-size: 13px; color: var(--ink-3); max-width: 520px; }
.rev-embed .rev-setup { flex: none; }
.rev-embed .rev-field select, .rev-embed .rev-field input { min-width: 250px; }
.rev-embed .rev-drop { padding: 26px 20px; background: var(--bg); }
.rev-embed .rev-drop-big { font-size: 16px; }
.rev-embed .rev-preview { background: var(--bg); }
@media (max-width: 860px) { .rev-embed-head { align-items: stretch; flex-direction: column; } }

/* ---------- resell toolkit ---------- */
.nav-badge {
  background: var(--accent); color: var(--accent-ink);
  border-radius: 5px; padding: 1px 6px; font-size: 9.5px; font-weight: 700; letter-spacing: .06em;
}
.nav-item.is-active .nav-badge { background: var(--accent); color: var(--accent-ink); }

.resell { display: flex; flex-direction: column; gap: 26px; max-width: 1100px; }
.rs-hero {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 30px 32px; box-shadow: var(--shadow);
}
.rs-hero .hero-h { font-size: clamp(26px, 3.4vw, 36px); margin-bottom: 12px; }
.rs-hero .hero-sub { margin-bottom: 20px; max-width: 720px; }
.rs-kit-note { font-size: 12.5px; color: var(--ink-3); align-self: center; }

.rs-setup {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; box-shadow: var(--shadow);
}
.rs-setup h3 { font-family: var(--display); font-size: 19px; font-weight: 600; margin: 0 0 3px; }
.rs-setup .home-sub { margin-bottom: 16px; }
.rs-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 12px; }
.rs-fields .rev-field input {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 13.5px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px; color: var(--ink); outline: none;
}
.rs-fields .rev-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rs-warn { margin: 14px 0 0; font-size: 13px; color: var(--star); }

.rs-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-n { opacity: .6; font-size: 11px; font-variant-numeric: tabular-nums; }
.rs-panel { min-height: 200px; }

.rs-list { display: flex; flex-direction: column; gap: 14px; }
.rs-asset { cursor: default; }
.rs-asset:hover { transform: none; box-shadow: var(--shadow); }
.rs-sublabel {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin: 14px 0 8px;
}
.rs-subjects { list-style: none; margin: 0; padding: 0; }
.rs-subjects li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.rs-subjects li:last-child { border-bottom: 0; }
.rs-subjects li span { flex: 1; }
.act.tiny { padding: 3px 9px; font-size: 11.5px; border-radius: 6px; }
.rs-body {
  font-family: var(--sans); font-size: 13.5px; line-height: 1.6; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word; margin: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; max-height: 340px; overflow: auto;
}
.rs-post { margin-bottom: 12px; }
.rs-post:last-child { margin-bottom: 0; }
.rs-post .act { margin-top: 8px; }

.rs-ai .rs-ai-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rs-ai-row select, .rs-ai-row input {
  padding: 9px 11px; font: inherit; font-size: 13.5px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px; color: var(--ink); outline: none;
}
.rs-ai-row input { flex: 1; min-width: 240px; }
.rs-ai-row select:focus, .rs-ai-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.rs-lp { display: flex; flex-direction: column; gap: 14px; }
.rs-lp-bar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; box-shadow: var(--shadow);
}
.rs-lp-bar h3 { font-family: var(--display); font-size: 18px; font-weight: 600; margin: 0 0 3px; }
.rs-lp-bar p { margin: 0; font-size: 13px; color: var(--ink-3); }
.rs-lp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rs-lp-frame {
  width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; box-shadow: var(--shadow);
}

.rs-banners { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.rs-banner { cursor: default; }
.rs-banner:hover { transform: none; box-shadow: var(--shadow); }
.rs-banner-prev {
  margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--panel-2); display: grid; place-items: center; padding: 8px;
}
.rs-banner-prev svg { width: 100%; height: auto; display: block; border-radius: 4px; }

@media (max-width: 860px) {
  .rs-lp-bar { flex-direction: column; align-items: stretch; }
  .rs-lp-frame { height: 460px; }
}

/* ---------- KDP studio ---------- */
.kdp .rs-fields { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kdp .rev-field select, .kdp .rev-field input {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 13.5px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px; color: var(--ink); outline: none;
}
.kdp .rev-field select:focus, .kdp .rev-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.kdp-tool { border-color: var(--accent); border-width: 2px; background: var(--accent-soft); }
.kdp-tool .rs-body, .kdp-tool .fn-table { background: var(--panel); }
.kdp-inline {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-2);
}
.kdp-inline input, .kdp-inline select {
  padding: 8px 10px; font: inherit; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); outline: none;
}
.kdp-calc { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 6px; }
.kdp-calc td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.kdp-calc td:first-child { color: var(--ink-2); }
.kdp-calc td:last-child { color: var(--ink-3); font-size: 12.5px; text-align: right; }
.kdp-calc tr:last-child td { border-bottom: 0; }

/* ---------- creator studio ---------- */
.studio .rs-ai-row { align-items: center; }
.studio .rs-ai-row input[type="text"] { flex: 1; min-width: 260px; }
.studio textarea {
  width: 100%; resize: vertical; margin-top: 10px;
  padding: 11px 13px; font: inherit; font-size: 13.5px; line-height: 1.5;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); outline: none;
}
.studio textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.st-use {
  float: right; text-transform: none; letter-spacing: 0;
  font-weight: 400; color: var(--ink-3); font-size: 11px;
}
/* hero: copy on the left, stats filling what was dead space on the right */
.st-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 200px;
  gap: 36px; align-items: stretch;
}
.st-hero-copy { min-width: 0; }
.st-hero .hero-sub { max-width: none; margin-bottom: 0; }
.st-hero .hero-sub + .hero-sub { margin-top: 14px; }
.st-hero .hero-h { margin-bottom: 14px; }
.hero-note {
  margin: 16px 0 0; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-3);
}
.st-hero-stats {
  display: grid; grid-template-rows: repeat(4, 1fr); gap: 8px;
  align-content: stretch;
}
.st-stat {
  display: flex; flex-direction: column; justify-content: center;
  background: var(--accent-soft); border-radius: 10px;
  padding: 10px 14px;
}
.st-stat b {
  font-family: var(--display); font-size: 24px; font-weight: 600;
  color: var(--accent); line-height: 1.1;
}
.st-stat span {
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); margin-top: 2px;
}
@media (max-width: 980px) {
  .st-hero { grid-template-columns: 1fr; gap: 20px; }
  .st-hero-stats { grid-template-rows: none; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}
/* subject + model + ratio: one line, subject takes the slack */
.st-row {
  display: flex; flex-wrap: nowrap; align-items: center;
  gap: 10px; margin-bottom: 12px;
}
.st-row input[type="text"] {
  flex: 1 1 auto; min-width: 0;   /* min-width:0 is what lets it shrink instead of wrapping */
  padding: 10px 12px; font: inherit; font-size: 13.5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  color: var(--ink); outline: none;
}
.st-row input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.st-row .kdp-inline { flex: 0 0 auto; white-space: nowrap; }
.st-row select { background: var(--panel); }
@media (max-width: 720px) {
  .st-row { flex-wrap: wrap; }
  .st-row input[type="text"] { flex: 1 0 100%; }
}

.st-fams { margin-bottom: 8px; }
.st-fams .chip { font-weight: 600; }
.st-fams .chip:not(.is-on) { background: var(--panel-2); }
.st-mods {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px; margin-bottom: 14px;
}
.st-mods .kdp-inline { justify-content: space-between; }
.st-mods select { flex: 1; min-width: 0; }
.studio .kdp-tool .card-top { align-items: center; }
.st-score {
  display: flex; align-items: center; gap: 12px; margin: 14px 0 10px;
  padding: 12px 16px; background: var(--panel-2); border-radius: 10px;
}
.st-score-n { font-family: var(--display); font-size: 26px; font-weight: 600; }
.st-score-n.good { color: var(--accent); }
.st-score-n.ok { color: var(--star); }
.st-score-n.bad { color: #a13232; }
[data-theme="dark"] .st-score-n.bad { color: #e89a8e; }
.st-score-l { font-size: 13px; color: var(--ink-2); }
.st-y { color: var(--accent); font-weight: 700; }
.st-n { color: var(--ink-3); font-weight: 700; }
.st-fix { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; font-weight: 400; }

/* ---------- prompt builder chat ---------- */
.gen-log { display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow: auto; padding-right: 4px; }
.gen-user {
  align-self: flex-end; max-width: 75%;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 13px; border-radius: 12px 12px 3px 12px;
  font-size: 13.5px; white-space: pre-wrap; word-break: break-word;
}
.gen-card { cursor: default; }
.gen-card:hover { transform: none; box-shadow: var(--shadow); }
.gen-card .card-body { max-height: 320px; overflow: auto; }
.gen-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.gen-inputrow textarea {
  flex: 1; resize: vertical; min-height: 46px;
  padding: 11px 13px; font: inherit; font-size: 13.5px; line-height: 1.45;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); outline: none;
}
.gen-inputrow textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gen-examples { display: flex; gap: 6px; flex-wrap: wrap; }
.rev-setup { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.rev-field label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.rev-field.grow { flex: 1; min-width: 260px; }
.rev-field input, .rev-field select {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 13.5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  color: var(--ink); outline: none;
}
.rev-field input:focus, .rev-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rev-drop {
  display: grid; place-items: center; gap: 2px;
  padding: 52px 20px; text-align: center; cursor: pointer;
  background: var(--panel); border: 2px dashed var(--line-2); border-radius: 14px;
  transition: border-color .12s, background .12s;
}
.rev-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.rev-drop-big { margin: 0; font-family: var(--display); font-size: 19px; font-weight: 600; }
.rev-drop-sub { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); }
.rev-preview {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow);
}
.rev-preview img { max-width: 100%; max-height: 380px; object-fit: contain; border-radius: 9px; background: var(--panel-2); }
.rev-preview-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rev-status { margin: 0; color: var(--accent); font-size: 13.5px; font-weight: 500; }
.rev-error {
  margin: 0; padding: 10px 14px; font-size: 13.5px;
  color: #a13232; background: #f9e9e7; border: 1px solid #eccfcb; border-radius: 9px;
}
[data-theme="dark"] .rev-error { color: #e89a8e; background: #33201d; border-color: #4d2c27; }
.rev-subject { margin: 0; font-family: var(--display); font-size: 17px; color: var(--ink-2); font-style: italic; }
.rev-results { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.rev-results .card { cursor: default; }
.rev-results .card:hover { transform: none; box-shadow: var(--shadow); }
.rev-results .card-body { max-height: 380px; overflow: auto; }
@media (max-width: 860px) { .rev-results { grid-template-columns: 1fr; } }

/* ---------- modal / workbench ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-scrim { position: absolute; inset: 0; background: rgba(15, 14, 12, .5); }
.modal-panel {
  position: relative; width: min(760px, 100%); max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lift); padding: 26px 28px 24px;
}
.modal-x {
  position: absolute; top: 12px; right: 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  width: 30px; height: 30px; font-size: 13px; color: var(--ink-2);
}
.modal-x:hover { color: var(--ink); border-color: var(--line-2); }
.m-title { font-family: var(--display); font-size: 22px; font-weight: 600; margin: 4px 24px 10px 0; line-height: 1.25; }
.m-img { width: 100%; max-height: 340px; object-fit: contain; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; margin: 4px 0 14px; }
.m-label { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin: 16px 0 8px; }
.m-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.m-field input {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 13px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--ink);
  outline: none;
}
.m-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.m-field label { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-preview {
  font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; max-height: 320px; overflow: auto;
}
.m-preview.mono { font-family: var(--mono); font-size: 12.3px; }
mark.ph {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 4px; padding: 0 4px; font-weight: 500;
}
mark.ph.is-filled { background: var(--accent); color: var(--accent-ink); }
.m-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.m-run {
  font-size: 13.5px; color: var(--ink); white-space: pre-wrap; word-break: break-word;
  background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; max-height: 340px; overflow: auto;
}
.m-run-wait { color: var(--accent); font-weight: 500; }
.m-run-live {
  margin-left: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  color: var(--accent); text-transform: none;
}
.m-run-live::first-letter { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.star-x { font-size: 13px; }
.star-x:hover { color: #a13232; }
[data-theme="dark"] .star-x:hover { color: #e89a8e; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg);
  padding: 9px 18px; border-radius: 999px; font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s;
  z-index: 90;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
.scrim.is-on { display: block; }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.is-open { transform: none; }
  .main { margin-left: 0; }
  .only-mobile { display: block; }
  .content { padding: 22px 16px 70px; }
  .topbar { padding: 10px 14px; }
  .grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .vrow { flex-wrap: wrap; }
  .vdots { display: none; }
  .modal-panel { padding: 20px 16px 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
