/* ============================================================
   OCAF Studio — Design System (V1.0)
   Paleta: azul-marinho, azul, ciano, neutros claros, dourado (acento único)
   Modo claro. Contraste alvo: WCAG AA.
   ============================================================ */

:root {
  /* Cor */
  --navy-900: #0b1f3a;
  --navy-800: #10294d;
  --navy-700: #16345f;
  --blue-600: #1e4e8c;
  --blue-500: #2b62ab;
  --cyan-600: #147f96;
  --cyan-500: #1fa9c6;
  --cyan-100: #e3f6fa;
  --gold-500: #ad8a2e;
  --gold-100: #f7ecd2;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-sunken: #eef1f5;
  --border: #dde3ea;
  --border-strong: #c3ccd6;

  --text-primary: #142033;
  --text-secondary: #52607a;
  --text-muted: #8592a6;
  --text-on-dark: #eaf1fb;
  --text-on-dark-muted: #a9bcd8;

  --success-600: #1a7a4c;
  --success-100: #e3f5ea;
  --warning-600: #9a6400;
  --warning-100: #fbf0d9;
  --danger-600: #b0392c;
  --danger-100: #fbe7e4;
  --info-600: var(--cyan-600);
  --info-100: var(--cyan-100);

  /* Tipografia */
  --font-sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto,
    'Helvetica Neue', Arial, sans-serif;

  /* Espaço (grade base 8px) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --shell-header-h: 96px;
  --shell-sidebar-w: 240px;
  --shell-sidebar-w-collapsed: 68px;
  --shell-ai-w: 320px;

  --focus-ring: 0 0 0 3px rgba(31, 169, 198, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p {
  margin: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--blue-600);
}

.icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.icon--sm svg {
  width: 15px;
  height: 15px;
}

.icon--lg svg {
  width: 24px;
  height: 24px;
}

/* Foco visível — obrigatório para navegação por teclado */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--navy-900);
  color: #fff;
  padding: var(--sp-2) var(--sp-4);
  z-index: 200;
  border-radius: var(--radius-md);
}

.skip-link:focus {
  left: var(--sp-4);
  top: var(--sp-4);
}

/* ---------- Shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--shell-sidebar-w) 1fr var(--shell-ai-w);
  grid-template-rows: var(--shell-header-h) 1fr;
  grid-template-areas:
    'sidebar header header'
    'sidebar main ai';
  min-height: 100vh;
  transition: grid-template-columns 0.18s ease;
}

.shell.is-sidebar-collapsed {
  grid-template-columns: var(--shell-sidebar-w-collapsed) 1fr var(--shell-ai-w);
}

.shell.is-ai-collapsed {
  grid-template-columns: var(--shell-sidebar-w) 1fr 0;
}

.shell.is-sidebar-collapsed.is-ai-collapsed {
  grid-template-columns: var(--shell-sidebar-w-collapsed) 1fr 0;
}

.shell__header {
  grid-area: header;
  min-width: 0;
}

.shell__sidebar {
  grid-area: sidebar;
  min-width: 0;
}

.shell__main {
  grid-area: main;
  min-width: 0;
}

.shell__ai {
  grid-area: ai;
  overflow: hidden;
  min-width: 0;
}

/* ---------- Header ---------- */

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-5);
  height: var(--shell-header-h);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header__menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--sp-2);
  color: var(--navy-800);
}

.header__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 190px;
  font-weight: 600;
  color: var(--navy-900);
  white-space: nowrap;
}

.header__brand-wordmark {
  height: 56px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.header__brand-tagline {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.025em;
  line-height: 1.12;
  text-align: center;
}

.header__project {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  min-width: 0;
}

.header__project-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--navy-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.header__project-status {
  font-size: 12px;
  color: var(--text-secondary);
}

.header__spacer {
  flex: 1;
}

.header__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.header__meta-stats {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.header__meta-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.header__meta-value {
  font-weight: 600;
  color: var(--navy-900);
  font-size: 13.5px;
}

.header__meta-label {
  font-size: 11px;
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-4);
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn--primary {
  background: var(--blue-600);
  color: #fff;
}

.btn--primary:hover {
  background: var(--navy-800);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--navy-800);
}

.btn--ghost:hover {
  background: var(--surface-sunken);
}

.btn--sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: 12.5px;
}

/* ---------- Sidebar ---------- */

.sidebar {
  background: var(--navy-900);
  color: var(--text-on-dark);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
}

.sidebar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--sp-3) var(--sp-3) 0;
  padding: var(--sp-2);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: var(--text-on-dark-muted);
  align-self: flex-end;
}

