@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap');

/* ==========================================================================
   ZapiZone — design system alinhado ao SGI (zapiapp.com.br/sgi)
   Tokens e componentes extraidos do SGI em 28/07/2026.
   ========================================================================== */

:root {
  /* Cores base do SGI */
  --color-primary:        #0F3BCC;
  --color-primary-hover:  #0a2da0;
  --color-sidebar:        #0a1f72;
  --color-sidebar-text:   #a8baef;
  --color-sidebar-active: #0F3BCC;
  --color-topbar:         #ffffff;
  --color-accent:         #1BDE60;
  --color-tagline:        #FF7A1A;

  /* Superficies e texto */
  --surface:        #ffffff;
  --surface-bg:     #f9fafb;
  --surface-muted:  #f3f4f6;
  --border:         #e5e7eb;
  --border-soft:    #f3f4f6;
  --text:           #111827;
  --text-soft:      #374151;
  --text-muted:     #6b7280;
  --text-faint:     #9ca3af;

  /* Semanticas */
  --danger:      #dc2626;
  --danger-bg:   #fef2f2;
  --danger-br:   #fecaca;
  --success:     #059669;
  --success-bg:  #ecfdf5;
  --success-br:  #a7f3d0;
  --warning:     #b45309;
  --warning-bg:  #fffbeb;
  --warning-br:  #fde68a;
  --info:        #1d4ed8;
  --info-bg:     #eff6ff;
  --info-br:     #bfdbfe;

  /* Tipografia e espaco (escala do SGI) */
  --font-family:     'Bai Jamjuree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:       'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-6: 24px; --space-8: 32px; --space-12: 48px;
  --text-heading:    1.25rem;
  --text-subheading: 1rem;
  --text-body:       .875rem;
  --text-caption:    .75rem;
  --touch-target:    44px;

  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.08);
  --shadow-lg: 0 20px 60px rgba(10,31,114,.28);

  --sidebar-w: 240px;
  --topbar-h:  56px;
}

/* Dark mode — mesma paleta, superficies navy */
html.dark {
  --color-sidebar:      #060d24;
  --color-sidebar-text: #7f95cc;
  --surface:       #101a33;
  --surface-bg:    #070d1c;
  --surface-muted: #16233f;
  --border:        #1e2f57;
  --border-soft:   #182643;
  --text:          #e2e9f8;
  --text-soft:     #c3d0e9;
  --text-muted:    #8397bd;
  --text-faint:    #5f739b;

  --danger-bg:  #2a1114; --danger-br:  #7f1d1d; --danger:  #fca5a5;
  --success-bg: #06231a; --success-br: #115e46; --success: #6ee7b7;
  --warning-bg: #241a06; --warning-br: #78500a; --warning: #fcd34d;
  --info-bg:    #0b1a3d; --info-br:    #1e3a8a; --info:    #93b4ff;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 1px 3px rgba(0,0,0,.5);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.6);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-family: var(--font-family);
  font-size: var(--text-body);
  background: var(--surface-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

a { color: inherit; text-decoration: none; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; z-index: 100;
  width: var(--sidebar-w); height: 100vh;
  background: var(--color-sidebar);
  display: flex; flex-direction: column;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  height: 64px; padding: 0 var(--space-4); flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo img,
.sidebar-logo-img {
  width: 40px; height: 40px; border-radius: 6px;
  object-fit: contain; flex-shrink: 0;
}
.sidebar-logo-text {
  min-width: 0;
  color: #fff; font-size: var(--text-body); font-weight: 900;
  line-height: 1.15; letter-spacing: .08em; text-transform: uppercase;
}
.sidebar-logo-text small {
  display: block;
  color: var(--color-tagline);
  font-size: 9px; font-weight: 400; font-style: italic;
  letter-spacing: 0; text-transform: none; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: var(--space-2);
  display: flex; flex-direction: column; gap: 2px;
}

.nav-label {
  color: rgba(255,255,255,.4);
  font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: var(--space-3) var(--space-3) var(--space-1);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: var(--touch-target);
  padding: 10px var(--space-3);
  border: none; background: none; text-align: left;
  border-radius: var(--radius);
  color: rgba(255,255,255,.6);
  font-family: inherit; font-size: 13px; font-weight: 400;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active {
  background: var(--color-sidebar-active);
  color: #fff; font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.nav-item.danger:hover { background: rgba(220,38,38,.22); color: #fecaca; }

.nav-divider { border-top: 1px solid rgba(255,255,255,.1); margin: var(--space-2) var(--space-1); }

/* Contadores dentro da sidebar acompanham o fundo navy */
.nav-item .badge {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.18);
  color: rgba(255,255,255,.75);
}
.nav-item.active .badge {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.28);
  color: #fff;
}

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,.1);
  padding: var(--space-2) var(--space-3) var(--space-3);
  color: rgba(255,255,255,.35);
  font-size: 11px; text-align: center;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; right: 0; left: var(--sidebar-w); z-index: 90;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar-spacer { flex: 1; }

.topbar-search {
  display: flex; align-items: center; gap: var(--space-2);
  min-width: 0; width: 260px; max-width: 100%;
  padding: 0 var(--space-3);
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  transition: background .2s;
}
.topbar-search:hover,
.topbar-search:focus-within { background: var(--border); }
.topbar-search svg { color: var(--text-faint); flex-shrink: 0; }
.topbar-search input {
  flex: 1; min-width: 0;
  padding: var(--space-2) 0;
  min-height: 0;
  border: none; outline: none; background: transparent; box-shadow: none;
  font-family: inherit; font-size: var(--text-body); color: var(--text);
}
.topbar-search input:focus { border: none; box-shadow: none; }
.topbar-search input::placeholder { color: var(--text-faint); }

.topbar-user {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
}
.topbar-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-caption); font-weight: 700; flex-shrink: 0;
}
.topbar-user .who { line-height: 1.2; min-width: 0; }
.topbar-user .who b { display: block; font-size: var(--text-caption); font-weight: 600; color: var(--text); }
.topbar-user .who span { display: block; font-size: 10px; color: var(--text-faint); }

