/* ==========================================================================
   MINUTA ASSISTIDA — design system (tema CLARO, irmao do VERIFICAVEL)
   Tokens primeiro; componentes depois. Sem frameworks, sem build.
   Reaproveita a identidade do VERIFICAVEL (Fraunces + Inter, verde-custodia),
   adaptada para superficie clara — leitura calma de painel juridico.
   ========================================================================== */

:root {
  /* Paleta clara */
  --bg:          #F7F8FA;        /* fundo da pagina */
  --bg-raised:   #FFFFFF;        /* cards / superficies */
  --bg-overlay:  #EFF2F6;        /* hover / camada 2 */
  --bg-sunken:   #F0F3F7;        /* trilhos, code */
  --border:      #E2E7EE;
  --border-strong:#CBD3DF;

  --text:        #14181F;        /* texto principal */
  --text-muted:  #54607A;
  --text-faint:  #8A94A6;

  --accent:      #119E5B;        /* verde-custodia (legivel sobre branco) */
  --accent-strong:#0E7E49;
  --accent-soft: rgba(17, 158, 91, 0.10);
  --gold:        #8A6D1F;        /* dourado discreto, escuro p/ contraste */
  --gold-soft:   rgba(138, 109, 31, 0.12);
  --danger:      #C4452F;
  --danger-soft: rgba(196, 69, 47, 0.10);
  --warn:        #B5740B;
  --warn-soft:   rgba(181, 116, 11, 0.12);
  --info:        #2563B5;
  --info-soft:   rgba(37, 99, 181, 0.10);

  /* Tipografia */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* Escala */
  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 4px 16px rgba(16,24,40,0.06);
  --shadow-sm: 0 1px 2px rgba(16,24,40,0.06);
  --container: 1140px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
}

/* ------------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 var(--space-3);
}
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 var(--space-3); }

code, .mono { font-family: var(--font-mono); font-size: 0.875em; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-4);
}
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 0.875rem; }
.tabular { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); min-height: 62px;
}
.logo { display: inline-flex; align-items: center; gap: var(--space-2); }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-strong);
  border: 1px solid var(--accent); font-weight: 700;
}
.logo-text {
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
  letter-spacing: 0.04em; color: var(--text);
}
.logo-text em { font-style: normal; color: var(--accent-strong); }
.site-nav { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.site-nav a { color: var(--text-muted); font-size: 0.92rem; font-weight: 500; }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.nav-logout-form { display: inline; margin: 0; }
.nav-user { color: var(--text-faint); font-size: 0.85rem; }

/* ---------------------------------------------------------------- botoes */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0.6rem 1.3rem; border-radius: var(--radius);
  border: 1px solid transparent; font-family: var(--font-body);
  font-size: 0.93rem; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-secondary { background: var(--bg-raised); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 0.38rem 0.85rem; font-size: 0.83rem; }
.btn-lg { padding: 0.85rem 1.9rem; font-size: 1.02rem; }
.btn-block { width: 100%; }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: var(--space-4); margin-bottom: var(--space-4);
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-3);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-sub { color: var(--text-muted); font-size: 0.9rem; }

/* ----------------------------------------------------------------- layout */
.site-main { padding: var(--space-5) 0 var(--space-6); }
.page-head { margin-bottom: var(--space-4); }
.page-head .eyebrow {
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem;
  font-weight: 700; color: var(--accent-strong); margin: 0 0 var(--space-1);
}
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------- contadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.kpi {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-3) var(--space-4);
}
.kpi .num {
  font-family: var(--font-display); font-size: 2rem; font-weight: 700;
  color: var(--text); line-height: 1; font-variant-numeric: tabular-nums;
}
.kpi .lab { color: var(--text-muted); font-size: 0.82rem; margin-top: var(--space-1); }
.kpi.alert .num { color: var(--danger); }
.kpi.good .num { color: var(--accent-strong); }