.sidebar__toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar__nav {
  list-style: none;
  margin: var(--sp-4) 0 0;
  padding: 0 var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  color: var(--text-on-dark-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
}

.sidebar__link .icon {
  flex-shrink: 0;
}

.sidebar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar__link.is-active {
  background: rgba(31, 169, 198, 0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--cyan-500);
}

.shell.is-sidebar-collapsed .sidebar__link-label,
.shell.is-sidebar-collapsed .sidebar__footer-text {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar__link {
  justify-content: center;
}

.sidebar__footer {
  margin-top: auto;
  padding: var(--sp-4);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11.5px;
  color: var(--text-on-dark-muted);
}

.sidebar__footer-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

.sidebar__footer-mark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
}

.shell.is-sidebar-collapsed .sidebar__footer-brand {
  justify-content: center;
}

/* ---------- Main content ---------- */

.main {
  padding: var(--sp-6);
  max-width: 1180px;
}

.page-header {
  margin-bottom: var(--sp-6);
}

.page-header__eyebrow {
  font-size: 12px;
  color: var(--cyan-600);
  font-weight: 600;
  margin-bottom: var(--sp-1);
}

.page-header__title {
  font-size: 22px;
  font-weight: 650;
  color: var(--navy-900);
}

.page-header__desc {
  color: var(--text-secondary);
  margin-top: var(--sp-2);
  max-width: 68ch;
}

.section {
  margin-bottom: var(--sp-8);
}

.section__title {
  font-size: 15px;
  font-weight: 650;
  color: var(--navy-900);
  margin-bottom: var(--sp-3);
}

.grid {
  display: grid;
  gap: var(--sp-4);
}

.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 980px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

/* ---------- Guia de uso ---------- */

.guide-intro {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-5);
  align-items: center;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  color: var(--text-on-dark);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}

.guide-intro .section__title {
  color: var(--text-on-dark);
  margin-bottom: var(--sp-2);
}

.guide-intro p {
  color: var(--text-on-dark-muted);
  line-height: 1.6;
  max-width: 78ch;
}

.guide-intro__mark {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: var(--cyan-500);
  font-weight: 750;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.04);
}

.guide-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(7, minmax(145px, 1fr));
  gap: var(--sp-3);
  margin: 0;
  padding: 0 0 var(--sp-2);
  overflow-x: auto;
}

.guide-step {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

.guide-step__number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: var(--sp-3);
  border-radius: 50%;
  background: var(--blue-600);
  color: #fff;
  font-weight: 700;
}

.guide-step h3 {
  color: var(--navy-900);
  font-size: 13px;
  margin-bottom: var(--sp-2);
}

.guide-step p,
.guide-principles p {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  margin-top: var(--sp-2);
}

.guide-section-desc {
  color: var(--text-secondary);
  margin: calc(-1 * var(--sp-2)) 0 var(--sp-4);
}

.guide-modules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
}

.guide-module {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

.guide-module__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--blue-600);
  background: var(--cyan-100);
}

.guide-module__title {
  color: var(--navy-900);
  font-size: 15px;
  margin-bottom: var(--sp-2);
}

.guide-module__purpose,
.guide-module__moment {
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.5;
}

.guide-module__moment {
  margin-top: var(--sp-2);
}

.guide-module__link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  margin-top: var(--sp-3);
  color: var(--blue-600);
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: none;
}

.guide-module__link:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .guide-intro {
    grid-template-columns: 1fr;
  }

  .guide-intro__mark {
    width: 68px;
    height: 68px;
  }

  .guide-modules {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
}

.stat-card__label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-card__value {
  font-size: 26px;
  font-weight: 650;
  color: var(--navy-900);
  margin-top: var(--sp-1);
}

.stat-card__bar {
  margin-top: var(--sp-3);
  height: 6px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
}

.stat-card__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-600), var(--cyan-500));
  border-radius: 999px;
}

.stat-card--gold .stat-card__bar-fill {
  background: linear-gradient(90deg, var(--gold-500), #cdaa4c);
}

/* Jornada */

.journey {
  display: flex;
  align-items: center;
  overflow-x: auto;
  padding: var(--sp-2) 0;
}

.journey__step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.journey__dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 650;
  border: 2px solid var(--border-strong);
  color: var(--text-muted);
  background: var(--surface);
  flex-shrink: 0;
}

.journey__step.is-done .journey__dot {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
}

.journey__step.is-current .journey__dot {
  border-color: var(--cyan-500);
  color: var(--cyan-600);
}

