/* ============================================================================
   SOFIA · Mentora Digital & Cockpit Estratégico
   Sistema visual compartilhado pelas 6 telas (TV 16:9 · Desktop · Tablet · PWA)
   Paleta: Grafite Profundo #0F172A · Azul Noturno #1E293B · Ouro Rosé #F59E0B
   ========================================================================== */

/* ─── tokens ─────────────────────────────────────────────────────────────── */
:root {
  --ink:       #0F172A;
  --night:     #1E293B;
  --night-2:   #172033;
  --night-3:   #243449;

  --fg:        #F1F5F9;
  --muted:     #94A3B8;
  --border:    color-mix(in oklch, var(--muted) 20%, transparent);
  --border-2:  color-mix(in oklch, var(--muted) 12%, transparent);

  --gold:      #F59E0B;
  --gold-deep: #D97706;
  --gold-soft: color-mix(in oklch, var(--gold) 15%, transparent);
  --gold-ink:  color-mix(in oklch, var(--gold) 58%, white);

  --ok:        #10B981;
  --warn:      #FBBF24;
  --bad:       #EF4444;
  --ok-soft:   color-mix(in oklch, var(--ok) 15%, transparent);
  --warn-soft: color-mix(in oklch, var(--warn) 15%, transparent);
  --bad-soft:  color-mix(in oklch, var(--bad) 15%, transparent);
  --ok-ink:    color-mix(in oklch, var(--ok) 55%, white);
  --warn-ink:  color-mix(in oklch, var(--warn) 55%, white);
  --bad-ink:   color-mix(in oklch, var(--bad) 55%, white);

  --board:       color-mix(in oklch, black 52%, var(--ink));
  --board-frame: color-mix(in oklch, black 70%, var(--ink));

  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 18px 44px -22px color-mix(in oklch, black 70%, transparent);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ─── base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--ink); color: var(--fg);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--gold-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--night-3); border-radius: 999px; border: 2px solid var(--ink); }
.no-bar::-webkit-scrollbar { display: none; }
.no-bar { -ms-overflow-style: none; scrollbar-width: none; }

