/* ============================================================
   Componentes das telas (KPI, painéis, radar, WhatsApp, XMind,
   calendário, auditoria, paleta, toast).
   ============================================================ */
h2 { font-size: var(--step-1); font-weight: 700; letter-spacing: -.01em; margin: 0; }
.hint { color: var(--text-muted); font-size: 12.5px; margin-top: 8px; }
.empty { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
.mini-link { font-size: 12px; font-family: var(--font-mono); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }

.mock-note { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm);
  padding: 9px 14px; font-size: 12.5px; margin-bottom: var(--sp-5); font-weight: 500; }

/* painéis / grid */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--sp-5); margin-bottom: var(--sp-5); }
.panel .ph { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.panel .ph .hint { margin: 0; margin-left: auto; }
.panel .ph .mini-link { margin-left: auto; }
.col2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
@media (max-width: 760px) { .col2 { grid-template-columns: 1fr; } }

/* KPI */
.kpirow { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.kpirow.five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .kpirow, .kpirow.five { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow); }
.kpi .kl { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--text-subtle); text-transform: uppercase; }
.kpi .kv { font-size: var(--step-4); font-weight: 600; letter-spacing: -.02em; margin: 6px 0 2px; }
.kpi .kd { font-size: 12px; font-weight: 600; }
.kpi .kd.up { color: var(--pos); } .kpi .kd.down { color: var(--neg); }

/* listas compactas */
.mini-list, .stack { margin-top: 4px; }
.mli { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--divider); font-size: 13.5px; }
.mli:last-child { border-bottom: 0; }
.mli .mlt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mli .sc { color: var(--text-muted); }

