/* ExitoTalk 2.0 — sistema visual compartilhado (rádio, painel da empresa, master)
   Temas: marinho (padrão), claro, tatico, industrial, campo, noturno. "auto" segue o aparelho. */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Barlow+Semi+Condensed:wght@500;600;700&family=Share+Tech+Mono&display=swap');

:root, :root[data-theme="marinho"] {
  --bg: #0A1220; --bg2: #0E1829; --body: #131F33; --body2: #0F1A2B;
  --surface: #16233A; --surface2: #1B2A45; --line: #24375A; --line2: #2F4672;
  --text: #E6EEF8; --muted: #93A6C2; --faint: #61759A;
  --accent: #2F80ED; --accent2: #6FD0FF; --accent-ink: #FFFFFF;
  --ok: #2BD46F; --warn: #FFB020; --bad: #FF4D5E; --rx: #FFB020; --tx: #FF3B4E;
  --lcd-bg: #0B2230; --lcd-bg2: #071722; --lcd-ink: #8FE3FF; --lcd-dim: rgba(143,227,255,.22); --lcd-glow: rgba(111,208,255,.35);
  --ptt: #1C2C47; --ptt2: #0F1A2B; --ptt-ink: #DCE8F8; --ptt-ring: #2F80ED;
  --grill: rgba(255,255,255,.05);
  --shadow: 0 18px 40px rgba(0,0,0,.45);
  --logo-plate: #F2F6FB;
  color-scheme: dark;
}
:root[data-theme="claro"] {
  --bg: #EEF2F7; --bg2: #E4EAF2; --body: #FFFFFF; --body2: #F4F7FB;
  --surface: #FFFFFF; --surface2: #F3F6FA; --line: #D6DFEA; --line2: #C3CFDE;
  --text: #0E1B2E; --muted: #52637C; --faint: #8090A8;
  --accent: #1F6FEB; --accent2: #0B8BD3; --accent-ink: #FFFFFF;
  --ok: #12A150; --warn: #C27C00; --bad: #D92D3F; --rx: #D98A00; --tx: #E0283C;
  --lcd-bg: #C9D8C2; --lcd-bg2: #B5C7AC; --lcd-ink: #1B2A17; --lcd-dim: rgba(27,42,23,.16); --lcd-glow: transparent;
  --ptt: #FFFFFF; --ptt2: #E6ECF4; --ptt-ink: #0E1B2E; --ptt-ring: #1F6FEB;
  --grill: rgba(14,27,46,.06);
  --shadow: 0 14px 30px rgba(20,40,70,.14);
  --logo-plate: transparent;
  color-scheme: light;
}
/* Tático: corpo preto fosco, visor âmbar, detalhes laranja (inspirado em rádios de segurança pública) */
:root[data-theme="tatico"] {
  --bg: #0C0D0F; --bg2: #121316; --body: #17191C; --body2: #101113;
  --surface: #1C1E22; --surface2: #23262B; --line: #2E3137; --line2: #3A3E45;
  --text: #ECEDEF; --muted: #A2A6AE; --faint: #6D727B;
  --accent: #FF7A1A; --accent2: #FFB066; --accent-ink: #1A0D02;
  --ok: #3DDC84; --warn: #FFB020; --bad: #FF4D4D; --rx: #FFB020; --tx: #FF3B30;
  --lcd-bg: #2A1A06; --lcd-bg2: #1A1003; --lcd-ink: #FFB547; --lcd-dim: rgba(255,181,71,.18); --lcd-glow: rgba(255,160,40,.35);
  --ptt: #24272C; --ptt2: #121417; --ptt-ink: #F2F2F2; --ptt-ring: #FF7A1A;
  --grill: rgba(255,255,255,.045);
  --shadow: 0 18px 40px rgba(0,0,0,.6);
  --logo-plate: #F2F2F2;
  color-scheme: dark;
}
/* Industrial: grafite com verde, visor verde monocromático (inspirado em rádios profissionais nacionais) */
:root[data-theme="industrial"] {
  --bg: #111513; --bg2: #161B18; --body: #1C2320; --body2: #141916;
  --surface: #1F2724; --surface2: #26302C; --line: #33403A; --line2: #415048;
  --text: #E8F0EA; --muted: #9DB0A4; --faint: #6A7E71;
  --accent: #16B55A; --accent2: #6EE59B; --accent-ink: #04150A;
  --ok: #3BE07A; --warn: #F5B82E; --bad: #FF5A5A; --rx: #F5B82E; --tx: #FF4040;
  --lcd-bg: #0C2414; --lcd-bg2: #06170C; --lcd-ink: #7CFFA8; --lcd-dim: rgba(124,255,168,.18); --lcd-glow: rgba(80,255,140,.3);
  --ptt: #26302C; --ptt2: #141916; --ptt-ink: #E8F0EA; --ptt-ring: #16B55A;
  --grill: rgba(255,255,255,.045);
  --shadow: 0 18px 40px rgba(0,0,0,.55);
  --logo-plate: #EEF3EF;
  color-scheme: dark;
}
/* Campo: verde-oliva com visor azul (inspirado em rádios portáteis de campo) */
:root[data-theme="campo"] {
  --bg: #15170F; --bg2: #1B1E14; --body: #23271A; --body2: #191C12;
  --surface: #262A1D; --surface2: #2E3324; --line: #3C4230; --line2: #4B523C;
  --text: #EEF0E4; --muted: #ADB298; --faint: #7A8066;
  --accent: #9DB33A; --accent2: #C9DB72; --accent-ink: #141705;
  --ok: #7BE36B; --warn: #F2B93B; --bad: #FF5C4D; --rx: #F2B93B; --tx: #FF4A3D;
  --lcd-bg: #0A2140; --lcd-bg2: #06152B; --lcd-ink: #9CCBFF; --lcd-dim: rgba(156,203,255,.2); --lcd-glow: rgba(100,170,255,.35);
  --ptt: #2E3324; --ptt2: #191C12; --ptt-ink: #EEF0E4; --ptt-ring: #9DB33A;
  --grill: rgba(255,255,255,.045);
  --shadow: 0 18px 40px rgba(0,0,0,.55);
  --logo-plate: #F0F1E8;
  color-scheme: dark;
}
/* Noturno: preto absoluto e vermelho, preserva a visão no escuro (rondas noturnas) */
:root[data-theme="noturno"] {
  --bg: #000000; --bg2: #050101; --body: #0A0303; --body2: #050101;
  --surface: #0D0404; --surface2: #140606; --line: #2A0D0D; --line2: #3A1212;
  --text: #FF8A80; --muted: #C2574F; --faint: #7E2E29;
  --accent: #E0352B; --accent2: #FF6B5E; --accent-ink: #000000;
  --ok: #FF6B5E; --warn: #FF8A3D; --bad: #FF3B30; --rx: #FF8A3D; --tx: #FF2A1F;
  --lcd-bg: #140303; --lcd-bg2: #0A0101; --lcd-ink: #FF5A4E; --lcd-dim: rgba(255,90,78,.15); --lcd-glow: rgba(255,60,40,.3);
  --ptt: #160505; --ptt2: #080101; --ptt-ink: #FF8A80; --ptt-ring: #E0352B;
  --grill: rgba(255,80,60,.05);
  --shadow: 0 18px 40px rgba(0,0,0,.8);
  --logo-plate: #3A1212;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #EEF2F7; --bg2: #E4EAF2; --body: #FFFFFF; --body2: #F4F7FB;
    --surface: #FFFFFF; --surface2: #F3F6FA; --line: #D6DFEA; --line2: #C3CFDE;
    --text: #0E1B2E; --muted: #52637C; --faint: #8090A8;
    --accent: #1F6FEB; --accent2: #0B8BD3; --accent-ink: #FFFFFF;
    --ok: #12A150; --warn: #C27C00; --bad: #D92D3F; --rx: #D98A00; --tx: #E0283C;
    --lcd-bg: #C9D8C2; --lcd-bg2: #B5C7AC; --lcd-ink: #1B2A17; --lcd-dim: rgba(27,42,23,.16); --lcd-glow: transparent;
    --ptt: #FFFFFF; --ptt2: #E6ECF4; --ptt-ink: #0E1B2E; --ptt-ring: #1F6FEB;
    --grill: rgba(14,27,46,.06);
    --shadow: 0 14px 30px rgba(20,40,70,.14);
    --logo-plate: transparent;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 500 15px/1.5 Barlow, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: "Barlow Semi Condensed", Barlow, system-ui, sans-serif; font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
a { color: var(--accent2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: "Share Tech Mono", ui-monospace, monospace; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

/* ---------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--surface2); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line2)); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface2); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 10px; }

/* ---------- formulários */
.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field > span em { font-style: normal; color: var(--faint); font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--line2); color: var(--text); outline: none;
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input.err { border-color: var(--bad); }
.field .hint { display: block; font-size: 12.5px; color: var(--faint); margin-top: 4px; }
.field .msg { display: block; font-size: 12.5px; color: var(--bad); margin-top: 4px; min-height: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-wrap button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 36px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px; }
.alert { padding: 11px 13px; border-radius: 10px; font-size: 14px; border: 1px solid; }
.alert.error { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--text); }
.alert.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.alert.info { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.alert.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

/* ---------- etiquetas */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.tag.acc { color: var(--accent2); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.talk { background: var(--tx); box-shadow: 0 0 8px var(--tx); }

/* ---------- avatar */
.av { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; background: var(--surface2); border: 1px solid var(--line2); display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--muted); overflow: hidden; }
.av.lg { width: 72px; height: 72px; font-size: 26px; }
.av.xl { width: 112px; height: 112px; font-size: 40px; }

/* ---------- tabelas */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 10px 12px; background: var(--surface2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface2) 55%, transparent); }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- modal e aviso */
.modal-bg { position: fixed; inset: 0; background: rgba(3,8,16,.62); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(3px); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); }
.modal.wide { width: min(860px, 100%); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal header h2 { flex: 1; font-size: 19px; }
.modal .mb { padding: 18px; }
.modal footer { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--line2); box-shadow: var(--shadow); font-weight: 600; animation: toastIn .18s ease-out; }
.toast.error { border-color: var(--bad); }
.toast.ok { border-color: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.fsec { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.fsec + .fsec { margin-top: 14px; }
.fsec > h3 { font-size: 15px; margin-bottom: 12px; color: var(--muted); }

/* ---------- marca */
.brand-plate { display: inline-flex; align-items: center; background: var(--logo-plate); border-radius: 10px; padding: 6px 10px; }
.brand-plate img { display: block; height: 28px; width: auto; }

/* ---------- painel (empresa / master) */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--body2); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .who { padding: 10px 8px 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side .who b { display: block; font-size: 15px; line-height: 1.25; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; text-align: left; }
.nav-btn svg { width: 18px; height: 18px; flex: none; }
.nav-btn:hover { background: var(--surface); color: var(--text); }
.nav-btn.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.side .foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.main { padding: 24px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { flex: 1; min-width: 200px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.panel > h2 { font-size: 17px; margin-bottom: 12px; }
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi b { display: block; font: 700 28px/1.1 "Barlow Semi Condensed", Barlow, sans-serif; }
.kpi span { color: var(--muted); font-size: 13px; }
.meter { height: 6px; border-radius: 99px; background: var(--bg2); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter i.full { background: var(--warn); }
.topbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: 270px; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--body2); position: sticky; top: 0; z-index: 30; }
  .main { padding: 16px 16px 60px; }
}
.search { max-width: 320px; }

/* ---------- tela de entrada (painéis) */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line2); border-radius: 18px; padding: 26px 24px; box-shadow: var(--shadow); }
.auth-card .brand-plate img { height: 40px; }
.auth-card h1 { margin: 18px 0 4px; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 13px; color: var(--faint); }

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