/* ----------------------------------------------------------------- tabela */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  text-align: left; font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-faint); font-weight: 700;
  padding: 0 var(--space-3) var(--space-2); border-bottom: 1px solid var(--border);
}
.table td { padding: var(--space-3); border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr.row-link:hover { background: var(--bg-overlay); }
.table .cnj { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-muted); }
.table .cli { font-weight: 600; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 0.35em;
  padding: 0.2rem 0.6rem; border-radius: var(--radius-pill);
  font-size: 0.76rem; font-weight: 600; line-height: 1.4;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-nova        { background: var(--info-soft); color: var(--info); border-color: var(--info); }
.badge-lida        { background: var(--bg-overlay); color: var(--text-muted); border-color: var(--border-strong); }
.badge-minuta_gerada { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.badge-enviada     { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.badge-revisada    { background: var(--gold-soft); color: var(--gold); border-color: var(--gold); }
.badge-protocolada { background: var(--accent); color: #fff; border-color: var(--accent); }

.urg { font-weight: 700; font-size: 0.8rem; }
.urg-alta  { color: var(--danger); }
.urg-media { color: var(--warn); }
.urg-baixa { color: var(--text-muted); }

.chip {
  display: inline-flex; align-items: center; gap: 0.3em;
  padding: 0.15rem 0.5rem; border-radius: var(--radius-pill);
  font-size: 0.74rem; font-weight: 600;
  background: var(--bg-overlay); color: var(--text-muted); border: 1px solid var(--border);
}
.chip.ok   { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }

/* ----------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 var(--space-4) var(--space-5); margin: 0;
}
.timeline li::before {
  content: ""; position: absolute; left: 9px; top: 4px; bottom: -4px;
  width: 2px; background: var(--border);
}
.timeline li:last-child::before { display: none; }
.timeline .dot {
  position: absolute; left: 2px; top: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--bg-raised);
  border: 3px solid var(--accent); z-index: 1;
}
.timeline .dot.human { border-color: var(--gold); }
.timeline .dot.cit   { border-color: var(--info); }
.timeline .ev-label { font-weight: 600; }
.timeline .ev-ts { color: var(--text-faint); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.timeline .ev-detail { color: var(--text-muted); font-size: 0.88rem; margin-top: 2px; word-break: break-word; }

/* ---------------------------------------------------------------- citacoes */
.citacao {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-3); margin-bottom: var(--space-2); background: var(--bg-sunken);
}
.citacao.verificada { border-left: 3px solid var(--accent); }
.citacao.nao-verificada { border-left: 3px solid var(--warn); background: var(--warn-soft); }
.citacao .norma { font-weight: 600; }
.citacao .hash {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted);
  background: var(--bg-raised); padding: 0.1rem 0.4rem; border-radius: 6px;
  border: 1px solid var(--border); word-break: break-all;
}
.citacao .fonte-link { font-size: 0.82rem; }

/* --------------------------------------------------------------- briefing */
.briefing { background: var(--bg-sunken); border-radius: var(--radius); padding: var(--space-4); }
.briefing dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-3); margin: 0; }
.briefing dt { color: var(--text-faint); font-size: 0.82rem; font-weight: 600; }
.briefing dd { margin: 0; }
.briefing .pontos { margin: var(--space-3) 0 0; padding-left: 1.1rem; }
.briefing .pontos li { margin-bottom: var(--space-1); color: var(--text-muted); font-size: 0.9rem; }

/* meter de confianca */
.conf { display: inline-flex; align-items: center; gap: var(--space-2); }
.conf-bar { width: 90px; height: 8px; border-radius: 4px; background: var(--bg-overlay); overflow: hidden; }
.conf-bar > i { display: block; height: 100%; background: var(--accent); }
.conf-alta  > i { background: var(--accent); }
.conf-media > i { background: var(--warn); }
.conf-baixa > i { background: var(--danger); }
.conf-none { color: var(--danger); font-weight: 700; }

/* ----------------------------------------------------------------- minuta */
.minuta-texto {
  white-space: pre-wrap; font-family: var(--font-mono); font-size: 0.84rem;
  line-height: 1.7; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-4); max-height: 460px; overflow: auto;
}

/* ------------------------------------------------------------------ flash */
.flash-area { margin: 0 auto var(--space-4); }
.flash {
  border-radius: var(--radius); padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2); border: 1px solid; font-size: 0.92rem;
}
.flash-success { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.flash-error   { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.flash-info    { background: var(--info-soft); border-color: var(--info); color: var(--info); }

/* ------------------------------------------------------------- estado vazio */
.empty {
  text-align: center; padding: var(--space-5) var(--space-4);
  color: var(--text-muted); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); background: var(--bg-sunken);
}
.empty .emoji { font-size: 1.6rem; display: block; margin-bottom: var(--space-2); opacity: 0.7; }

/* -------------------------------------------------------------------- misc */
.toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.toolbar .spacer { flex: 1; }
.actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.back-link { color: var(--text-muted); font-size: 0.9rem; }
.custody-note {
  font-size: 0.82rem; color: var(--text-muted); border-left: 3px solid var(--accent);
  padding-left: var(--space-3); margin: var(--space-3) 0;
}
.row-split { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }

/* ------------------------------------------------------------------ login */
.auth-wrap { max-width: 420px; margin: var(--space-6) auto; }
.auth-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--space-5); }
.field { margin-bottom: var(--space-3); }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: var(--space-1); }
.field input {
  width: 100%; padding: 0.7rem 0.9rem; border: 1px solid var(--border-strong);
  border-radius: var(--radius); font-size: 0.95rem; font-family: var(--font-body);
  background: var(--bg-raised); color: var(--text);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--border); padding: var(--space-4) 0; margin-top: var(--space-6); }
.footer-inner { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.footer-tagline { color: var(--text-faint); font-size: 0.82rem; margin: 0; }