/* ─── shell ──────────────────────────────────────────────────────────────── */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklch, var(--ink) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-2);
}
.topbar-in { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 1680px; margin-inline: auto; padding: 12px clamp(16px, 2vw, 32px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 38px; height: 38px; flex: 0 0 auto; }
.brand b { display: block; font-size: 17px; font-weight: 800; letter-spacing: 0.16em; }
.brand span { display: block; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-family: var(--font-mono); }
.top-title { min-width: 0; border-left: 1px solid var(--border); padding-left: 14px; }
.top-title b { display: block; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.top-title span { display: block; font-size: 11.5px; color: var(--muted); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.navrail { display: none; }
@media (min-width: 1024px) {
  .navrail { display: block; border-bottom: 1px solid var(--border-2); background: color-mix(in oklch, var(--night-2) 60%, transparent); }
  .navrail-in { display: flex; gap: 6px; width: 100%; max-width: 1680px; margin-inline: auto; padding: 8px clamp(16px, 2vw, 32px); overflow-x: auto; }
}
.navlink {
  display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto;
  padding: 9px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.navlink svg { width: 18px; height: 18px; flex: 0 0 auto; }
.navlink:hover { background: color-mix(in oklch, var(--fg) 8%, transparent); color: var(--fg); }
.navlink.is-active { background: var(--gold-soft); color: var(--gold-ink); }

.screen { flex: 1 1 auto; width: 100%; max-width: 1680px; margin-inline: auto; padding: clamp(16px, 2vw, 30px) clamp(16px, 2vw, 32px) 110px; }
@media (min-width: 1024px) { .screen { padding-bottom: 40px; } }

/* navegação inferior (mobile) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; overflow-x: auto; overscroll-behavior-x: contain;
  background: color-mix(in oklch, var(--night) 94%, transparent);
  backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar { scrollbar-width: none; }
@media (min-width: 1024px) { .tabbar { display: none; } }
.tablink { flex: 1 1 0; min-width: 54px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border-radius: 12px; font-size: 10px; font-weight: 600; color: var(--muted); }
.tablink svg { width: 21px; height: 21px; }
.tablink.is-active { color: var(--gold-ink); background: var(--gold-soft); }
.tablink span { white-space: nowrap; }

/* ─── tipografia ─────────────────────────────────────────────────────────── */
.h-section { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-family: var(--font-mono); }
.h-card { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.h-xl { font-size: clamp(22px, 2.4vw, 34px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
.metric { font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }

/* ─── superfícies ────────────────────────────────────────────────────────── */
.card { background: var(--night); border: 1px solid var(--border-2); border-radius: var(--radius); }
.card-2 { background: var(--night-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm); }
.card-3 { background: var(--night-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm); }
.card-2.is-active { border-color: var(--gold); box-shadow: 0 0 0 1px color-mix(in oklch, var(--gold) 45%, transparent); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-2); }
.card-h h2, .card-h h3 { font-size: 15px; font-weight: 700; }
.card-h p { font-size: 11.5px; color: var(--muted); }
.card-b { padding: 18px; }
.card-h .mark { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; background: var(--gold-soft); color: var(--gold-ink); }
.card-h .mark svg { width: 18px; height: 18px; }

/* ─── chips / badges ─────────────────────────────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: var(--night-2); border: 1px solid var(--border-2); font-size: 12.5px; font-weight: 600; color: var(--fg); white-space: nowrap; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge svg { width: 13px; height: 13px; }
.badge-ok   { background: var(--ok-soft);   color: var(--ok-ink); }
.badge-warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge-bad  { background: var(--bad-soft);  color: var(--bad-ink); }
.badge-gold { background: var(--gold-soft); color: var(--gold-ink); }
.badge-mute { background: color-mix(in oklch, var(--fg) 8%, transparent); color: var(--muted); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in oklch, var(--ok) 60%, transparent); animation: pulse 2.4s ease-out infinite; }
.dot-warn { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 0 color-mix(in oklch, var(--warn) 60%, transparent); animation: pulse 2.4s ease-out infinite; }
.dot-bad { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 0 color-mix(in oklch, var(--bad) 60%, transparent); animation: pulse 2.4s ease-out infinite; }

/* credenciais / chaves */
.keyrow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-2); flex-wrap: wrap; }
.keyrow:last-child { border-bottom: 0; }
.keyrow .k { flex: 0 0 132px; font-size: 12px; color: var(--muted); }
.keyrow .v { flex: 1 1 auto; min-width: 0; font-family: var(--font-mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--ok) 55%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ─── botões ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid transparent; font-size: 14px; font-weight: 700; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .06s ease; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: 0 0 auto; }
.btn-primary { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn-primary:hover { background: color-mix(in oklch, var(--gold) 84%, black); border-color: color-mix(in oklch, var(--gold) 84%, black); }
.btn-soft { background: var(--night-3); color: var(--fg); border-color: var(--border); }
.btn-soft:hover { border-color: color-mix(in oklch, var(--fg) 32%, transparent); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--fg); background: color-mix(in oklch, var(--fg) 8%, transparent); }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-block { width: 100%; }
[data-tabs] .btn.is-active,
[data-tenant].is-active { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border-2); background: var(--night); color: var(--muted); transition: color .15s ease, border-color .15s ease; }
.icon-btn:hover { color: var(--fg); border-color: color-mix(in oklch, var(--fg) 28%, transparent); }
.icon-btn svg { width: 19px; height: 19px; }

/* ─── formulários ────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 11px 13px; border-radius: 12px;
  background: var(--night-2); border: 1px solid var(--border); color: var(--fg); font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, .textarea::placeholder { color: color-mix(in oklch, var(--muted) 80%, transparent); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.hint { font-size: 11.5px; color: var(--muted); }
.switch { position: relative; display: inline-flex; flex: 0 0 auto; width: 48px; height: 28px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--night-3); border: 1px solid var(--border); transition: background .18s ease; pointer-events: none; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--fg); transition: transform .18s ease; pointer-events: none; }
.switch input:checked ~ .track { background: var(--ok); border-color: var(--ok); }
.switch input:checked ~ .knob { transform: translateX(20px); background: var(--ink); }
.switch input:focus-visible ~ .track { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ─── barra de progresso ─────────────────────────────────────────────────── */
.bar { height: 8px; border-radius: 999px; background: color-mix(in oklch, var(--fg) 10%, transparent); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--gold); transition: width .6s cubic-bezier(.22,.61,.36,1); }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }

/* ─── velocímetro neon ───────────────────────────────────────────────────── */
.gauge { position: relative; width: 100%; max-width: 420px; margin-inline: auto; }
.gauge svg { width: 100%; height: auto; overflow: visible; }
.g-track { fill: none; stroke: color-mix(in oklch, var(--fg) 9%, transparent); stroke-width: 16; stroke-linecap: round; }
.g-val { fill: none; stroke: var(--ok); stroke-width: 16; stroke-linecap: round; transition: stroke-dasharray .9s cubic-bezier(.22,.61,.36,1), stroke .3s ease; }
.g-tick { stroke: color-mix(in oklch, var(--fg) 26%, transparent); stroke-width: 2; }
.g-tick.major { stroke: color-mix(in oklch, var(--fg) 48%, transparent); stroke-width: 3; }
.g-goal { stroke: var(--gold); stroke-width: 3; }
.g-needle { stroke: var(--fg); stroke-width: 4; stroke-linecap: round; transition: transform .9s cubic-bezier(.34,1.2,.4,1); }
.g-hub { fill: var(--night); stroke: var(--fg); stroke-width: 3; }
.gauge.is-ok   .g-val { stroke: var(--ok);   filter: drop-shadow(0 0 10px color-mix(in oklch, var(--ok) 60%, transparent)); }
.gauge.is-warn .g-val { stroke: var(--warn); filter: drop-shadow(0 0 10px color-mix(in oklch, var(--warn) 60%, transparent)); }
.gauge.is-bad  .g-val { stroke: var(--bad);  filter: drop-shadow(0 0 10px color-mix(in oklch, var(--bad) 60%, transparent)); }
.g-avg { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; opacity: .5; }
.g-cap-dot { fill: var(--fg); animation: breathe 2.8s ease-in-out infinite; }
.gauge.is-ok   .g-cap-dot { fill: var(--ok); }
.gauge.is-warn .g-cap-dot { fill: var(--warn); }
.gauge.is-bad  .g-cap-dot { fill: var(--bad); }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.g-center { position: absolute; left: 0; right: 0; top: 52%; text-align: center; pointer-events: none; }
.g-center .g-val-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: clamp(40px, 5.2vw, 68px); font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.g-center .g-val-num small { font-size: 0.42em; color: var(--muted); }
.g-center .g-cap { display: block; margin-top: 6px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-family: var(--font-mono); }
.g-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin-top: 14px; }
.g-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.g-legend i { width: 9px; height: 9px; border-radius: 50%; }

