/* Secretária IA — tokens e componentes compartilhados (painel, login, simulador) */
:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #f2f5f6;
  --surface-3: #e9eef0;
  --border: #e2e8eb;
  --border-strong: #cdd6db;
  --text: #0f1b24;
  --text-2: #475763;
  --text-3: #6b7a86;
  --primary: #0f766e;
  --primary-hover: #0b5f58;
  --primary-soft: #e3f3f0;
  --primary-soft-2: #c9e9e3;
  --on-primary: #ffffff;
  --success: #067647; --success-soft: #e7f8ee;
  --warning: #a64b06; --warning-soft: #fff4e0;
  --danger: #b42318; --danger-soft: #fdecea;
  --info: #1d5bb8; --info-soft: #eaf2fd;
  --chart: #0d9488;
  --focus: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent);
  --shadow-sm: 0 1px 2px rgb(15 27 36 / .05);
  --shadow-md: 0 2px 4px rgb(15 27 36 / .04), 0 6px 16px rgb(15 27 36 / .07);
  --shadow-lg: 0 12px 40px rgb(15 27 36 / .18);
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1116; --surface: #111a21; --surface-2: #16212a; --surface-3: #1c2934;
    --border: #22303b; --border-strong: #2f3f4c;
    --text: #e8eef2; --text-2: #a9b7c2; --text-3: #8293a0;
    --primary: #2cc5b2; --primary-hover: #4fd6c5; --primary-soft: #12302d; --primary-soft-2: #174540; --on-primary: #04201d;
    --success: #4fd08b; --success-soft: #0d2c1d; --warning: #f6b35a; --warning-soft: #33230c;
    --danger: #ff8a7a; --danger-soft: #3a1612; --info: #79aef7; --info-soft: #102742;
    --chart: #0d9488;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .3); --shadow-md: 0 4px 16px rgb(0 0 0 / .35); --shadow-lg: 0 16px 48px rgb(0 0 0 / .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1116; --surface: #111a21; --surface-2: #16212a; --surface-3: #1c2934;
  --border: #22303b; --border-strong: #2f3f4c;
  --text: #e8eef2; --text-2: #a9b7c2; --text-3: #8293a0;
  --primary: #2cc5b2; --primary-hover: #4fd6c5; --primary-soft: #12302d; --primary-soft-2: #174540; --on-primary: #04201d;
  --success: #4fd08b; --success-soft: #0d2c1d; --warning: #f6b35a; --warning-soft: #33230c;
  --danger: #ff8a7a; --danger-soft: #3a1612; --info: #79aef7; --info-soft: #102742;
  --chart: #0d9488;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .3); --shadow-md: 0 4px 16px rgb(0 0 0 / .35); --shadow-lg: 0 16px 48px rgb(0 0 0 / .55);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12.5px/1.4 ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.icone { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icone.sm { width: 16px; height: 16px; }
.icone.lg { width: 22px; height: 22px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mudo { color: var(--text-3); }
.sub { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 500 14px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:hover { text-decoration: none; }
.btn-primario { background: var(--primary); color: var(--on-primary); }
.btn-primario:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secundario { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secundario:hover:not(:disabled) { background: var(--surface-2); }
.btn-fantasma { background: transparent; color: var(--text-2); }
.btn-fantasma:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-perigo { background: var(--danger); color: #fff; }
.btn-perigo:hover:not(:disabled) { filter: brightness(.92); }
.btn-perigo-suave { background: transparent; color: var(--danger); }
.btn-perigo-suave:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icone { width: 36px; padding: 0; }
.btn-icone.btn-sm { width: 30px; }
.btn-bloco { width: 100%; }

/* ---------- Campos ---------- */
.campo { display: grid; gap: 6px; min-width: 0; }
.campo > span, .rotulo { font-size: 13px; font-weight: 500; color: var(--text-2); }
.campo small, .dica { font-size: 12.5px; color: var(--text-3); }
.entrada, .campo input:not([type=checkbox]):not([type=radio]), .campo select, .campo textarea, select.entrada {
  width: 100%; min-width: 0; height: 38px; padding: 0 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 14px/1.4 var(--font); transition: border-color .12s, box-shadow .12s;
}
.campo textarea, textarea.entrada { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.entrada:focus, .campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.entrada::placeholder, .campo input::placeholder, .campo textarea::placeholder { color: var(--text-3); }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.campos .largo { grid-column: 1 / -1; }

/* Interruptor (checkbox) */
.interruptor { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.interruptor input { appearance: none; width: 36px; height: 20px; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.interruptor input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.interruptor input:checked { background: var(--primary); }
.interruptor input:checked::after { transform: translateX(16px); }
.interruptor input:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- Cartões, selos, avisos ---------- */
.cartao { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.cartao-corpo { padding: 18px 20px; }
.cartao-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.cartao-topo h2 { font-size: 15.5px; font-weight: 600; }
.cartao-topo p { font-size: 13px; color: var(--text-2); margin-top: 3px; }

.selo { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.selo::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.selo.sem-ponto::before { display: none; }
.selo.primario { background: var(--primary-soft); color: var(--primary); }
.selo.sucesso { background: var(--success-soft); color: var(--success); }
.selo.aviso { background: var(--warning-soft); color: var(--warning); }
.selo.perigo { background: var(--danger-soft); color: var(--danger); }
.selo.info { background: var(--info-soft); color: var(--info); }

.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: 13.5px; border: 1px solid transparent; }
.aviso .icone { margin-top: 1px; }
.aviso.atencao { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 20%, transparent); }
.aviso.perigo { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.aviso.sucesso { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 20%, transparent); }
.aviso.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 20%, transparent); }
.aviso b { font-weight: 600; }

/* ---------- Estado vazio ---------- */
.vazio { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 40px 20px; color: var(--text-2); }
.vazio .bolha-icone { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); margin-bottom: 4px; }
.vazio h3 { font-size: 15px; color: var(--text); font-weight: 600; }
.vazio p { font-size: 13.5px; max-width: 340px; }

/* ---------- Tabelas ---------- */
.tabela-rolagem { overflow-x: auto; }
table.tabela { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabela th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tabela td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover td { background: var(--surface-2); }
.tabela .num { text-align: right; }

/* ---------- Diálogo ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
dialog.modal::backdrop { background: rgb(8 15 20 / .5); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: surgir .16s ease-out; }
.modal-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 4px; }
.modal-topo h2 { font-size: 17px; font-weight: 600; }
.modal-topo p { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }
.modal-corpo { padding: 12px 20px; display: grid; gap: 14px; overflow-y: auto; }
.modal-rodape { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--border); margin-top: 6px; }
@keyframes surgir { from { opacity: 0; transform: translateY(6px) scale(.985); } }

/* ---------- Avisos rápidos (toast) ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: surgir .18s ease-out; }
.toast.erro { background: var(--danger); color: #fff; }
.toast .icone { margin-top: 1px; }

/* ---------- Controle segmentado ---------- */
.segmentado { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; max-width: 100%; }
.segmentado button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap; }
.segmentado button:hover { color: var(--text); }
.segmentado button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmentado button:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- Avatar ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 600; font-size: 13.5px; background: var(--primary-soft); color: var(--primary); }
.avatar.sm { width: 32px; height: 32px; font-size: 12.5px; }

/* ---------- Esqueleto de carregamento ---------- */
.esqueleto { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: brilho 1.2s infinite linear; border-radius: 8px; }
@keyframes brilho { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
