/* ============================================================
   WWScore — app shell stylesheet
   Consumes the shared tokens/primitives from brand.css.
   Re-skins the working screens (analyse, progress, overzicht,
   review, result, settings, error) onto the WWScore brand.

   Status rule (No-Sides): process states use neutral + blue.
   Semantic amber/red appear only for genuine attention/errors;
   green is never used for process status.
   ============================================================ */

/* ---------- App header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.app-header__inner {
  max-width: var(--shell); margin-inline: auto; padding-inline: 28px;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.app-header__brand { display: inline-flex; align-items: center; }
.app-nav { display: flex; align-items: center; gap: 22px; }
.app-nav__link {
  font-family: var(--font-sans); font-size: 14px; color: var(--ink-80);
  transition: color .2s var(--ease);
}
.app-nav__link:hover { color: var(--ink); }

/* ---------- App content shell ---------- */
.app-shell {
  max-width: 960px; margin: 40px auto 80px; padding-inline: 28px;
  display: grid; gap: 24px;
}

/* ---------- Typography ---------- */
h1 {
  font-family: var(--font-sans); font-weight: 600; color: var(--ink);
  font-size: 30px; line-height: 1.15; letter-spacing: -0.01em; margin: 0;
}
h2 {
  font-family: var(--font-sans); font-weight: 600; color: var(--ink);
  font-size: 22px; line-height: 1.2; margin: 0 0 4px;
}
h3 {
  font-family: var(--font-sans); font-weight: 600; color: var(--ink);
  font-size: 17px; line-height: 1.3; margin: 18px 0 8px;
}
p { font-family: var(--font-sans); color: var(--ink-80); line-height: 1.55; margin: 6px 0 0; }
code { font-family: var(--font-mono); font-size: 0.85em; }

.muted { color: var(--stone); }

/* ---------- Panels / cards ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.stack { display: grid; gap: 18px; }

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.header-row h1 + p { margin-top: 6px; }

/* ---------- Forms ---------- */
label,
fieldset {
  display: grid;
  gap: 8px;
}
fieldset {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
}
legend { font-family: var(--font-sans); font-weight: 600; color: var(--ink); padding: 0 6px; }
label > span:first-child { font-family: var(--font-sans); font-weight: 500; color: var(--ink); font-size: 14px; }

input:not([type="checkbox"]):not([type="radio"]),
select {
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .2s var(--ease);
}
input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover { border-color: var(--stone); }

/* checkboxes/radios keep native sizing, tinted to the brand accent */
input[type="checkbox"],
input[type="radio"] { width: 17px; height: 17px; accent-color: var(--blue); margin: 0; }

/* ---------- Buttons (re-skin in place onto brand) ---------- */
button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  background: var(--blue);
  color: #fff;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
button:hover,
.button-link:hover { background: var(--blue-strong); }

button.secondary,
.button-link.secondary,
.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--hairline);
}
button.secondary:hover,
.button-link.secondary:hover,
.secondary:hover { background: #FBFAF6; }

.inline-link { color: var(--blue); font-size: 0.9rem; font-weight: 500; }
.inline-link:hover { color: var(--blue-strong); text-decoration: underline; }

/* ---------- Progress pipeline ---------- */
.progress-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 28px 0 0;
  list-style: none;
}
.progress-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.step-copy { display: grid; gap: 4px; min-width: 0; }
.step-copy > span:first-child { font-family: var(--font-sans); color: var(--ink); }
.step-detail { color: var(--ink-60); font-size: 0.92rem; line-height: 1.35; }

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--track);
  flex: 0 0 auto;
}
/* process states: neutral + blue; done settles to ink (never green) */
.status-active .dot { background: var(--blue); box-shadow: 0 0 0 5px rgba(41, 80, 230, 0.15); }
.status-done .dot { background: var(--ink); }
/* genuine attention / error: amber / red */
.status-blocked .dot { background: var(--warn); }
.status-failed .dot { background: var(--over); }
.status-blocked .step-detail { color: var(--warn); }
.status-failed .step-detail { color: var(--over); }

/* ---------- Result / artifacts ---------- */
.artifact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}
.artifact-links a:not(.button-link) {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--blue);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--surface);
}
.artifact-links a:not(.button-link):hover { border-color: var(--blue); }

iframe {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---------- Feedback boxes ---------- */
/* genuine error → semantic red */
.error-box {
  background: var(--over-bg);
  border: 1px solid var(--over-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 18px 0;
  color: #8E2E1E;
}
.error-box p { color: inherit; }
.error-box ul { margin: 8px 0 0; padding-left: 20px; }

/* saved/confirmed → neutral-blue confirmation (never green for process) */
.success-box {
  margin: 18px 0;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--blue) 25%, var(--hairline));
  border-radius: var(--radius);
  background: rgba(41, 80, 230, 0.07);
  color: var(--ink);
  font-weight: 500;
}

