:root {
  --bg: #f6f6f3;
  --card: #ffffff;
  --ink: #1d1f22;
  --muted: #6b7078;
  --line: #e3e3de;
  --accent: #d9640b;
  --accent-ink: #ffffff;
  --accent-soft: #fdf0e5;
  --good: #1f7a4d;
  --good-soft: #e6f4ec;
  --bad: #b3261e;
  --bad-soft: #fbeaea;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}
a { color: inherit; }

/* top bar */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 28px; height: 60px;
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a {
  text-decoration: none; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.who { color: var(--muted); font-size: 14px; white-space: nowrap; }
.who a { margin-left: 10px; }

/* layout */
main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 60px; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 14px; }
.lead { color: var(--muted); margin: 0 0 24px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
}
.grid { display: grid; gap: 16px; }
.grid.boxes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 24px; }
.box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.box .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.box .num { font-size: 32px; font-weight: 700; line-height: 1.2; }
.box .sub { color: var(--muted); font-size: 13px; }
.soon {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted);
}
.soon strong { color: var(--ink); display: block; font-size: 17px; margin-bottom: 4px; }

/* forms */
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.btn {
  display: inline-block; border: 0; border-radius: 9px; padding: 12px 20px; font: inherit; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; margin-top: 16px;
}
.btn:hover { filter: brightness(0.95); }
.btn.secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 8px 12px; font-size: 14px; margin-top: 0; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.row > .btn { flex: 0 0 auto; white-space: nowrap; }

