/* ==========================================================================
   Escola 360 Face — Design System
   Estilo "Accessible & Ethical": alto contraste, WCAG, foco visível.
   Tipografia: Plus Jakarta Sans. Paleta institucional + acento verde.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Marca */
  --brand-1: #4f46e5;          /* indigo */
  --brand-2: #0ea5e9;          /* sky — vibe "360" */
  --brand-grad: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);

  /* Superfícies (tema claro, institucional) */
  --bg: #f1f5f9;               /* slate-100 */
  --surface: #ffffff;
  --surface-2: #f8fafc;        /* slate-50 */
  --ink: #0f172a;              /* slate-900 — texto principal */
  --ink-2: #475569;            /* slate-600 — secundário */
  --ink-3: #94a3b8;            /* slate-400 — terciário */
  --border: #e2e8f0;           /* slate-200 */
  --border-strong: #cbd5e1;    /* slate-300 */

  /* Semânticos */
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warn: #d97706;
  --warn-bg: #fef3c7;

  /* Console escuro (monitoramento) */
  --console: #0b1220;
  --console-2: #111a2e;

  /* Tokens */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.08);
  --shadow: 0 4px 6px -1px rgba(15,23,42,.07), 0 10px 24px -6px rgba(15,23,42,.12);
  --shadow-lg: 0 20px 40px -12px rgba(15,23,42,.22);
  --ring: 0 0 0 4px rgba(79,70,229,.28);
  --space: 8px;
  --sidebar-w: 264px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-1); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.02em; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100dvh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand-logo { width: 42px; height: 42px; flex: none; border-radius: 12px; box-shadow: var(--shadow-sm); }
.brand-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; line-height: 1.1; }
.brand-name span { display: block; font-weight: 600; font-size: .72rem; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 600; font-size: .94rem;
  transition: background .18s ease, color .18s ease;
}
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: color-mix(in srgb, var(--brand-1) 12%, transparent); color: var(--brand-1); }
.nav-item.active svg { color: var(--brand-1); }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.userchip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.userchip .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.userchip .meta { font-size: .8rem; line-height: 1.2; overflow: hidden; }
.userchip .meta b { display: block; font-weight: 700; }
.userchip .meta small { color: var(--ink-3); }

/* ---------- Topbar (mobile) ---------- */
.topbar { display: none; }

/* ---------- Conteúdo ---------- */
.content { padding: 32px 36px 56px; max-width: 1080px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 1.65rem; font-weight: 800; }
.page-head p { color: var(--ink-2); margin: 6px 0 0; max-width: 64ch; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card + .card { margin-top: 20px; }
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
.card-title svg { width: 20px; height: 20px; color: var(--brand-1); }
.card-sub { color: var(--ink-2); font-size: .9rem; margin: 0 0 18px; }
.grid-2 { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; align-items: start; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .req { color: var(--danger); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type=text], input[type=number], input[type=password], input[type=tel] {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--ink-3); }
input:focus { outline: none; border-color: var(--brand-1); box-shadow: var(--ring); }
.help { font-size: .78rem; color: var(--ink-3); margin-top: 5px; }

/* Consentimento LGPD */
.consent { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 18px 0 6px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand-1); flex: none; }
.consent label { font-size: .85rem; color: var(--ink-2); line-height: 1.45; }
.consent label b { color: var(--ink); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 20px; min-height: 44px; font: inherit; font-weight: 700; font-size: .95rem;
  border: 0; border-radius: var(--radius-sm); cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, opacity .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(79,70,229,.6); }
.btn-primary:hover { box-shadow: 0 10px 22px -6px rgba(79,70,229,.7); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: .85rem; }