/* ─── gráficos ───────────────────────────────────────────────────────────── */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .axis { stroke: var(--border-2); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.chart .series-area { fill: color-mix(in oklch, var(--gold) 16%, transparent); }
.chart .series-line { fill: none; stroke: var(--gold); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-line-2 { fill: none; stroke: var(--ok); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart .bar-in { fill: var(--ok); }
.chart .bar-warn { fill: var(--warn); }
.chart .bar-out { fill: var(--bad); }
.chart .bar-gold { fill: var(--gold); }
.chart .bar-mute { fill: color-mix(in oklch, var(--muted) 45%, transparent); }
.mesh-node { transition: r .2s ease; }
.mesh-new { animation: meshPulse 1.5s ease-out 3; }
@keyframes meshPulse { 0%, 100% { r: 6.5; } 50% { r: 11; } }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.legend i { width: 11px; height: 11px; border-radius: 3px; }

/* ─── lousa ──────────────────────────────────────────────────────────────── */
.board {
  border-radius: var(--radius);
  background:
    linear-gradient(0deg, color-mix(in oklch, white 2.5%, transparent), color-mix(in oklch, white 2.5%, transparent)),
    var(--board);
  border: 1px solid color-mix(in oklch, var(--fg) 12%, transparent);
  box-shadow: inset 0 0 0 10px var(--board-frame), inset 0 0 0 11px color-mix(in oklch, var(--gold) 22%, transparent), var(--shadow);
}
.board-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px dashed color-mix(in oklch, var(--fg) 14%, transparent); }
.acc { border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--night); overflow: hidden; }
.acc + .acc { margin-top: 10px; }
.acc-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: transparent; border: 0; color: var(--fg); text-align: left; }
.acc-btn .mark { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: var(--gold-soft); color: var(--gold-ink); }
.acc-btn .mark svg { width: 17px; height: 17px; }
.acc-btn .acc-txt b { display: block; font-size: 14px; font-weight: 700; }
.acc-btn .acc-txt > span { display: block; font-size: 11.5px; color: var(--muted); }
.acc-btn .chev { margin-left: auto; color: var(--muted); transition: transform .2s ease; }
.acc.is-open .acc-btn .chev { transform: rotate(180deg); }
.acc-body { display: none; padding: 0 16px 16px; }
.acc.is-open .acc-body { display: block; }