.journey__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.journey__step.is-done .journey__label {
  color: var(--navy-900);
}

.journey__connector {
  width: 40px;
  height: 2px;
  background: var(--border-strong);
  margin: 0 var(--sp-2);
  flex-shrink: 0;
}

.journey__step.is-done + .journey__connector {
  background: var(--blue-600);
}

/* Listas */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item__title {
  font-weight: 600;
  color: var(--navy-900);
  font-size: 13.5px;
}

.list-item__meta {
  font-size: 12px;
  color: var(--text-muted);
}

.tag {
  font-size: 11px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Pills de estado */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill--sugerida { background: var(--surface-sunken); color: var(--text-secondary); }
.pill--em_revisao { background: var(--warning-100); color: var(--warning-600); }
.pill--aprovada { background: var(--info-100); color: var(--info-600); }
.pill--implementada { background: #e6ecfb; color: var(--blue-600); }
.pill--testada { background: var(--success-100); color: var(--success-600); }
.pill--suspensa { background: var(--danger-100); color: var(--danger-600); }
.pill--substituida { background: var(--surface-sunken); color: var(--text-muted); }
.pill--arquivada { background: var(--surface-sunken); color: var(--text-muted); border: 1px dashed var(--border-strong); }

.pill--baixa { background: var(--surface-sunken); color: var(--text-secondary); }
.pill--media { background: var(--info-100); color: var(--info-600); }
.pill--alta { background: var(--warning-100); color: var(--warning-600); }
.pill--critica { background: var(--danger-100); color: var(--danger-600); }

/* Barra / legenda de confiança (elemento de assinatura do produto) */

.confidence-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--surface-sunken);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

.confidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  border: 1px solid transparent;
  cursor: default;
}

.confidence-chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.confidence-chip--fato { background: #eef4ff; color: var(--blue-600); }
.confidence-chip--fato .confidence-chip__dot { background: var(--blue-600); }

.confidence-chip--evidencia { background: var(--success-100); color: var(--success-600); }
.confidence-chip--evidencia .confidence-chip__dot { background: var(--success-600); }

.confidence-chip--hipotese { background: var(--surface); color: var(--text-secondary); border-color: var(--border-strong); }
.confidence-chip--hipotese .confidence-chip__dot { background: var(--text-muted); }

.confidence-chip--sugestao { background: var(--cyan-100); color: var(--cyan-600); }
.confidence-chip--sugestao .confidence-chip__dot { background: var(--cyan-600); }

.confidence-chip--inferencia { background: var(--gold-100); color: var(--gold-500); }
.confidence-chip--inferencia .confidence-chip__dot { background: var(--gold-500); }

/* ---------- Painel de IA ---------- */

.ai-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  height: 100%;
  min-height: calc(100vh - var(--shell-header-h));
  display: flex;
  flex-direction: column;
  width: var(--shell-ai-w);
}

.ai-panel__header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.ai-panel__title {
  font-weight: 650;
  color: var(--navy-900);
  font-size: 13.5px;
  flex: 1;
}

.ai-panel__body {
  padding: var(--sp-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.suggestion-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.suggestion-card__text {
  font-size: 12.8px;
  color: var(--text-primary);
  line-height: 1.5;
}

.suggestion-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.suggestion-card__impact {
  font-size: 11px;
  color: var(--text-muted);
}

.ai-panel__disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
}

/* ---------- Tabela de regras ---------- */

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
  margin-bottom: var(--sp-4);
}

.field {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 6px var(--sp-3);
  color: var(--text-secondary);
}

.field select,
.field input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  min-width: 90px;
}

.rules-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--sp-5);
  align-items: start;
}

.rules-layout > * {
  min-width: 0;
}

@media (max-width: 1080px) {
  .rules-layout { grid-template-columns: 1fr; }
}

table.rules-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.table-scroll table.rules-table {
  min-width: 640px;
}

.rules-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: none;
  color: var(--text-muted);
  font-weight: 650;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
}

.rules-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.rules-table tbody tr {
  cursor: pointer;
}

.rules-table tbody tr:hover {
  background: var(--cyan-100);
}

.rules-table tbody tr.is-selected {
  background: #e6f3f7;
  box-shadow: inset 3px 0 0 var(--cyan-500);
}

.rules-table tbody tr:last-child td {
  border-bottom: none;
}

.rule-id {
  font-weight: 650;
  color: var(--navy-900);
}

.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  position: sticky;
  top: calc(var(--shell-header-h) + var(--sp-4));
}