/* ---------- Alertas / banners ---------- */
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500; margin-top: 14px; }
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.alert.ok { background: var(--success-bg); color: #166534; }
.alert.err { background: var(--danger-bg); color: #991b1b; }
.alert.info { background: #e0f2fe; color: #075985; }
.hidden { display: none !important; }

/* ---------- Webcam ---------- */
.cam-stage { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--console); aspect-ratio: 4/3; box-shadow: var(--shadow); }
.cam-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame { position: absolute; inset: 16px; border-radius: 12px; pointer-events: none;
  background:
    linear-gradient(var(--scan,transparent),var(--scan,transparent)) ; }
/* cantos de mira */
.cam-corners::before, .cam-corners::after,
.cam-corners > i::before, .cam-corners > i::after {
  content: ""; position: absolute; width: 26px; height: 26px; border: 3px solid rgba(255,255,255,.85); }
.cam-corners::before { top: 16px; left: 16px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.cam-corners::after { top: 16px; right: 16px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.cam-corners > i::before { bottom: 16px; left: 16px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.cam-corners > i::after { bottom: 16px; right: 16px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.cam-badge { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 7px; padding: 6px 12px; background: rgba(11,18,32,.72); color: #fff; font-size: .78rem; font-weight: 600; border-radius: 999px; backdrop-filter: blur(6px); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.dot.live { background: #ef4444; animation: pulse 1.4s infinite; }
.dot.on { background: #22c55e; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.preview-shot { margin-top: 14px; display: flex; align-items: center; gap: 14px; }
.preview-shot img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 2px solid var(--success); }

/* ---------- Resultado reconhecimento ---------- */
.match-card { background: var(--console); color: #fff; border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-lg); animation: rise .35s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.match-card .who { display: flex; align-items: center; gap: 16px; }
.match-card .face { width: 60px; height: 60px; border-radius: 16px; background: var(--brand-grad); display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; }
.match-card .name { font-size: 1.5rem; font-weight: 800; }
.match-card .meta { color: #94a3b8; font-size: .9rem; }
.match-status { margin-top: 18px; display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 999px; font-weight: 700; background: rgba(34,197,94,.16); color: #4ade80; }
.match-status.cool { background: rgba(217,119,6,.16); color: #fbbf24; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.kpi .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 12px; }
.kpi .ico svg { width: 21px; height: 21px; }
.kpi .ico.indigo { background: color-mix(in srgb, var(--brand-1) 14%, transparent); color: var(--brand-1); }
.kpi .ico.green { background: var(--success-bg); color: var(--success); }
.kpi .ico.sky { background: #e0f2fe; color: #0284c7; }
.kpi .num { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .lbl { color: var(--ink-2); font-size: .85rem; font-weight: 600; }

/* ---------- Tabela ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th { text-align: left; padding: 13px 16px; background: var(--surface-2); color: var(--ink-2); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--ink); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.tag.ok { background: var(--success-bg); color: #166534; }
.tag.wait { background: var(--warn-bg); color: #92400e; }
.tag.err { background: var(--danger-bg); color: #991b1b; }
.avatar-cell { display: flex; align-items: center; gap: 11px; }
.avatar-cell .av { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .82rem; flex: none; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty svg { width: 40px; height: 40px; margin-bottom: 10px; color: var(--border-strong); }

/* ---------- Login overlay ---------- */
.login-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 70% -10%, #1e293b, #0b1220); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 34px 30px; animation: rise .4s ease; }
.login-card .brand { justify-content: center; padding: 0 0 8px; flex-direction: column; text-align: center; gap: 14px; }
.login-card h2 { font-size: 1.3rem; font-weight: 800; text-align: center; }
.login-card .sub { text-align: center; color: var(--ink-2); font-size: .9rem; margin: 4px 0 22px; }

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
  .topbar .brand { padding: 0; }
  .topbar .brand-logo { width: 34px; height: 34px; }
  .tabbar { display: flex; gap: 4px; }
  .tabbar a { padding: 9px; border-radius: 10px; color: var(--ink-2); display: grid; place-items: center; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { background: color-mix(in srgb, var(--brand-1) 12%, transparent); color: var(--brand-1); }
  .content { padding: 20px 16px 40px; }
  .grid-2, .row { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 1.4rem; }
}

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