/* messages */
.msg { padding: 12px 16px; border-radius: 9px; margin-bottom: 18px; font-weight: 600; }
.msg.ok { background: var(--good-soft); color: var(--good); }
.msg.err { background: var(--bad-soft); color: var(--bad); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 13px; font-weight: 600; }
.pill { display: inline-block; padding: 3px 12px; border-radius: 99px; font-size: 13px; font-weight: 600;
        text-align: center; white-space: nowrap; line-height: 1.4; vertical-align: middle; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.plain { background: var(--bg); color: var(--muted); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 400px; }
.login .brand { display: block; text-align: center; font-size: 26px; margin-bottom: 18px; }
.login .btn { width: 100%; }

/* generate page */
h3 { font-size: 15px; margin: 18px 0 8px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
p.hint { margin: 6px 0 0; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }
.asin-head { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: 24px; align-items: start; }
.thumb-lg { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb-wrap { position: relative; display: block; }
.thumb-wrap img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: #fff; }
.badge { position: absolute; left: 4px; bottom: 4px; background: var(--good); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.choices { display: flex; gap: 10px; flex-wrap: wrap; }
.choice { margin: 0; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 12px; border: 2px solid var(--line);
  font-size: 20px; font-weight: 700; background: #fff;
}
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); }
.choice.wide span { width: auto; height: auto; padding: 10px 16px; font-size: 15px; display: block; }
.choice.wide small { color: var(--muted); font-weight: 400; }
details.advanced { margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
details.advanced summary { font-weight: 600; color: var(--ink); }
.pill.warn { background: var(--accent-soft); color: var(--accent); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--bg); }
.thumb-cell { width: 76px; }
.thumb-cell img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: #fff; }
.suggest { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.suggest-item {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff;
}
.suggest-item:hover { border-color: var(--accent); }
.suggest-item img, .suggest-item .noimg { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--bg); }
.suggest-item .btn { margin: 0; }
a.box { text-decoration: none; display: block; }
a.box:hover { border-color: var(--accent); }
.box.highlight { background: var(--good-soft); border-color: #bfe3cf; }
.box.highlight .num { color: var(--good); }
.filters { align-items: end; }
details.section { padding: 0; }
details.section > summary { padding: 18px 22px; list-style: none; display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary h2 { margin: 0; }
details.section > summary::before { content: "▸"; color: var(--muted); }
details.section[open] > summary::before { content: "▾"; }
details.section > table { margin: 0 22px 18px; width: calc(100% - 44px); }
.count { background: var(--bg); border-radius: 99px; padding: 1px 10px; font-size: 14px; color: var(--muted); margin-left: 6px; }
.dash-table td { font-size: 14px; }
.dash-table .thumb-cell { position: relative; }
.mini-badge { position: absolute; left: 10px; bottom: 12px; background: var(--good); color: #fff; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 5px; }
.feedback-cell { min-width: 240px; width: 30%; }
.feedback-cell textarea { padding: 7px 9px; font-size: 14px; resize: vertical; min-height: 40px; }
.feedback-cell .saved { color: var(--good); font-size: 12px; font-weight: 600; }
.feedback-cell .sheet-note { margin-top: 4px; font-size: 12px; }
strong.up { color: var(--good); }
strong.down { color: var(--bad); }
.credit-badge {
  text-decoration: none; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 99px;
  background: var(--good-soft); color: var(--good); white-space: nowrap;
}
.credit-badge.low { background: var(--bad-soft); color: var(--bad); }
.credit-big { font-size: 34px; font-weight: 700; color: var(--good); }
.credit-big.low { color: var(--bad); }
.credit-big span { font-size: 15px; font-weight: 600; color: var(--muted); }
.credit-big .hint { display: block; font-size: 14px; }
/* coloured boxes: a stripe in the section's chart colour */
.box { border-left-width: 5px; }
.box.accent-1 { border-left-color: #2a78d6; }
.box.accent-2 { border-left-color: #eb6834; }
.box.accent-3 { border-left-color: #1baf7a; }
.box.accent-4 { border-left-color: #eda100; }
.box.accent-5 { border-left-color: #e87ba4; }
.box.accent-6 { border-left-color: #6250d6; }
.box.accent-ai { border-left-color: #2a78d6; }
.box.accent-original { border-left-color: #e34948; }
.box.accent-due { border-left-color: #eda100; background: #fff8e8; }

/* charts */
.chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 4px; }
.chart-card h2 { margin-bottom: 4px; }
.key { display: inline-flex; align-items: center; gap: 5px; margin-left: 12px; color: var(--muted); }
.key i, .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.lift-chart { width: 100%; height: auto; margin-top: 10px; font: 12px "Segoe UI", system-ui, sans-serif; }
.lift-chart .zero-line { stroke: #c9c8c2; stroke-width: 1; }
.lift-chart .bar-label { fill: var(--muted); }
.lift-chart .bar-value { fill: var(--ink); font-weight: 600; }
.lift-chart .hit { fill: transparent; }
.lift-chart .bar:hover .hit { fill: var(--bg); }
.stack-bar { display: flex; height: 28px; border-radius: 6px; overflow: hidden; gap: 2px; margin: 14px 0 12px; background: var(--card); }
.stack-bar span { display: block; min-width: 4px; }
.stack-bar span:first-child { border-radius: 6px 0 0 6px; }
.stack-bar span:last-child { border-radius: 0 6px 6px 0; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend strong { margin-left: auto; }

/* experiment rows */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; }
.tabs a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a.on { background: var(--accent-soft); color: var(--accent); }
.exp { display: grid; grid-template-columns: 200px 1.2fr 1fr 1.4fr; gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); align-items: start; }
.exp-images { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.exp-images figure { margin: 0; }
.exp-images img, .exp-images .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--bg); }
.exp-images figcaption { font-size: 11px; color: var(--muted); text-align: center; margin-top: 3px; }
.exp-status { margin-top: 8px; }
.due-flag { margin-top: 8px; font-size: 13px; font-weight: 600; color: #8a5a00; background: #fff4d6; padding: 4px 8px; border-radius: 6px; display: inline-block; }
.lift { font-size: 26px; font-weight: 700; }
.lift.up { color: #1c5cab; }
.lift.down { color: #b3261e; }
.conv { font-size: 14px; }
.exp-notes p { margin: 0 0 6px; font-size: 14px; }
.exp-notes details.advanced { margin-top: 6px; }
.exp-notes details.advanced .row > div { min-width: 110px; }
details.advanced-card > summary { list-style: none; display: flex; gap: 12px; align-items: baseline; cursor: pointer; }
details.advanced-card > summary h2 { margin: 0; }
.inline-form input { padding: 6px 8px; font-size: 14px; max-width: 160px; }

.exp.outside .exp-results, .exp.outside .exp-images { opacity: 0.6; }
.outside-tag { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg); border: 1px dashed var(--line); padding: 2px 8px; border-radius: 6px; }
.weekly-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fff4d6; border: 1px solid #f3d27a; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px;
}
.weekly-banner .btn { margin: 0; }
.nav-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-left: 6px; vertical-align: middle; }

/* pipeline bar on the main Dashboard */
.pipeline { margin-bottom: 24px; }
.pipeline .stack-bar { height: 34px; }
.pipeline .stack-bar a { display: block; min-width: 6px; }
.pipeline .legend { flex-direction: row; flex-wrap: wrap; gap: 6px 18px; }
@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
  .exp { grid-template-columns: 140px 1fr; }
}
.feedback-list { margin: 10px 0 0; padding: 0; list-style: none; }
.feedback-list li { background: var(--bg); border-radius: 8px; padding: 8px 10px; margin-top: 6px; font-size: 14px; }
.model-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.model-choice { margin: 0; cursor: pointer; font-weight: 400; }
.model-choice input { position: absolute; opacity: 0; pointer-events: none; }
.model-choice > span { display: block; padding: 14px 16px; border: 2px solid var(--line); border-radius: 12px; background: #fff; line-height: 1.6; }
.model-choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.model-choice input:focus-visible + span { outline: 2px solid var(--accent); }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 10px; }
.ref-pick { margin: 0; position: relative; cursor: pointer; }
.ref-pick input { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; }
.ref-pick img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 2px solid var(--line); display: block; background: #fff; }
.ref-pick input:checked + img { border-color: var(--accent); }
.ref select { margin-top: 6px; padding: 6px; font-size: 13px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; margin-top: 20px; }
label.check input { width: 18px; height: 18px; }
.estimate { margin-top: 20px; padding: 14px 16px; background: var(--bg); border-radius: 9px; }
.btn.big { font-size: 17px; padding: 14px 28px; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* run progress and results */
.steps { padding-left: 20px; margin: 0 0 14px; }
.steps li { margin: 6px 0; color: var(--muted); }
.steps li.ok { color: var(--good); }
.steps li.ok::marker { content: "✓  "; }
.steps li.now { color: var(--ink); font-weight: 600; }
.concept-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 14px; }
.gen { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gen.winner { border: 2px solid var(--good); }
.gen.original { border-style: dashed; }
.gen > img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; background: #fff; cursor: zoom-in; border-bottom: 1px solid var(--line); }
.gen-failed { aspect-ratio: 1; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--bad); background: var(--bad-soft); }
.gen-body { padding: 14px 16px; }
.gen-body > strong { margin-right: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.review { margin-top: 10px; }
.review ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.remake { margin-top: 12px; }
.remake .btn { margin-top: 12px; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; }
pre.prompt { white-space: pre-wrap; font: 13px/1.5 Consolas, monospace; background: var(--bg); padding: 12px; border-radius: 8px; max-height: 320px; overflow: auto; }
img.zoomable { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; background: rgba(20, 20, 20, 0.88); display: grid; place-items: center; z-index: 100; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; background: #fff; border-radius: 6px; }

@media (max-width: 700px) {
  .asin-head { grid-template-columns: 1fr; }
  .grid.boxes { grid-template-columns: 1fr 1fr; }
  .topbar-inner { gap: 12px; padding: 0 16px; }
  .who span { display: none; }
  main { padding: 20px 16px 40px; }
}