.topbar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: none; border-radius: var(--radius);
  background: transparent; color: var(--text-muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.topbar-btn:hover { background: var(--surface-muted); color: var(--text); }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + var(--space-6)) var(--space-6) var(--space-8);
  min-height: 100vh;
}

/* ── Cabecalho de pagina (padrao SGI: tile + eyebrow + titulo) ───────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.page-heading { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.page-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: var(--radius-lg);
  background: var(--info-bg); color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
}
html.dark .page-icon { color: #93b4ff; }
.page-eyebrow {
  font-size: 11px; font-weight: 500; line-height: 1.2;
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em;
}
.page-title {
  font-size: var(--text-heading); font-weight: 700; line-height: 1.2;
  color: var(--text);
}
.page-title span,
.page-subtitle {
  display: block;
  margin-top: 2px;
  font-size: var(--text-body); font-weight: 400; line-height: 1.3;
  color: var(--text-faint);
  text-transform: none; letter-spacing: 0;
}
.page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* ── KPI cards ───────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-4); margin-bottom: var(--space-6);
}
.kpi-card {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.kpi-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: var(--info-bg);
}
.kpi-card.green .kpi-icon { background: var(--success-bg); }
.kpi-card.teal  .kpi-icon { background: var(--surface-muted); }
.kpi-info { display: flex; flex-direction: column; min-width: 0; }
.kpi-label {
  font-size: 11px; font-weight: 500; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: var(--space-1);
}
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1; color: var(--text); }
.kpi-card.blue  .kpi-value { color: var(--color-primary); }
.kpi-card.green .kpi-value { color: var(--success); }
html.dark .kpi-card.blue .kpi-value { color: #93b4ff; }
.kpi-sub { font-size: var(--text-caption); color: var(--text-faint); margin-top: var(--space-1); }

/* ── Cards e tabelas ─────────────────────────────────────────────────────── */
.card,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
}
.card { padding: var(--space-6); }
.table-wrap { overflow: hidden; }

.card-title {
  font-size: var(--text-subheading); font-weight: 600; color: var(--text);
  margin-bottom: var(--space-4); padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-soft);
}