.detail-panel__row {
  margin-bottom: var(--sp-4);
}

.detail-panel__label {
  font-size: 11px;
  font-weight: 650;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-panel__value {
  font-size: 13px;
  color: var(--text-primary);
}

/* Estados vazio / carregando / erro */

.state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
}

.state-block__icon {
  color: var(--text-muted);
}

.state-block__title {
  font-weight: 650;
  color: var(--navy-900);
  font-size: 14px;
}

.state-block__desc {
  font-size: 13px;
  max-width: 42ch;
}

.state-block--error .state-block__icon { color: var(--danger-600); }
.state-block--error { border-color: var(--danger-100); background: var(--danger-100); }
.state-block--error .state-block__title { color: var(--danger-600); }

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--cyan-500);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.state-toggle {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

/* Progresso circular simples (RC18 dimensões) */

.dim-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  background: var(--surface);
}

.dim-card__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--sp-2);
}

.dim-card__name {
  font-weight: 650;
  color: var(--navy-900);
  font-size: 13.5px;
}

.dim-card__pct {
  font-weight: 650;
  color: var(--cyan-600);
  font-size: 14px;
}

.dim-card__desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
  min-height: 32px;
}

.dim-card__bar {
  height: 6px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: var(--sp-2);
}

.dim-card__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-600), var(--cyan-500));
}

.dim-card__meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Selo de pacote regulatório (uso do dourado como acento único) */

.package-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--gold-100);
  color: var(--gold-500);
  font-size: 12px;
  font-weight: 650;
  border: 1px solid #e6d29f;
}

.callout {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--cyan-100);
  color: var(--navy-900);
  font-size: 13px;
}

.callout__icon { color: var(--cyan-600); flex-shrink: 0; }

.callout--warning {
  background: var(--warning-100);
  border-color: #f0dba3;
}
.callout--warning .callout__icon { color: var(--warning-600); }

/* Requisitos RC18 mini-matriz */

.req-row {
  display: grid;
  grid-template-columns: 90px 110px 1fr 140px;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.req-row:last-child { border-bottom: none; }

.req-row__id { font-weight: 650; color: var(--navy-900); }
.req-row__origem { color: var(--text-muted); font-size: 12px; }

@media (max-width: 720px) {
  .req-row { grid-template-columns: 1fr; gap: var(--sp-1); }
}

/* Empty demo project card / configurações */

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-4);
  max-width: 640px;
}

.form-row label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--navy-900);
}

.form-row input,
.form-row select,
.form-row textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  max-width: 520px;
}

.switch-row:last-child { border-bottom: none; }

.switch-row__label { font-weight: 600; font-size: 13px; color: var(--navy-900); }
.switch-row__desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.switch {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  border: none;
  flex-shrink: 0;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.switch.is-on {
  background: var(--blue-600);
}

.switch.is-on::after {
  transform: translateX(16px);
}

/* Rodapé de dados fictícios */

.demo-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 11.5px;
  color: var(--warning-600);
  background: var(--warning-100);
  border: 1px solid #f0dba3;
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-5);
}

/* ---------- Mobile ---------- */

.mobile-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .shell {
    --shell-header-h: 64px;
    grid-template-columns: 1fr;
    grid-template-areas:
      'header'
      'main';
  }

  .header__menu-btn {
    display: inline-flex;
  }

  .header__project-name { max-width: 120px; }
  .header__meta-stats { display: none; }
  .header__btn-label { display: none; }
  .header__ai-btn { display: none; }
  .header { gap: var(--sp-2); padding: 0 var(--sp-3); }
  .header__brand {
    min-width: auto;
  }
  .header__brand-wordmark {
    display: block;
    height: 36px;
  }
  .header__brand-tagline { display: none; }

  .shell__sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .shell.is-mobile-nav-open .shell__sidebar {
    transform: translateX(0);
  }

  .shell.is-mobile-nav-open .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(11, 31, 58, 0.4);
    z-index: 50;
  }

  .shell__ai {
    position: fixed;
    inset: auto 0 0 0;
    height: 78vh;
    z-index: 60;
    transform: translateY(100%);
    transition: transform 0.2s ease;
    box-shadow: 0 -8px 24px rgba(11, 31, 58, 0.18);
  }

  .shell.is-mobile-ai-open .shell__ai {
    transform: translateY(0);
  }

  .ai-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .mobile-fab {
    display: flex;
  }

  .main { padding: var(--sp-4); }

  .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
}