/* ─── feed ───────────────────────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border-2); }
.feed-item:last-child { border-bottom: 0; }
.feed-mark { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 11px; display: grid; place-items: center; background: var(--night-3); color: var(--muted); }
.feed-mark svg { width: 17px; height: 17px; }
.feed-item b { font-size: 13px; font-weight: 600; }
.feed-item p { font-size: 12.5px; color: var(--muted); }
.feed-time { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ─── chat ───────────────────────────────────────────────────────────────── */
.thread { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.msg { max-width: 82%; padding: 11px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.6; }
.msg.sofia { align-self: flex-start; background: var(--night-3); border: 1px solid var(--border-2); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--gold); color: var(--ink); border-bottom-right-radius: 6px; font-weight: 500; }
.msg .who { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.msg.me .who { color: color-mix(in oklch, var(--ink) 62%, transparent); }
.msg.sys { align-self: center; background: var(--night-2); color: var(--muted); font-size: 11.5px; border-radius: 999px; padding: 6px 14px; }
.step-rail { display: flex; gap: 6px; }
.step-rail i { flex: 1 1 0; height: 5px; border-radius: 999px; background: color-mix(in oklch, var(--fg) 12%, transparent); }
.step-rail i.done { background: var(--gold); }
.step-rail i.now { background: var(--gold); box-shadow: 0 0 10px color-mix(in oklch, var(--gold) 55%, transparent); }
.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border-2); }

/* ─── toast ──────────────────────────────────────────────────────────────── */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 36px)); }
@media (max-width: 1023px) { .toast-wrap { top: 76px; bottom: auto; } }
.toast { display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border-radius: 14px; background: var(--night); border: 1px solid var(--border); box-shadow: var(--shadow); animation: toast-in .22s ease; }
.toast .t-mark { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 11px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-ink); }
.toast .t-mark svg { width: 17px; height: 17px; }
.toast.ok .t-mark { background: var(--ok-soft); color: var(--ok-ink); }
.toast.warn .t-mark { background: var(--warn-soft); color: var(--warn-ink); }
.toast.bad .t-mark { background: var(--bad-soft); color: var(--bad-ink); }
.toast b { display: block; font-size: 13px; font-weight: 700; }
.toast p { font-size: 12.5px; color: var(--muted); }
.toast .t-close { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.toast .t-close:hover { background: color-mix(in oklch, var(--fg) 10%, transparent); color: var(--fg); }
.toast .t-close svg { width: 15px; height: 15px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ─── modal / gaveta ─────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 80; background: color-mix(in oklch, black 58%, transparent); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 20px; }
.scrim.is-open { display: flex; }
.modal { width: min(520px, 100%); max-height: 88vh; overflow-y: auto; background: var(--night); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border-2); }
.modal-b { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 0 18px 18px; }

/* ─── áudio · text-to-speech (SOFIA.tts) ─────────────────────────────────── */
.tts-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 7px 13px; border-radius: 999px;
  background: var(--night-3); color: var(--fg); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; letter-spacing: -0.005em;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.tts-btn:hover { border-color: color-mix(in oklch, var(--gold) 55%, transparent); color: var(--gold-ink); }
.tts-btn .tts-ico { width: 16px; height: 16px; flex: 0 0 auto; }
.tts-btn.is-loading { color: var(--muted); }
.tts-btn.is-loading .tts-ico { animation: tts-spin 1s linear infinite; }
.tts-btn.is-playing { background: var(--gold-soft); border-color: color-mix(in oklch, var(--gold) 60%, transparent); color: var(--gold-ink); }
.tts-btn.is-playing .tts-ico { animation: tts-breathe 1.4s ease-in-out infinite; }
.tts-btn.is-paused { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 45%, transparent); color: var(--warn-ink); }
.tts-btn--icon { padding: 6px; min-height: 32px; min-width: 32px; }
.tts-btn--icon .tts-txt { display: none; }
@keyframes tts-spin { to { transform: rotate(360deg); } }
@keyframes tts-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* botão compacto dentro das mensagens do debrief */
.msg .tts-btn { margin-top: 8px; min-height: 28px; padding: 4px 10px; font-size: 11.5px; }
.msg.me .tts-btn { display: none; }

