/* TvastrOps Studio. Dark, calm, one thing per screen. Brand gold: #CFB991. */
:root {
  --bg: #0e0f11;
  --surface: #17191c;
  --surface-2: #1f2226;
  --line: #2c3036;
  --text: #ecebe7;
  --muted: #a3a29c;
  --gold: #cfb991;
  --gold-text: #dcc9a3;
  --danger: #ef8a80;
  --ok: #8fd19e;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--gold-text); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; font-weight: 600; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
p { margin: 0 0 12px; }

.brand { margin: 0; font-weight: 700; letter-spacing: .02em; }
.brand span { color: var(--gold); font-weight: 500; }
.lead, .hint { color: var(--muted); }
.hint { font-size: 14px; }

/* Signed-out card */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; }
.auth-card .brand { margin-bottom: 24px; }
.auth-switch { margin: 16px 0 0; font-size: 14px; color: var(--muted); }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; color: var(--muted); }
input, select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.form-error { color: var(--danger); font-size: 14px; }
.form-ok { color: var(--ok); font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--gold); }
.btn-primary { background: var(--gold); color: #111; border-color: var(--gold); }
.btn-primary:hover { opacity: .9; }
.btn-danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-full { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--gold-text); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Signed-in shell */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
@media (min-width: 900px) { .topbar { padding: 14px 32px; } }
.tabs { display: flex; gap: 4px; order: 3; width: 100%; }
@media (min-width: 640px) { .tabs { order: 0; width: auto; } }
.tabs a {
  padding: 8px 16px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600;
}
.tabs a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.who { display: flex; gap: 16px; align-items: center; font-size: 14px; color: var(--muted); }

.view { max-width: 880px; margin: 0 auto; padding: 32px 16px 64px; }
.section-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }

/* Folded sections: a named row that opens to its form, one at a time */
.fold { padding: 0; }
.fold > summary { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 20px 24px; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary h2 { margin: 0; flex: 1; }
.fold > summary .meta { color: var(--muted); font-size: 14px; }
.fold > summary::after { content: "›"; color: var(--muted); font-size: 22px; line-height: 1; transition: transform .15s; margin-left: 4px; }
.fold[open] > summary::after { transform: rotate(90deg); }
.fold > :not(summary) { padding: 0 24px 24px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list li { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 16px 20px; background: var(--surface); }
.list li + li { border-top: 1px solid var(--line); }
.list .meta { color: var(--muted); font-size: 14px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.gold { color: #111; background: var(--gold); }

.qr { background: #fff; padding: 12px; border-radius: 8px; width: 200px; }
.qr svg { display: block; width: 100%; height: auto; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Toasts */
.toast-shelf { position: fixed; inset: auto 16px 16px auto; margin: 0; padding: 0; border: 0; background: none; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast-item { padding: 12px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast-item.is-error { border-color: var(--danger); color: var(--danger); }

/* Pieces list */
.group-title { font-size: 15px; color: var(--muted); font-weight: 600; margin: 28px 0 10px; text-transform: uppercase; letter-spacing: .06em; }
.row-link { display: grid; gap: 2px; color: inherit; text-decoration: none; flex: 1; min-width: 0; }
.row-link:hover strong { color: var(--gold-text); }
.note { color: var(--gold-text); }
.list .grow, .grow { flex: 1 1 220px; min-width: 0; }
h3 { font-size: 16px; margin: 0 0 8px; }
textarea {
  width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit; line-height: 1.6; resize: vertical;
}
textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }

/* Editor frame */
.editor-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.editor-head [data-save] { margin-left: auto; font-size: 14px; color: var(--muted); }
.editor-title { font-size: clamp(22px, 3vw, 28px); margin-bottom: 16px; overflow-wrap: anywhere; }
.banner { padding: 12px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 16px; font-size: 15px; }
.banner.gold { border-color: var(--gold); }
.steps { display: grid; grid-template-columns: repeat(var(--steps, 5), minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
@media (max-width: 480px) { .steps { gap: 2px; } .step { font-size: 12px; padding: 8px 2px; } }
.step { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; text-align: center; border: 1px solid transparent; }
@media (min-width: 640px) { .step { flex-direction: row; justify-content: center; gap: 8px; font-size: 15px; } }
.step:hover { color: var(--text); }
.step[aria-current="step"] { color: var(--text); background: var(--surface); border-color: var(--line); }
.step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-size: 13px; }
.step[aria-current="step"] .step-n { background: var(--gold); color: #111; }
.score { font-size: 12px; color: var(--gold-text); font-weight: 600; }
.step-body { min-height: 260px; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; }
.step-nav .btn { text-decoration: none; }

/* Blocks */
.blocks { display: grid; gap: 12px; margin: 16px 0; }
.block { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; background: var(--bg); }
.block-answer { border-color: var(--gold); }
.block-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.block-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.block-tools { display: flex; gap: 2px; }
.tool { min-width: 32px; min-height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.tool:hover { background: var(--surface-2); color: var(--text); }
.block textarea { border-color: transparent; background: var(--surface); }
textarea.heading { font-size: 20px; font-weight: 600; }
textarea.subheading { font-size: 17px; font-weight: 600; }
textarea.quote { font-style: italic; }
.add-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.add-bar .btn { min-height: 38px; padding: 0 14px; font-size: 14px; }
.link-picker { margin-top: 8px; }
.link-picker select { flex: 1; min-width: 200px; }

/* Pictures */
.pic-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.thumb { width: 160px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.thumb.wide { width: 260px; aspect-ratio: 16 / 9; }
.thumb.small { width: 80px; }

/* Search preview and checklist */
.serp { display: grid; gap: 4px; padding: 16px 18px; border-radius: 10px; background: #fff; color: #202124; font-family: arial, sans-serif; max-width: 640px; }
.serp-url { font-size: 13px; color: #4d5156; }
.serp-title { font-size: 19px; color: #1a0dab; line-height: 1.3; }
.serp-desc { font-size: 14px; color: #4d5156; line-height: 1.5; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist a { color: var(--text); text-decoration: none; }
.checklist a:hover { text-decoration: underline; }
.mark { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; font-size: 12px; font-weight: 700; }
.checklist .ok .mark { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.checklist .bad .mark { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
.checklist .warn .mark { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold-text); }
.meta.detail { display: block; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; }
.preview-box { padding: 16px; border-radius: 10px; background: var(--surface-2); }

/* Case Study steps */
.story-part + .story-part { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.pics { display: grid; gap: 12px; margin: 8px 0 12px; }
.figures { display: grid; gap: 12px; margin: 16px 0; }
.highlights { display: grid; gap: 8px; }
.hl select { flex: 0 0 160px; }
.hl input { flex: 1 1 240px; }
.claim { margin: 8px 0 16px; padding: 12px 16px; border-left: 2px solid var(--gold); background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--muted); }
.check { margin: 10px 0; align-items: flex-start; }
.check input { margin-top: 4px; }

/* AI help */
.ai-row { margin: 8px 0 12px; }
.ai-card { background: var(--surface-2); margin: 12px 0; }
.draft-preview { max-height: 360px; overflow: auto; padding: 12px 16px; margin: 12px 0; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.draft-preview h4 { margin: 14px 0 6px; font-size: 16px; }
mark { background: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--text); padding: 0 2px; border-radius: 3px; }
