:root {
  --ink: #172033;
  --muted: #5c6575;
  --paper: #ffffff;
  --wash: #f3f6fa;
  --line: #cbd3df;
  --brand: #163a70;
  --brand-strong: #0e2850;
  --accent: #f1b24a;
  --ok: #176b4a;
  --danger: #a12828;
  --focus: #ffbf47;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--wash);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--wash); line-height: 1.55; }
button, input, select { font: inherit; }
a { color: var(--brand); }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.5rem;
  left: 0.5rem;
  transform: translateY(-160%);
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: white;
  border-radius: 8px;
}
.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.site-header { background: var(--brand-strong); color: white; }
.header-inner {
  width: min(100% - 2rem, 1080px);
  margin: 0 auto;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { color: white; font-size: 1.2rem; font-weight: 800; text-decoration: none; }
.brand span { color: var(--accent); }
.demo-badge { font-size: 0.76rem; letter-spacing: 0.08em; }

.shell { width: min(100% - 2rem, 960px); margin: 0 auto; padding: 2rem 0 3rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 3vw, 2rem); box-shadow: 0 10px 30px rgba(17, 35, 60, 0.07); }
.access-panel { max-width: 640px; margin: 2rem auto; }
.eyebrow, .fixture-flag { margin: 0 0 0.4rem; color: var(--brand); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.fixture-flag { color: #714600; background: #fff3d8; display: inline-block; padding: 0.25rem 0.5rem; border-radius: 6px; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.15; margin: 0.2rem 0 1rem; }
h2 { margin-top: 1.8rem; line-height: 1.25; }
.stem { font-size: 1.08rem; }
.stack { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.35rem; }
.field label, legend { font-weight: 750; }
input[type="password"], select {
  width: 100%;
  min-height: 48px;
  border: 2px solid #8e98a8;
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  background: white;
  color: var(--ink);
}
small, .status { color: var(--muted); }
.error { color: var(--danger); font-weight: 700; min-height: 1.5em; }
.notice { border-left: 5px solid var(--accent); background: #fff8e9; padding: 0.8rem 1rem; }

.button {
  min-height: 48px;
  border: 2px solid transparent;
  border-radius: 9px;
  padding: 0.7rem 1.1rem;
  font-weight: 800;
  cursor: pointer;
}
.button.primary { background: var(--brand); color: white; }
.button.primary:hover { background: var(--brand-strong); }
.button.secondary { background: white; color: var(--brand); border-color: var(--brand); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }

.instruction-list { padding-left: 1.4rem; }
.instruction-list li + li { margin-top: 0.55rem; }
.progress { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; font-weight: 800; }
progress { width: min(55vw, 360px); height: 16px; accent-color: var(--brand); }

.visual-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 1.3rem 0 0.8rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  scrollbar-gutter: stable;
}
.visual-scroll img { display: block; width: 960px; max-width: none; height: auto; }
.transcription { margin-bottom: 1.4rem; }
.transcription summary { color: var(--brand); font-weight: 750; cursor: pointer; }

fieldset { margin: 1.5rem 0; border: 0; padding: 0; min-width: 0; }
legend { margin-bottom: 0.7rem; }
.options { display: grid; gap: 0.7rem; }
.option {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 0.75rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
}
.option:hover { border-color: var(--brand); background: #f7faff; }
.option:has(input:checked) { border-color: var(--brand); background: #eaf2ff; box-shadow: inset 0 0 0 1px var(--brand); }
.option input { width: 1.2rem; height: 1.2rem; accent-color: var(--brand); }
.option-letter { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--brand); color: white; font-weight: 800; }
fieldset:disabled .option { cursor: not-allowed; opacity: 0.78; }
.shortcut-row { margin: 1rem 0; color: var(--muted); }
.shortcut-row label { display: flex; gap: 0.6rem; align-items: flex-start; }
.shortcut-row input { width: 1.2rem; height: 1.2rem; margin-top: 0.2rem; }

.reflection { margin-top: 1.8rem; padding-top: 1.2rem; border-top: 2px solid var(--line); }
.hidden { display: none !important; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 1.4rem; }
.reflection-fieldset { margin: 1rem 0; }
.reflection-options { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.reflection-choice { min-height: 44px; min-width: 104px; border: 2px solid var(--brand); border-radius: 999px; padding: 0.55rem 1rem; background: white; color: var(--brand); font-weight: 800; cursor: pointer; }
.reflection-choice:hover { background: #f2f7ff; }
.reflection-choice[aria-pressed="true"] { background: var(--brand); color: white; box-shadow: inset 0 0 0 2px white; }

dialog { width: min(100% - 2rem, 520px); border: 0; border-radius: var(--radius); padding: 1.5rem; box-shadow: 0 20px 80px rgba(0,0,0,0.35); }
dialog::backdrop { background: rgba(8, 18, 34, 0.72); }
.dialog-actions, .panel-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.2rem; }
.panel-actions form { margin: 0; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; }
.metric { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; background: #f8fafc; }
.metric strong { display: block; color: var(--brand); font-size: clamp(1.5rem, 5vw, 2.2rem); }
.metric span { color: var(--muted); }
.summary-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.table-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; background: white; }
th, td { padding: 0.7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #edf2f8; }
code { overflow-wrap: anywhere; }
.message { padding: 0.8rem 1rem; background: #e8f6ef; color: var(--ok); border-radius: 8px; font-weight: 700; }
.site-footer { padding: 1rem; color: var(--muted); text-align: center; font-size: 0.85rem; }

@media (max-width: 680px) {
  .header-inner, .shell { width: min(100% - 1rem, 960px); }
  .header-inner { min-height: 62px; align-items: flex-start; padding: 0.75rem 0; flex-direction: column; gap: 0.25rem; }
  .shell { padding-top: 0.75rem; }
  .panel { padding: 1rem; border-radius: 10px; }
  .form-grid, .metric-grid, .summary-columns { grid-template-columns: 1fr; }
  .progress { align-items: flex-start; flex-direction: column; }
  progress { width: 100%; }
  .button { width: 100%; }
  .dialog-actions .button { width: 100%; }
  .option { grid-template-columns: auto auto minmax(0, 1fr); padding: 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (forced-colors: active) {
  .option-letter { border: 1px solid ButtonText; }
  .option:has(input:checked) { outline: 3px solid Highlight; }
}


/* P0-02: conteúdo editorial real, assets ampliáveis e diagnóstico completo. */
.editorial-content { font-size: 1.06rem; }
.editorial-content p { margin: 0.8rem 0; }
.editorial-content.command { margin-top: 1.5rem; font-weight: 700; }
.content-table { margin: 1rem 0 1.4rem; }
.content-table table { min-width: 620px; }
.source-block { margin: 1rem 0; padding: 0.9rem 1rem; border-left: 5px solid var(--brand); background: #f5f8fc; }
.source-block h2 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.asset-card { margin: 1.4rem 0; }
.asset-open { width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 0.5rem; background: #fbfcfe; color: var(--brand); cursor: zoom-in; font-weight: 750; }
.asset-open img { display: block; width: 100%; max-height: 520px; object-fit: contain; height: auto; image-rendering: auto; }
.asset-open span { display: block; padding: 0.45rem; }
.asset-dialog { width: min(96vw, 1280px); max-width: 1280px; height: min(92vh, 900px); }
.asset-dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.asset-dialog-header h2 { margin: 0; }
.asset-zoom-scroll { overflow: auto; max-width: 100%; max-height: calc(92vh - 110px); margin-top: 1rem; border: 1px solid var(--line); }
.asset-zoom-scroll img { display: block; width: min(1800px, 220vw); max-width: none; height: auto; image-rendering: auto; }
.inline-button { display: inline-flex; align-items: center; text-decoration: none; }
.feedback-item { margin-top: 2rem; padding-top: 1rem; border-top: 3px solid var(--line); }
.feedback-options { display: grid; gap: 0.75rem; padding-left: 1.5rem; }
.feedback-options li { padding: 0.75rem; border-radius: 8px; border: 1px solid var(--line); }
.feedback-options .correct-option { border-color: var(--ok); background: #edf8f2; }
.feedback-options .selected-option { box-shadow: inset 0 0 0 2px var(--brand); }
.option-analysis { margin-top: 0.45rem; color: var(--muted); }
.admin-panel { max-width: none; }
.admin-panel .metric-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.panel-actions label { display: block; font-weight: 750; }
.panel-actions input[type="datetime-local"] { min-height: 48px; border: 2px solid #8e98a8; border-radius: 8px; padding: 0.55rem; }

@media (max-width: 680px) {
  .asset-open { padding: 0.25rem; }
  .asset-dialog { width: calc(100vw - 0.5rem); height: calc(100vh - 0.5rem); padding: 0.75rem; }
  .asset-dialog-header { align-items: stretch; flex-direction: column; }
  .asset-zoom-scroll { max-height: calc(100vh - 150px); }
  .asset-zoom-scroll img { width: 240vw; }
}