.table-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-soft);
}
.table-title { font-size: var(--text-subheading); font-weight: 600; color: var(--text); }
.table-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--border-soft);
}
thead th.th-check { width: 44px; }
tbody tr { border-bottom: 1px solid var(--border-soft); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-bg); }
tbody tr.selected { background: var(--info-bg); }
td {
  padding: var(--space-3) var(--space-4);
  font-size: 13px; color: var(--text-soft); vertical-align: middle;
}
.td-mac { font-family: var(--font-mono); font-size: var(--text-caption); color: var(--color-primary); }
.td-time { font-size: var(--text-caption); color: var(--text-faint); }
html.dark .td-mac { color: #93b4ff; }

.state-msg { text-align: center; padding: var(--space-12) var(--space-4); color: var(--text-faint); font-size: var(--text-body); }
.muted { color: var(--text-muted); font-size: var(--text-caption); }

/* ── Botoes ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--touch-target);
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius);
  font-family: inherit; font-size: var(--text-body); font-weight: 500;
  line-height: 1.25rem; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { flex-shrink: 0; }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }

.btn-outline { background: var(--surface); color: var(--text-soft); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--surface-bg); }

.btn-green { background: var(--success-bg); color: var(--success); border-color: var(--success-br); }
.btn-green:hover:not(:disabled) { background: var(--surface-muted); }

.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-br); }
.btn-danger:hover:not(:disabled) { background: var(--surface-muted); }

.btn-sm { min-height: 32px; padding: 6px 10px; font-size: var(--text-caption); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ── Formularios ─────────────────────────────────────────────────────────── */
label {
  font-size: var(--text-caption); font-weight: 500; color: var(--text-muted);
}
.form-group { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-bottom: var(--space-4); }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); margin-bottom: var(--space-4); }

input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], select, textarea {
  width: 100%;
  min-height: var(--touch-target);
  padding: 10px var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: var(--text-body); color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(15,59,204,.12);
}
textarea { min-height: 76px; resize: vertical; }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--color-primary); cursor: pointer; }
.checkbox-row {
  display: flex; align-items: center; gap: var(--space-2);
  margin: 0 0 var(--space-4); font-size: 13px; color: var(--text-soft); font-weight: 400;
}
.hidden { display: none !important; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  background: var(--info-bg); color: var(--info);
  border: 1px solid var(--info-br);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge.green  { background: var(--success-bg); color: var(--success); border-color: var(--success-br); }
.badge.orange { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-br); }
.badge.gray   { background: var(--surface-muted); color: var(--text-muted); border-color: var(--border); }
.badge-online { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-br);
                font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 10px; }

/* ── Alertas ─────────────────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: 13px; line-height: 1.5; margin-bottom: var(--space-4);
}
.alert-warning { background: var(--warning-bg); border-color: var(--warning-br); color: var(--warning); }
.alert-info    { background: var(--info-bg);    border-color: var(--info-br);    color: var(--info); }
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert code { font-family: var(--font-mono); font-size: var(--text-caption); }

/* ── Bloco de script ─────────────────────────────────────────────────────── */
.script-box {
  background: #0a1024; color: #cbd5e1;
  padding: var(--space-4); border-radius: var(--radius);
  border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: var(--text-caption);
  line-height: 1.6; white-space: pre;
  max-height: 500px; overflow: auto;
}
.script-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(10,31,114,.5);
  align-items: center; justify-content: center; padding: var(--space-4);
}
.modal-overlay.show { display: flex; }
.modal-box {
  width: 100%; max-width: 420px;
  padding: var(--space-8) var(--space-6) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.modal-box h3 { font-size: var(--text-subheading); font-weight: 700; color: var(--danger); margin-bottom: var(--space-2); }
.modal-box p  { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: var(--space-6); }
.modal-btns { display: flex; gap: var(--space-2); justify-content: center; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  display: none; position: fixed; bottom: var(--space-8); right: var(--space-8); z-index: 300;
  padding: var(--space-3) var(--space-6);
  background: var(--color-sidebar); color: #fff;
  border-radius: var(--radius-lg);
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
  animation: slideInUp .25s ease;
}
.toast.show    { display: block; }
.toast.success { background: #047857; }
.toast.error   { background: #b91c1c; }
@keyframes slideInUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  width: 36px; height: 36px; flex-shrink: 0;
  border: none; border-radius: var(--radius);
  background: transparent; color: var(--text-muted);
  cursor: pointer; align-items: center; justify-content: center;
}
.menu-toggle:hover { background: var(--surface-muted); color: var(--text); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99; }
.sidebar-overlay.show { display: block; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0; }
  .main { margin-left: 0; padding-left: var(--space-4); padding-right: var(--space-4); }
  .menu-toggle { display: flex; }
  .topbar-search { width: 150px; }
  .topbar-user .who { display: none; }
}

@media (max-width: 768px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .table-actions { width: 100%; }
  .table-actions input[type="text"] { width: 100%; }
  .toast { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); text-align: center; }
}

/* ── Botao de tema ───────────────────────────────────────────────────────── */
.btn-theme {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: none; border-radius: var(--radius);
  background: transparent; color: var(--text-muted);
  font-size: 16px; cursor: pointer;
  transition: background .15s;
}
.btn-theme:hover { background: var(--surface-muted); }