/* ---------- Settings ---------- */
.settings-status-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 24px 0;
  list-style: none;
}
.settings-status-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}
.settings-status-list li > div:first-child { display: grid; gap: 4px; min-width: 0; }
.settings-status-list strong { font-family: var(--font-sans); color: var(--ink); }
.settings-base-url { color: var(--stone); font-size: 0.88rem; overflow-wrap: anywhere; }

.settings-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.settings-badge {
  display: inline-flex; align-items: center; min-height: 28px;
  border-radius: 999px; padding: 3px 10px;
  background: rgba(15, 27, 45, 0.06); color: var(--ink-80);
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500; white-space: nowrap;
}
/* "key opgeslagen" → blue confirmation, not green */
.settings-badge.positive { background: rgba(41, 80, 230, 0.10); color: var(--blue); }

.settings-form { margin-top: 22px; }
.field-hint { color: var(--stone); font-size: 0.88rem; line-height: 1.4; }
.settings-clear-form { margin-top: 16px; }

/* ---------- Overzicht (confirm/aanvullen) ---------- */
.overview-form { display: grid; gap: 16px; margin-top: 24px; }
.overview-section {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
}
.overview-section summary { cursor: pointer; font-family: var(--font-sans); font-weight: 600; color: var(--ink); }
.overview-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1.4fr) minmax(96px, auto);
  gap: 12px;
  align-items: end;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
}
.overview-label { display: grid; gap: 4px; }
.overview-path { color: var(--stone); font-family: var(--font-mono); font-size: 0.78rem; word-break: break-word; }

.overview-status {
  min-height: 30px;
  display: inline-flex; align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-family: var(--font-mono); font-size: 0.78rem;
  justify-self: start;
  background: rgba(15, 27, 45, 0.06); color: var(--ink-80);
}
/* confirmed → blue (never green); caution → amber; blocker → red; others neutral */
.overview-status.status-ok { background: rgba(41, 80, 230, 0.10); color: var(--blue); }
.overview-status.status-te_bevestigen { background: rgba(15, 27, 45, 0.06); color: var(--ink-80); }
.overview-status.status-ontbrekend { background: rgba(15, 27, 45, 0.05); color: var(--stone); }
.overview-status.status-onzeker { background: var(--warn-bg); color: var(--warn); }
.overview-status.status-blokkade { background: var(--over-bg); color: var(--over); }

.field-error { color: var(--over); font-size: 0.88rem; }
.overview-repeat-item {
  margin-top: 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px;
}
.inline-control { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; }
.inline-control input { min-height: 0; }