/* mini-player fixo */
#tts-player {
  position: fixed; left: 18px; bottom: 18px; z-index: 85;
  width: min(540px, calc(100vw - 36px));
  display: flex; align-items: center; gap: 11px; overflow: hidden;
  padding: 10px 12px; border-radius: 16px;
  background: color-mix(in oklch, var(--night) 96%, transparent);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: tts-in .22s ease;
}
#tts-player[hidden] { display: none; }
@keyframes tts-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.tts-player__progress { position: absolute; top: 0; left: 0; height: 3px; width: 0; background: var(--gold); border-radius: 0 3px 3px 0; transition: width .35s linear; }
.tts-player__brand { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 11px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-ink); }
.tts-player__brand svg { width: 17px; height: 17px; }
.tts-player.is-playing .tts-player__brand svg { animation: tts-breathe 1.4s ease-in-out infinite; }
.tts-player__meta { flex: 1 1 auto; min-width: 0; }
.tts-player__title { display: block; font-size: 13px; font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tts-player__status { display: block; font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.tts-player__time { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.tts-player__btn { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--border); background: var(--night-3); color: var(--fg); transition: border-color .15s ease, color .15s ease, background .15s ease; }
.tts-player__btn:hover { border-color: color-mix(in oklch, var(--gold) 55%, transparent); color: var(--gold-ink); }
.tts-player__btn svg { width: 16px; height: 16px; }
.tts-player__toggle { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.tts-player__toggle:hover { background: color-mix(in oklch, var(--gold) 84%, black); color: var(--ink); border-color: color-mix(in oklch, var(--gold) 84%, black); }
.tts-player__rate { width: 44px; height: 36px; flex: 0 0 auto; border-radius: 11px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.tts-player__rate:hover { color: var(--fg); border-color: color-mix(in oklch, var(--fg) 28%, transparent); }
@media (max-width: 1023px) {
  #tts-player { left: 12px; right: 12px; width: auto; bottom: calc(72px + env(safe-area-inset-bottom)); }
  .tts-player__time, .tts-player__rate { display: none; }
}

/* ─── prévia no WhatsApp · entrega combinada (texto + áudio) ─────────────── */
.wa { background: var(--night); border: 1px solid var(--border-2); border-radius: var(--radius); overflow: hidden; }
.wa-head { display: flex; align-items: center; gap: 11px; padding: 11px 14px; background: color-mix(in oklch, var(--night-3) 65%, transparent); border-bottom: 1px solid var(--border-2); }
.wa-avatar { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 999px; display: grid; place-items: center; background: var(--gold); color: var(--ink); font-weight: 800; font-size: 13px; }
.wa-head b { display: block; font-size: 13.5px; }
.wa-head > div > span { display: block; font-size: 11.5px; color: var(--muted); }
.wa-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; background: color-mix(in oklch, var(--ink) 60%, transparent); }
.wa-day { align-self: center; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--night-2); padding: 4px 10px; border-radius: 999px; }
.wa-msg { max-width: 90%; padding: 9px 12px 7px; border-radius: 14px; font-size: 13px; line-height: 1.55; }
.wa-msg.in { align-self: flex-start; background: var(--night-3); border-bottom-left-radius: 5px; }
.wa-msg.out { align-self: flex-end; background: var(--gold-soft); border: 1px solid color-mix(in oklch, var(--gold) 32%, transparent); border-bottom-right-radius: 5px; }
.wa-msg p { margin: 0; }
.wa-time { display: block; text-align: right; font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 5px; }
.wa-time svg { display: inline-block; vertical-align: -2px; margin-left: 4px; width: 11px; height: 11px; color: var(--gold-ink); }
.wa-audio { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid color-mix(in oklch, var(--fg) 10%, transparent); }
.wa-play { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 999px; display: grid; place-items: center; border: 0; background: var(--gold); color: var(--ink); transition: background .15s ease; }
.wa-play:hover { background: color-mix(in oklch, var(--gold) 84%, black); }
.wa-play svg { width: 16px; height: 16px; }
.wa-wave { flex: 1 1 auto; display: flex; align-items: center; gap: 2px; height: 24px; min-width: 60px; }
.wa-wave i { flex: 1 1 0; min-width: 2px; border-radius: 2px; background: color-mix(in oklch, var(--fg) 32%, transparent); height: 30%; transition: background .12s ease; }
.wa-wave i.on { background: var(--gold); }
.wa-dur { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: 0 0 auto; min-width: 34px; text-align: right; }
.wa-src { display: none; }
.wa-rule { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.wa-rule svg { width: 15px; height: 15px; color: var(--gold-ink); flex: 0 0 auto; }

/* ─── PWA ────────────────────────────────────────────────────────────────── */
.pwa { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--night-2); border: 1px solid var(--border-2); }
.pwa img { width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto; }

/* ─── TV / telas grandes ─────────────────────────────────────────────────── */
@media (min-width: 1600px) { html { font-size: 16.5px; } }
@media (min-width: 1900px) { html { font-size: 18.5px; } .screen { padding-inline: 4vw; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* utilidades de grid usadas pelos cards */
.grid-fill { display: grid; gap: 16px; }