/* Variante flutuante — telas sem topbar (login admin e portal cativo) */
.btn-theme.floating {
  position: fixed; top: var(--space-4); right: var(--space-4); z-index: 10;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  backdrop-filter: blur(6px);
}
.btn-theme.floating:hover { background: rgba(255,255,255,.25); }

/* ==========================================================================
   Telas centradas (login admin e portal cativo)
   ========================================================================== */
body.centered {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: var(--space-6);
  background: linear-gradient(160deg, #061544 0%, var(--color-sidebar) 45%, var(--color-primary) 100%);
}
html.dark body.centered {
  background: linear-gradient(160deg, #03081c 0%, #060d24 50%, #0a1f72 100%);
}

.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  padding: var(--space-8) var(--space-8) var(--space-6);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 70px rgba(0,0,40,.45);
}
.auth-head { text-align: center; margin-bottom: var(--space-8); }
.auth-head img { width: 72px; height: 72px; border-radius: var(--radius-lg); object-fit: contain; margin-bottom: var(--space-4); }
.auth-head h1 { font-size: var(--text-heading); font-weight: 700; color: var(--text); line-height: 1.2; }
.auth-head p  { font-size: var(--text-body); color: var(--text-faint); margin-top: var(--space-1); line-height: 1.4; }

.auth-card .form-group { margin-bottom: var(--space-4); }
.auth-card label { display: block; margin-bottom: var(--space-1); }

.auth-foot { margin-top: var(--space-6); text-align: center; font-size: var(--text-caption); color: var(--text-faint); }
.auth-foot strong { color: var(--color-primary); font-weight: 600; }
html.dark .auth-foot strong { color: #93b4ff; }

.msg {
  display: none;
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: 13px; margin-bottom: var(--space-4); text-align: left;
}
.msg.err { background: var(--danger-bg); border-color: var(--danger-br); color: var(--danger); }
.msg.show { display: block; }

.spinner {
  display: inline-block; width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-ok {
  width: 64px; height: 64px; margin: 0 auto var(--space-4);
  border-radius: 50%;
  background: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px rgba(27,222,96,.35);
}
.icon-ok svg { width: 32px; height: 32px; }

@media (max-width: 480px) {
  .auth-card { padding: var(--space-6) var(--space-4); }
}

/* ── Portal cativo: validacao por campo + consentimento LGPD ─────────────── */
.field { text-align: left; margin-bottom: var(--space-4); }
.field label { display: block; margin-bottom: var(--space-1); }

.field-err {
  display: none;
  margin-top: var(--space-1);
  font-size: var(--text-caption); color: var(--danger); line-height: 1.4;
}
.field-err.show { display: block; }

input.valid   { border-color: var(--success); }
input.invalid { border-color: var(--danger); }
input.invalid:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.12); }

.lgpd-wrap {
  display: flex; align-items: flex-start; gap: var(--space-2);
  margin-top: var(--space-2); text-align: left;
}
.lgpd-wrap input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }
.lgpd-wrap label {
  font-size: var(--text-caption); font-weight: 400; line-height: 1.5;
  color: var(--text-muted); margin: 0;
}
.lgpd-wrap a {
  color: var(--color-primary); font-weight: 600; cursor: pointer; text-decoration: underline;
}
html.dark .lgpd-wrap a { color: #93b4ff; }

.lgpd-err {
  display: none; text-align: left;
  margin: var(--space-1) 0 0;
  font-size: var(--text-caption); color: var(--danger);
}
.lgpd-err.show { display: block; }

/* Modal da Politica de Privacidade — texto corrido, rolavel */
.modal-overlay.open { display: flex; }
.modal-overlay .modal-box.politica {
  position: relative;
  max-width: 560px; max-height: 80vh; overflow-y: auto;
  text-align: left; padding: var(--space-6);
}
.modal-box.politica h2 {
  font-size: var(--text-subheading); font-weight: 700; color: var(--text);
  margin-bottom: var(--space-4); padding-right: var(--space-8);
}
.modal-box.politica p {
  font-size: 13px; color: var(--text-muted); line-height: 1.6;
  margin-bottom: var(--space-3); text-align: left;
}
.modal-box.politica strong { color: var(--text-soft); }

.modal-close {
  position: absolute; top: var(--space-3); right: var(--space-3);
  width: 32px; height: 32px;
  border: none; border-radius: var(--radius);
  background: transparent; color: var(--text-faint);
  font-size: 22px; line-height: 1; cursor: pointer;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--surface-muted); color: var(--text); }

/* A tela de sucesso do portal e alternada por style.display no JS */
#tela-sucesso { display: none; }
