/* Recept — calm tool UI. System fonts, neutral palette, one accent, no external assets. */

:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --text: #1a1e26;
  --muted: #586172;
  --border: #dde1e8;
  --border-strong: #b9c0cc;
  --accent: #2b55c8;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefc;
  --ok: #1c6a44;
  --ok-soft: #e2f3e9;
  --warn: #855600;
  --warn-soft: #fbf0d8;
  --bad: #a02929;
  --bad-soft: #fbe7e7;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
}

.wrap { width: min(100% - 32px, 1080px); margin-inline: auto; }

h1, h2, h3, h4, h5 { line-height: 1.25; margin: 0; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.95rem; }
p { margin: 0 0 0.75em; }
ul, ol { margin: 0; padding-left: 1.25em; }
a { color: var(--accent); overflow-wrap: anywhere; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, .code { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 16px; top: -64px; z-index: 10;
  padding: 8px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border-strong);
}
.skip-link:focus { top: 8px; }

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
/* Positioned so the visually hidden label inside stays within scrollable tables. */
.none { color: var(--muted); position: relative; }
.pre { white-space: pre-line; }

/* ---------- header / footer ---------- */

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 28px 0 24px; }
.product { font-size: 1.8rem; letter-spacing: -0.01em; }
.tagline { margin: 6px 0 0; color: var(--muted); }
.disclaimer {
  margin: 16px 0 0; padding: 10px 14px; max-width: 84ch;
  background: var(--surface-2); border-left: 3px solid var(--border-strong);
  border-radius: 0 8px 8px 0; font-size: 0.92rem;
}

main { padding: 24px 0 56px; }
.block { margin-top: 36px; }

.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 28px 0 40px; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.site-footer h2 { font-size: 1.1rem; margin-bottom: 4px; }
.admin label { display: block; font-size: 0.88rem; color: var(--muted); margin-bottom: 6px; }
.admin-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-row input { flex: 1 1 160px; min-height: 34px; padding: 4px 10px; font-size: 0.9rem; }
.admin p { margin: 8px 0 0; min-height: 1.4em; }

/* ---------- controls ---------- */