/* radar */
.radar-balance { display: flex; flex-wrap: wrap; gap: 8px; }
.radar-balance.big { margin-bottom: var(--sp-5); }
.rb { font-family: var(--font-mono); font-size: 12px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); }
.rb.quente { color: #B23B3B; border-color: #E7B7B7; background: var(--danger-100); }
.rb.forte { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.rb.semente { color: var(--success-600); border-color: #BFE0CD; background: var(--success-100); }
.rb.descarte { color: var(--text-muted); }
.faixa { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.faixa.quente { background: #B23B3B; } .faixa.forte { background: var(--accent-bright); }
.faixa.semente { background: var(--success-600); } .faixa.descarte { background: var(--gray-400); }
.radar-list { display: flex; flex-direction: column; }
.ritem { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; }
.ritem .rmain { flex: 1; min-width: 0; }
.ritem .rt { font-weight: 600; font-size: 14.5px; }
.ritem .rmeta { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.ritem .score { font-size: 20px; font-weight: 600; color: var(--navy-500); min-width: 34px; text-align: right; }
.ritem .racts { display: flex; gap: 6px; }

/* WhatsApp / aprovações */
.wacard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--sp-5); }
.wah { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.wah .watitle { font-weight: 700; letter-spacing: -.01em; }
.waflow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wa-step { font-family: var(--font-mono); font-size: 12px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-subtle); }
.wa-step.on { color: #fff; background: var(--accent); border-color: transparent; }
.wa-step.on.resp { background: var(--pos); }
.wa-arr { color: var(--text-subtle); }
.wafoot { color: var(--text-muted); font-size: 12.5px; margin-top: 12px; }

/* charts */
.chart line { vector-effect: non-scaling-stroke; }
.donut-wrap { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 8px; }
.lg-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lg-row .sw { width: 12px; height: 12px; border-radius: 3px; }
.lg-row b { margin-left: auto; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 54px; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .bl { color: var(--text-muted); }
.bar-row .track { position: relative; height: 12px; background: var(--surface-2); border-radius: 999px; }
.bar-row .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }
.bar-row .tgt { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--navy-500); }
.bar-row .bv { text-align: right; color: var(--text); }

/* progress */
.pgtrack { display: inline-block; width: 160px; height: 8px; background: var(--surface-2); border-radius: 999px; vertical-align: middle; overflow: hidden; }
.pgtrack.big { display: block; width: 100%; height: 12px; margin-top: 6px; }
.pgfill { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s; }

/* XMind */
.xm-bar { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.xm-name { color: var(--text-muted); font-size: 13px; }
.xm-prog { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.xm-pct { font-size: 13px; color: var(--text-muted); }
.xm-map { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); }
.mapscroll { overflow: auto; padding: 8px; }
.mapcanvas { position: relative; }
.mnode { position: absolute; display: flex; align-items: center; gap: 8px; height: 34px; width: 190px;
  padding: 0 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px;
  box-shadow: 0 1px 2px rgba(12,26,46,.08); font-size: 13px; }
.mnode.branch { background: var(--navy-700); color: #EAF0F6; border-color: transparent; font-weight: 600; }
.mnode.branch .mtitle { color: #EAF0F6; }
.mnode.done { border-color: var(--accent); }
.mnode.done .mtitle { color: var(--text-subtle); text-decoration: line-through; }
.mnode .mtitle { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcheck { width: 20px; height: 20px; flex: 0 0 auto; border-radius: 6px; border: 1.5px solid var(--border-strong);
  background: var(--surface); display: grid; place-items: center; padding: 0; color: #fff; }
.mnode.branch .mcheck { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.1); }
.mnode.done .mcheck { background: var(--accent); border-color: var(--accent); }
.mcheck .ico { width: 13px; height: 13px; }

/* calendário */
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
@media (max-width: 760px) { .calgrid { grid-template-columns: repeat(2, 1fr); } }
.cal-cell { border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 92px; padding: 8px; background: var(--bg-2); }
.cal-d { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 2px; }
.cal-d .num { color: var(--text); font-weight: 600; }

/* auditoria */
.audit { border-left: 2px solid var(--border); margin-left: 8px; }
.aev { display: grid; grid-template-columns: 132px 96px 1fr; gap: 14px; align-items: baseline; padding: 11px 0 11px 18px; position: relative; }
.aev::before { content: ""; position: absolute; left: -7px; top: 16px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); }
.aev .at { font-size: 12px; color: var(--text-subtle); }
.aev .aactor { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--accent); text-transform: uppercase; }
.aev .aev-t { font-size: 13.5px; }
@media (max-width: 620px) { .aev { grid-template-columns: 1fr; gap: 2px; } }

/* saúde */
.wa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
@media (max-width: 620px) { .wa-grid { grid-template-columns: 1fr; } }
.big { font-size: var(--step-2); }
.health-mini { display: flex; flex-direction: column; gap: 8px; }
.health-mini .hm { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.health-mini .dot, .mli .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); flex: 0 0 auto; }
.health-mini .dot.warn, .mli .dot.warn { background: var(--warn); }

/* toast */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); z-index: 60;
  background: var(--navy-900); color: #EAF0F6; padding: 12px 18px; border-radius: 10px; font-size: 13.5px;
  max-width: 480px; box-shadow: 0 10px 40px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: all .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* paleta ⌘K */
.palette { position: fixed; inset: 0; background: rgba(8,21,37,.45); backdrop-filter: blur(3px); z-index: 70;
  display: none; align-items: flex-start; justify-content: center; padding-top: 14vh; }
.palette.open { display: flex; }
.pal-box { width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.4); overflow: hidden; }
.pal-box input { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 16px 18px; font-size: 15px; font-family: var(--font-sans); outline: none; }
.pal-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.pal-item { padding: 10px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.pal-item.sel, .pal-item:hover { background: var(--accent-soft); color: var(--accent); }
.pal-empty { padding: 16px; color: var(--text-muted); font-size: 13px; }

/* ---------- visualizador de slides (lightbox) ---------- */
.viewer { position: fixed; inset: 0; background: rgba(6,15,28,.92); backdrop-filter: blur(4px);
  z-index: 80; display: none; align-items: center; justify-content: center; }
.viewer.open { display: flex; }
.viewer .v-close { position: absolute; top: 18px; right: 18px; background: rgba(255,255,255,.12);
  border: 0; color: #fff; border-radius: 10px; padding: 9px; cursor: pointer; }
.viewer .v-close:hover { background: rgba(255,255,255,.22); }
.viewer .v-nav { background: rgba(255,255,255,.08); border: 0; color: #fff; font-size: 32px;
  width: 52px; height: 52px; border-radius: 50%; cursor: pointer; flex: 0 0 auto; line-height: 1; }
.viewer .v-nav:hover { background: rgba(255,255,255,.2); }
.viewer .v-stage { position: relative; height: 82vh; aspect-ratio: 4/5; margin: 0 18px; border-radius: 14px;
  overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,.55); background: #0C1B30; }
.viewer .v-stage iframe { position: absolute; top: 0; left: 0; border: 0; }
.viewer .v-dots { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 7px; }
.viewer .v-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.3); }
.viewer .v-dots span.on { background: #fff; }
.viewer .v-textwrap { max-width: 640px; background: var(--surface); color: var(--text); border-radius: 16px;
  padding: 34px; max-height: 82vh; overflow: auto; }
.viewer .v-mk { font-family: var(--font-mono); font-size: 12px; color: var(--accent); margin-bottom: 14px; }
.viewer .v-copy { white-space: pre-line; font-size: 16px; line-height: 1.62; }

/* ---------- calendário interativo ---------- */
.cal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-nav strong { font-size: 16px; min-width: 160px; text-align: center; }
.cal-toggle { display: flex; gap: 6px; }
.calpanel { padding: 14px; }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calgrid.heads { margin-bottom: 8px; }
.cal-head { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; color: var(--text-subtle);
  text-transform: uppercase; text-align: center; padding: 4px 0; }
.cal-cell { min-height: 108px; border: 1px solid var(--border); border-radius: 10px; padding: 7px;
  background: var(--bg-2); display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  transition: border-color .12s, background .12s; }
.cal-cell.empty-cell { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell.drop { border-color: var(--accent); background: var(--accent-soft); }
.cal-cell .cal-d { font-size: 12px; color: var(--text-muted); }
.cal-cell .cal-d .num { font-weight: 700; color: var(--text); }
.cal-items { display: flex; flex-direction: column; gap: 4px; }
.cal-sched { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 6px;
  padding: 3px 6px; display: flex; align-items: center; gap: 5px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-sched .dotmini { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.cal-note { font-size: 11px; background: var(--surface-2); color: var(--text); border-radius: 6px;
  padding: 3px 6px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-note:hover, .cal-sched:hover { filter: brightness(.96); }
.cal-input { width: 100%; border: 1px solid var(--accent); border-radius: 6px; padding: 3px 6px;
  font-size: 11px; font-family: var(--font-sans); background: var(--surface); color: var(--text); outline: none; }
@media (max-width: 760px) { .cal-cell { min-height: 72px; } }

.agstack { display: flex; flex-direction: column; gap: 8px; }
.agchip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); cursor: grab; box-shadow: var(--shadow); }
.agchip:active { cursor: grabbing; }
.agchip .grip { color: var(--text-subtle); font-size: 13px; letter-spacing: -3px; }
.agchip .mlt { flex: 1; }

/* ---------- formulários (pautas) ---------- */
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inp { border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 13.5px;
  font-family: var(--font-sans); background: var(--surface); color: var(--text); outline: none; }
.inp:focus { border-color: var(--accent); }
.inp.grow { flex: 1; min-width: 240px; }

/* tooltip do mapa mental (texto completo de nós cortados) */
.mtip { position: fixed; z-index: 90; display: none; max-width: 300px; line-height: 1.4;
  background: var(--navy-900); color: #EAF0F6; padding: 7px 11px; border-radius: 8px;
  font-size: 12.5px; box-shadow: 0 8px 30px rgba(0,0,0,.35); pointer-events: none; }

/* ---------- anexos do XMind (chips + leitor) ---------- */
.mnode.att, .mnode.lnk { cursor: pointer; background: var(--accent-soft); border-color: var(--accent); }
.mnode.att .mtitle, .mnode.lnk .mtitle { color: var(--accent); }
.mnode.att:hover, .mnode.lnk:hover { filter: brightness(1.04); }
.att-ico { flex: 0 0 auto; color: var(--accent); display: inline-flex; }
.att-ico .ico { width: 16px; height: 16px; }
.att-ext { font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; margin-left: auto; flex: 0 0 auto; }

.attmodal { position: fixed; inset: 0; background: rgba(8,21,37,.55); backdrop-filter: blur(3px);
  z-index: 85; display: none; align-items: center; justify-content: center; padding: 4vh 3vw; }
.attmodal.open { display: flex; }
.attbox { background: var(--surface); color: var(--text); border-radius: 14px; width: min(900px, 96vw);
  height: min(88vh, 940px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.42); }
.atthead { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.atthead .attname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atthead .attsp { flex: 1; }
.attbody { flex: 1; overflow: auto; }
.attbody .md { padding: 24px 28px; max-width: 76ch; margin: 0 auto; }
.attloading { padding: 40px; text-align: center; color: var(--text-muted); }
.pdfframe { width: 100%; height: 100%; border: 0; display: block; }

/* markdown renderizado */
.md { font-size: 15px; line-height: 1.65; }
.md > :first-child { margin-top: 0; }
.md h1 { font-size: 26px; } .md h2 { font-size: 21px; } .md h3 { font-size: 18px; }
.md h1, .md h2, .md h3, .md h4 { font-weight: 800; letter-spacing: -.01em; margin: 1.2em 0 .5em; line-height: 1.2; }
.md p { margin: .7em 0; }
.md ul, .md ol { padding-left: 1.4em; margin: .6em 0; }
.md li { margin: .3em 0; }
.md a { color: var(--accent); }
.md code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--surface-2); padding: 14px; border-radius: 8px; overflow: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--accent); margin: .8em 0; padding: .2em 0 .2em 14px; color: var(--text-muted); }
.md table { border-collapse: collapse; width: 100%; margin: .8em 0; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md img { max-width: 100%; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }

/* ---------- eventos do calendário ---------- */
.cal-event { font-size: 11px; border-radius: 6px; padding: 3px 7px; cursor: pointer; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event:hover { filter: brightness(1.08); }
.cat-post { background: var(--navy-500); }
.cat-evento { background: var(--accent); }
.cat-reuniao { background: var(--success-600); }
.cat-lembrete { background: var(--warning-600); }
.cat-badge { display: inline-block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
  color: #fff; border-radius: 999px; padding: 3px 11px; }

.evbox { background: var(--surface); color: var(--text); border-radius: 14px; width: min(540px, 96vw);
  max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.42); }
.evform { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 13px; }
.evform > label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.evform .inp { width: 100%; font-weight: 400; color: var(--text); }
.evform textarea.inp { resize: vertical; font-family: var(--font-sans); }
.evform .select, .evform .select select { width: 100%; display: block; }
.evrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.evrow label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.evactions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.evform h3 { margin: 4px 0 0; font-size: 19px; color: var(--text); letter-spacing: -.01em; }
.evmeta { color: var(--text-muted); font-size: 13px; }
.evlink { color: var(--accent); word-break: break-all; font-size: 13.5px; }