.mobile-fab {
  display: none;
  position: fixed;
  right: var(--sp-4);
  bottom: var(--sp-4);
  z-index: 55;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  align-items: center;
  justify-content: center;
  border: none;
  box-shadow: 0 6px 18px rgba(11, 31, 58, 0.35);
}

/* Bottom mobile nav — navegação móvel funcional (alternativa ao drawer) */

.mobile-tabbar {
  display: none;
}

@media (max-width: 900px) {
  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 40;
    padding: 6px var(--sp-2);
    justify-content: space-between;
  }

  .mobile-tabbar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 600;
    padding: 4px;
  }

  .mobile-tabbar__item.is-active {
    color: var(--blue-600);
  }

  .main {
    padding-bottom: 84px;
  }
}

/* ============================================================
   Portão 1 — Descoberta: formulários, diálogos, persistência
   ============================================================ */

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

.form-row--error input,
.form-row--error select,
.form-row--error textarea {
  border-color: var(--danger-600);
}

.form-row__required {
  color: var(--danger-600);
}

.form-row__hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0;
}

.form-row__error {
  font-size: 12px;
  color: var(--danger-600);
  font-weight: 600;
  margin: 0;
}

.btn--danger {
  background: var(--danger-600);
  color: #fff;
}
.btn--danger:hover {
  background: #8f2c21;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Diálogo de confirmação */

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 58, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--sp-4);
}

.dialog-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(11, 31, 58, 0.35);
}

.dialog-box__title {
  font-size: 16px;
  font-weight: 650;
  color: var(--navy-900);
  margin-bottom: var(--sp-3);
}

.dialog-box__desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-5);
  line-height: 1.5;
}

.dialog-box__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
}

/* Indicador de autosave */

.autosave-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.autosave-indicator--salvo { color: var(--success-600); }
.autosave-indicator--erro { color: var(--danger-600); }
.autosave-indicator--salvando { color: var(--cyan-600); }

.spinner--sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

/* Cartões de projeto e fonte */

.project-card--active {
  box-shadow: inset 3px 0 0 var(--cyan-500);
  background: #f7fcfd;
}

.tag--done {
  background: var(--success-100);
  color: var(--success-600);
}

.source-card { }

.source-preview {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

/* Evidências (Persona) */

.evidence-row {
  display: grid;
  grid-template-columns: auto 150px 1fr 180px auto;
  gap: var(--sp-2);
  align-items: center;
}

.evidence-row select,
.evidence-row input {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px var(--sp-2);
  font-size: 12.5px;
  background: var(--surface);
}

@media (max-width: 900px) {
  .evidence-row {
    grid-template-columns: 1fr;
  }
}

/* Requisitos PRD (RF/RNF) */

.requirement-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  background: var(--surface);
}

.requirement-row__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.requirement-row__head select {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px var(--sp-2);
  font-size: 12px;
}

.requirement-row__actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.requirement-row textarea,
.requirement-row input[type='text'] {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3);
  font-size: 13px;
  width: 100%;
  font-family: inherit;
}

/* Banner de dados reais/locais (distinto do banner de protótipo) */

.demo-banner--local {
  color: var(--blue-600);
  background: var(--cyan-100);
  border-color: #b9e4ee;
}

/* ============================================================
   Portão 2 — Estúdio de Regras
   ============================================================ */
/* A maior parte dos estilos necessários (tabela mestre-detalhe, pills,
   cartões, formulários, diálogos) já existe desde o Portão 0/1 e é
   reaproveitada integralmente — ver .rules-layout, .rules-table,
   .detail-panel, .requirement-row, .dialog-box, .form-row. */

/* ============================================================
   Portão 3 — Arquitetura, Agentes e Execução Governada
   ============================================================ */
/* Nenhuma classe nova foi necessária: Arquitetura, Agentes, Plano de
   Execução e Pacotes de Prompt reaproveitam integralmente o mesmo design
   system (.rules-layout, .rules-table, .detail-panel, .requirement-row,
   .callout, .stat-card, .source-preview). O diagrama simples de
   componentes/relações é SVG puro construído via DOM (createElementNS),
   sem innerHTML e sem biblioteca gráfica externa. */

/* ============================================================
   Portão 4 — Qualidade, Evidências e Encerramento (V1.0)
   ============================================================ */
/* Também nenhuma classe nova: Testes, Execuções, Evidências, Auditoria
   Final e Encerramento reaproveitam integralmente o mesmo design system
   estabelecido desde o Portão 0. Upload de arquivo de Evidência reusa o
   mesmo padrão visual e as mesmas validações de Fontes. */