/* ---- Overzicht: oriëntatie (telling + callout) ---- */
.overview-tally { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.tally-chip {
  display: inline-flex; align-items: center; min-height: 28px;
  border-radius: 999px; padding: 4px 12px;
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500;
  background: rgba(15, 27, 45, 0.06); color: var(--ink-80);
}
.tally-chip.status-ok { background: rgba(41, 80, 230, 0.10); color: var(--blue); }
.tally-chip.status-te_bevestigen { background: rgba(15, 27, 45, 0.06); color: var(--ink-80); }
.tally-chip.status-ontbrekend { background: rgba(15, 27, 45, 0.05); color: var(--stone); }
.tally-chip.status-onzeker { background: var(--warn-bg); color: var(--warn); }
.tally-chip.status-blokkade { background: var(--over-bg); color: var(--over); }

.overview-callout {
  margin-top: 14px; padding: 12px 16px; border-radius: var(--radius);
  font-size: 14.5px; line-height: 1.5;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-80);
}
.overview-callout strong { font-weight: 600; }
.overview-callout.is-blocked { background: var(--over-bg); border-color: var(--over-border); color: #8E2E1E; }
.overview-callout.is-attention { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.overview-callout.is-ready {
  background: rgba(41, 80, 230, 0.06);
  border-color: color-mix(in srgb, var(--blue) 22%, var(--hairline));
  color: var(--ink);
}
.overview-callout__jump { margin-left: 8px; color: inherit; font-weight: 600; text-decoration: underline; white-space: nowrap; }

/* ---- Overzicht: section summaries + row emphasis ---- */
.overview-section summary { list-style: none; display: flex; align-items: center; gap: 10px; }
.overview-section summary::-webkit-details-marker { display: none; }
.overview-section summary::before {
  content: ""; width: 8px; height: 8px; flex: 0 0 auto;
  border-right: 2px solid var(--stone); border-bottom: 2px solid var(--stone);
  transform: rotate(-45deg); transition: transform .2s var(--ease);
}
.overview-section[open] > summary::before { transform: rotate(45deg); }
.overview-section__label { font-weight: 600; color: var(--ink); }
.overview-section__flag {
  font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 2px 8px;
}
.overview-repeat-item.is-new { border-style: dashed; }

/* attention/blocker rows: background tint (never a side-stripe) */
.overview-row.status-onzeker { background: rgba(168, 105, 15, 0.05); }
.overview-row.status-blokkade { background: rgba(197, 64, 43, 0.05); }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------- Tabs (draft views) ---------- */
.tab-nav { display: flex; gap: 2px; border-bottom: 2px solid var(--hairline); margin: 20px 0 0; }
.tab-btn {
  min-height: 38px; padding: 0 18px;
  border: none; border-bottom: 2px solid transparent; border-radius: 4px 4px 0 0;
  margin-bottom: -2px; background: none; color: var(--stone);
  cursor: pointer; font-family: var(--font-sans); font-weight: 500; font-size: 0.9rem;
}
.tab-btn:hover { color: var(--ink); background: var(--paper); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.draft-json {
  margin: 20px 0 0;
  padding: 16px 18px;
  background: var(--paper-deep);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  max-height: 72vh;
  overflow-y: auto;
}

/* ---------- Job list (startpagina / analyse) ---------- */
.job-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.job-table th,
.job-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: middle;
}
.job-table th {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.76rem;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* status badges: neutral by default; semantics only for attention/error */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(15, 27, 45, 0.06);
  color: var(--ink-80);
}
.status-badge-done { background: rgba(15, 27, 45, 0.10); color: var(--ink); }
.status-badge-needs_review { background: var(--warn-bg); color: var(--warn); }
.status-badge-failed { background: var(--over-bg); color: var(--over); }

.url-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-cell a { color: var(--blue); }
.url-cell a:hover { text-decoration: underline; }
.action-cell { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* tighter buttons inside dense tables/rows */
.action-cell .button-link,
.artifact-links .button-link { min-height: 36px; padding: 0 14px; font-size: 0.85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .header-row,
  .settings-status-list li { display: grid; }
  .settings-badges { justify-content: flex-start; }
  .overview-row { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .hide-mobile { display: none; }
}

/* ---------- Result: native score view ---------- */
.result-hero {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 620px) {
  .result-hero { grid-template-columns: 240px 1fr; }
}

.result-meter { position: relative; width: 240px; max-width: 100%; margin-inline: auto; }
.result-meter__svg { display: block; width: 100%; }
.result-meter__readout { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; pointer-events: none; }
.result-meter__value {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500;
  color: var(--ink); font-size: 46px; line-height: 1; letter-spacing: -0.02em;
}
.result-meter__unit { font-family: var(--font-sans); color: var(--stone); font-size: 12px; margin-top: 4px; }

.result-rent-label { font-family: var(--font-mono); font-size: 12px; color: var(--stone); letter-spacing: 0.02em; }
.result-rent {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500;
  color: var(--ink); font-size: 44px; line-height: 1.05; margin-top: 4px;
}
.result-rent-sub { font-family: var(--font-sans); color: var(--stone); font-size: 13px; margin-top: 4px; }

.result-facts { display: grid; gap: 0; margin: 18px 0 0; }
.result-facts > div {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 8px 0; border-top: 1px solid var(--hairline);
}
.result-facts dt { color: var(--ink-80); font-size: 14px; margin: 0; }
.result-facts dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); font-size: 14px; }

/* verdict band — the one place result semantics (red/green) live */
.result-verdict {
  margin-top: 22px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  border-radius: var(--radius); padding: 16px 18px;
}
.result-verdict.is-over { background: var(--over-bg); border: 1px solid var(--over-border); }
.result-verdict.is-ok { background: var(--ok-bg); border: 1px solid var(--ok-border); }
.result-verdict__amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; font-size: 26px; white-space: nowrap; }
.is-over .result-verdict__amount { color: var(--over); }
.is-ok .result-verdict__amount { color: var(--ok); }
.result-verdict__text { font-family: var(--font-sans); font-size: 14.5px; line-height: 1.45; }
.is-over .result-verdict__text { color: #8E2E1E; }
.is-ok .result-verdict__text { color: #10663F; }
.result-verdict__text strong { font-weight: 600; }
.result-verdict .nowrap { white-space: nowrap; }

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; align-items: center; }
.result-download {
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--blue);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 7px 13px; background: var(--surface);
  transition: border-color .2s var(--ease);
}
.result-download:hover { border-color: var(--blue); }

.result-report { margin-top: 24px; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  margin-top: 8px;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  background: var(--paper);
}
.empty-state__title { font-family: var(--font-sans); font-weight: 600; color: var(--ink); margin: 0 0 6px; }
.empty-state .muted { margin: 0; }

/* ---------- Progress: pipeline rail + active-step motion ---------- */
.progress-list { position: relative; }
.progress-list::before {
  content: ""; position: absolute; left: 8px; top: 14px; bottom: 14px;
  width: 2px; background: var(--hairline); z-index: 0;
}
.progress-list li { position: relative; z-index: 1; }
.dot { position: relative; z-index: 1; }

/* purposeful pulse on the active step — transform/opacity only (reduced-motion
   safe: brand.css collapses animation-duration, leaving the static ring) */
.status-active .dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--blue); animation: wws-step-pulse 1.8s var(--ease) infinite;
}
@keyframes wws-step-pulse {
  0% { transform: scale(0.8); opacity: 0.6; }
  70% { transform: scale(1.7); opacity: 0; }
  100% { opacity: 0; }
}
