/* ============================================================
   EstonIA Lab — Console · layout e componentes
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--font-mono); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

/* ---------- sidebar / rail ---------- */
.rail {
  background: var(--rail); color: var(--rail-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: var(--sp-5) 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--sp-5) var(--sp-5); }
.brand .seal { width: 30px; height: 30px; flex: 0 0 auto; }
.brand .wm { line-height: 1; }
.brand .wm .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; color: var(--rail-muted); }
.brand .wm .n { font-size: 17px; font-weight: 800; margin-top: 3px; }
.brand .wm .n .ia { color: var(--azure-400); }
.brand .wm .n .sub { color: var(--rail-muted); font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-3); flex: 1; overflow-y: auto; }
.nav .group { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  color: var(--rail-muted); padding: var(--sp-4) var(--sp-3) var(--sp-2); }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px var(--sp-3); border-radius: var(--radius-sm);
  color: var(--rail-ink); font-weight: 500; font-size: 14px; position: relative;
}
.nav a .ico { width: 18px; height: 18px; opacity: .78; flex: 0 0 auto; }
.nav a .badge { margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  background: rgba(255,255,255,.10); color: var(--rail-muted); border-radius: 999px; padding: 1px 7px; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.active { background: rgba(79,182,236,.14); color: #fff; }
.nav a.active .ico { opacity: 1; color: var(--azure-400); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: var(--azure-400); }
.nav a.soon { opacity: .5; }
.nav a.soon .badge { background: transparent; }

/* faixa de saúde no rodapé da rail */
.rail-foot { padding: var(--sp-4) var(--sp-5) 0; border-top: 1px solid var(--rail-line); margin: 0 var(--sp-3); }
.health { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--rail-muted); padding: 6px 0; }
.health .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px rgba(46,125,91,.18); }
.health .dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(183,122,22,.18); }
.theme-toggle { display: flex; align-items: center; gap: 8px; margin-top: var(--sp-2);
  background: rgba(255,255,255,.06); border: 1px solid var(--rail-line); color: var(--rail-ink);
  border-radius: var(--radius-sm); padding: 7px 10px; font-size: 12px; width: 100%; }
.theme-toggle:hover { background: rgba(255,255,255,.10); }

/* ---------- main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: var(--step-3); font-weight: 800; letter-spacing: -.02em; margin: 0; }
.topbar .sub { color: var(--text-muted); font-size: 13px; margin-top: 1px; }
.topbar .spacer { flex: 1; }
.content { padding: var(--sp-6); max-width: 1240px; width: 100%; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); border-radius: var(--radius-sm);
  padding: 8px 14px; font-weight: 600; font-size: 13px; }
.btn:hover { background: var(--surface-2); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.06); background: var(--primary); }
.btn-accent { background: var(--accent); color: #fff; border-color: transparent; }
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-icon { padding: 8px; }

/* ---------- filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); align-items: center; }
.select { position: relative; }
.select select { appearance: none; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 999px; padding: 7px 30px 7px 14px; font-size: 13px; font-weight: 500; }
.select::after { content: "▾"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; font-size: 11px; }
.count-note { margin-left: auto; color: var(--text-muted); font-size: 13px; }

/* ---------- grade de posts ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-5); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.card .preview { position: relative; aspect-ratio: 4/5; background: var(--navy-900); overflow: hidden; }
.card .preview iframe { position: absolute; top: 0; left: 0; width: 1080px; height: 1350px;
  transform: scale(.2593); transform-origin: top left; border: 0; pointer-events: none; }
.card .preview.text { aspect-ratio: 4/5; padding: 22px; color: #EAF0F6; display: flex; flex-direction: column;
  background: linear-gradient(160deg, var(--navy-800), var(--navy-950)); }
.card .preview.text .q { font-size: 20px; font-weight: 700; line-height: 1.28; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.card .preview.text .mk { font-family: var(--font-mono); font-size: 12px; color: var(--azure-400); margin-bottom: 10px; }
.card .preview .slides-n { position: absolute; right: 8px; bottom: 8px; font-family: var(--font-mono);
  font-size: 11px; color: #fff; background: rgba(12,27,48,.72); border-radius: 6px; padding: 2px 7px; }
.card .body { padding: var(--sp-4); display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.card .title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }

/* chips / status */
.chip { font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em; padding: 3px 9px;
  border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); background: var(--surface-2); }
.chip.voz-instituto { color: var(--navy-600); border-color: var(--navy-200); background: var(--navy-50); }
.chip.voz-rapha { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.status .d { width: 8px; height: 8px; border-radius: 50%; }
.status.rascunho .d { background: var(--gray-400); } .status.rascunho { color: var(--text-muted); }
.status.aguardando_aprovacao .d { background: var(--warn); } .status.aguardando_aprovacao { color: var(--warn); }
.status.agendado .d { background: var(--accent-bright); } .status.agendado { color: var(--accent); }
.status.publicado .d { background: var(--pos); } .status.publicado { color: var(--pos); }
.status.descartado .d { background: var(--neg); } .status.descartado { color: var(--neg); }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8,21,37,.5); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 40; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 94vw);
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  transform: translateX(100%); transition: transform .22s cubic-bezier(.2,.7,.2,1); z-index: 41;
  display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer .dh { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-5);
  border-bottom: 1px solid var(--border); }
.drawer .dbody { padding: var(--sp-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-5); }
.drawer h3 { margin: 0; font-size: var(--step-2); letter-spacing: -.01em; }
.label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; color: var(--text-subtle);
  text-transform: uppercase; margin-bottom: 6px; }
.copybox { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px;
  white-space: pre-line; font-size: 14px; max-width: 62ch; }
.slidestrip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.slidestrip .fr { position: relative; flex: 0 0 auto; width: 128px; height: 160px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--border); background: var(--navy-900); }
.slidestrip .fr iframe { position: absolute; top: 0; left: 0; width: 1080px; height: 1350px;
  transform: scale(.1185); transform-origin: top left; border: 0; pointer-events: none; }

/* pré-flight / checklist */
.check { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--divider); }
.check:last-child { border-bottom: 0; }
.check .mk { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center;
  flex: 0 0 auto; font-family: var(--font-mono); font-size: 12px; }
.check.ok .mk { background: var(--pos-soft); color: var(--pos); }
.check.no .mk { background: var(--neg-soft); color: var(--neg); }

/* timeline de aprovação */
.tl { display: flex; flex-direction: column; gap: 0; }
.tl .ev { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; }
.tl .ev .t { font-family: var(--font-mono); font-size: 12px; color: var(--text-subtle); min-width: 116px; }
.tl .ev .v { font-size: 13px; }
.tl .ev.recebida .v { color: var(--accent); font-weight: 600; }

/* placeholder "em breve" */
.soon-panel { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: var(--sp-7);
  text-align: center; color: var(--text-muted); background: var(--surface); }
.soon-panel .big { font-size: var(--step-2); font-weight: 700; color: var(--text); margin-bottom: 6px; letter-spacing: -.01em; }

/* responsivo */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s; width: 244px; }
  .rail.open { transform: translateX(0); }
  .content { padding: var(--sp-4); }
}
.menu-btn { display: none; }
@media (max-width: 860px) { .menu-btn { display: inline-flex; } }