input[type="text"], input[type="url"], input[type="password"], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 11px;
  font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
}
/* The native file control is hidden so its label stays Croatian in every browser. */
.file-field { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.file-field .help { flex: 1 1 100%; margin: 0; }
.file-field > label.btn { display: inline-flex; margin: 0; font-weight: 600; font-size: 0.9rem; }
.file-input:focus-visible + .btn { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { resize: vertical; line-height: 1.5; display: block; }
textarea.code { font-size: 0.85rem; tab-size: 2; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }
[aria-invalid="true"] { border-color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 16px;
  font: inherit; font-weight: 600; white-space: nowrap; text-decoration: none;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { color: var(--accent-ink); filter: brightness(1.1); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-small { min-height: 34px; padding: 4px 12px; font-size: 0.9rem; }
.btn-large { min-height: 52px; padding: 12px 24px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 0.92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

.field { margin-bottom: 14px; min-width: 0; }
.field > label, .field-label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }
.req, .hint { font-weight: 400; color: var(--muted); }
.field-error { margin: 4px 0 0; min-height: 0; color: var(--bad); font-size: 0.88rem; }
.field-error:empty, .form-message:empty { display: none; }
.form-message { margin: 0 0 12px; padding: 10px 14px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); }
.form-message.is-ok { background: var(--ok-soft); color: var(--ok); }
.help { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }

.run-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.run-field { flex: 1 1 240px; max-width: 440px; margin-bottom: 0; }

.alert { padding: 10px 14px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); overflow-wrap: anywhere; }
.notice { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.notice ul { list-style: none; padding: 0; }
.notice .btn { color: inherit; }
.note { padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); font-size: 0.94rem; margin: 0 0 4px; }

/* ---------- brief form ---------- */

.panel {
  margin-top: 24px; padding: 22px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
fieldset { border: 0; border-top: 1px solid var(--border); margin: 18px 0 0; padding: 18px 0 4px; min-width: 0; }
legend { padding: 0 10px 0 0; font-weight: 700; font-size: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.product-rows { display: grid; gap: 10px; margin-bottom: 10px; }
.product-row {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.4fr) auto;
  gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
}
.product-row .field { margin: 0; }
.steps { margin: 0 0 14px; padding-left: 1.4em; font-size: 0.94rem; }
.steps li { margin-bottom: 6px; }
.steps .btn { margin-left: 6px; vertical-align: baseline; }

/* ---------- pipeline ---------- */

.run-status {
  display: flex; align-items: center; gap: 8px;
  min-height: 1.7rem; margin: 10px 0 14px; color: var(--muted); font-size: 0.95rem;
}
#run-status-time { font-variant-numeric: tabular-nums; white-space: nowrap; }

.spinner {
  display: inline-block; flex: none; width: 14px; height: 14px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.pipeline { display: grid; gap: 16px; }
.pipeline > * { min-width: 0; }
.phase { padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.phase-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; min-height: 42px; }
.phase-head h3 { flex: 1 1 12rem; }
.phase-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.phase > .alert { margin-top: 12px; }
.phase > .muted { margin: 10px 0 0; }

.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 8.5rem; min-height: 28px; padding: 2px 12px;
  font-size: 0.85rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.chip-done { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.chip-running { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

details > summary { cursor: pointer; }
.phase-body { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.phase-body > summary { font-weight: 600; color: var(--muted); font-size: 0.92rem; }
.phase-content { padding-top: 6px; }
.json-details { margin-top: 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.json-details > summary { padding: 8px 12px; font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.json-details > .steps { margin: 0; padding: 10px 14px 6px 2.6em; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.json { margin: 0; padding: 12px; max-height: 26rem; overflow: auto; border-top: 1px solid var(--border); font-size: 0.8rem; line-height: 1.45; white-space: pre; }

.sub { margin-top: 22px; }
.sub > h4 { margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.sub > h4 + p { margin-top: 0; }
.empty { margin: 0; padding: 14px 16px; border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--muted); }

/* ---------- shared pieces ---------- */

.facts { margin: 0; display: grid; gap: 0; }
.facts-row { display: grid; grid-template-columns: minmax(8rem, 13rem) minmax(0, 1fr); gap: 4px 16px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.facts-row:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-size: 0.9rem; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts.compact .facts-row { padding: 6px 0; }

.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 0.82rem; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td:not(.num) { min-width: 6.5rem; }
td.wide { min-width: 15rem; }
td.mid { min-width: 12rem; }
td.nowrap { white-space: nowrap; }

.badge {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
}
.badge-ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge-bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tag { padding: 2px 9px; border-radius: 6px; font-size: 0.88rem; background: var(--surface-2); border: 1px solid var(--border); overflow-wrap: anywhere; }

.img-missing { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 3rem; padding: 6px; text-align: center; font-size: 0.8rem; color: var(--muted); }

/* ---------- analysis ---------- */

.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.swatch { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.swatch-chip { flex: none; width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.swatch-text { display: grid; gap: 2px; min-width: 0; }
.mini-swatch { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; border-radius: 4px; border: 1px solid var(--border-strong); }

.logos { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 0; }
.logo-panel { margin: 0; }
.logo-box { display: flex; align-items: center; justify-content: center; width: 180px; height: 110px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-light { background: #ffffff; color: #586172; }
.logo-dark { background: #1d2026; color: #a4adbb; }
.logo-panel figcaption { margin-top: 4px; font-size: 0.82rem; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); min-width: 0; }
.tile-value { font-size: 1.35rem; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-value.is-text { font-size: 0.98rem; font-weight: 600; }
.tile-label { font-size: 0.84rem; color: var(--muted); }
.sub-label { margin: 16px 0 8px; font-size: 0.9rem; font-weight: 600; color: var(--muted); }

.top-posts { display: grid; gap: 10px; padding-left: 1.4em; }
.top-posts li { padding-left: 2px; }
.clamp { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }

.summary { max-width: 78ch; }
.group { margin-top: 18px; }
.group > h5 { margin-bottom: 8px; }
.findings { list-style: none; padding: 0; display: grid; gap: 8px; }
.finding { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.finding-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.finding-claim { flex: 1 1 16rem; min-width: 0; overflow-wrap: anywhere; }
.evidence { margin-top: 6px; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.finding .muted { margin: 6px 0 0; }
.plain-list { display: grid; gap: 4px; }

.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; text-decoration: none; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.card-text { display: grid; gap: 6px; justify-items: start; padding: 10px 12px; min-width: 0; }
.card-text .badge { white-space: normal; }

.notes { list-style: none; padding: 0; display: grid; gap: 8px; }
.note-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.note-item p { margin: 6px 0 0; }
.note-meta { color: var(--muted); font-size: 0.9rem; }

/* ---------- plan / production / qa ---------- */

.post-list { display: grid; gap: 16px; }
.post-list > * { min-width: 0; }
.post-card { padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.post-card > h4 { margin-bottom: 8px; font-size: 1.05rem; }
.post-card > h5 { margin: 16px 0 8px; }
.post-card .facts-row { border-bottom-color: var(--border); }

.editor-block { margin-top: 16px; }
.editor { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.editor .help { margin-bottom: 12px; }
.editor textarea { margin-bottom: 12px; }
.editor label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }

.gallery { position: relative; display: flex; gap: 12px; margin: 14px 0 4px; padding: 4px 4px 12px; overflow-x: auto; scroll-snap-type: x proximity; }
.frame { flex: none; width: 220px; margin: 0; scroll-snap-align: start; }
.frame.story { width: 172px; }
.frame-media {
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  aspect-ratio: var(--ratio, 4 / 5);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); font-size: 0.85rem; text-decoration: none;
}
.frame.story .frame-media { aspect-ratio: var(--ratio, 9 / 16); }
.frame-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.frame figcaption { margin-top: 6px; font-size: 0.82rem; color: var(--muted); }

.caption { margin: 0; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; max-width: 72ch; }
.post-card .row { margin-top: 12px; }

.verdict { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-radius: 8px; }
.verdict-ok { background: var(--ok-soft); }
.verdict-bad { background: var(--bad-soft); }
.verdict-text { display: grid; gap: 2px; }
.verdict-text strong { font-size: 1.1rem; }
.verdict-ok strong { color: var(--ok); }
.verdict-bad strong { color: var(--bad); }
.qa-post { margin-top: 20px; }
.qa-post > .row { margin-bottom: 8px; }

/* ---------- prompts ---------- */

.log-list { list-style: none; padding: 0; columns: 2 300px; column-gap: 24px; font-size: 0.92rem; }
.log-list li { padding: 3px 0; break-inside: avoid; }
#prompts > p { margin-top: 10px; }

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .product-row { grid-template-columns: minmax(0, 1fr); }
  .product-row .btn { justify-self: start; }
}

@media (max-width: 560px) {
  main { padding-top: 18px; }
  .site-header { padding: 20px 0 18px; }
  .product { font-size: 1.55rem; }
  .panel { padding: 16px; }
  .phase { padding: 14px; }
  .post-card { padding: 12px; }
  .facts-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .phase-head h3 { flex-basis: 100%; }
  .frame { width: 190px; }
  .frame.story { width: 150px; }
  .logo-box { width: 148px; height: 96px; }
}
