/* ═══════════════════════════════════════════════════════════════════════════
 * Painel Hunter Coder KL NFC — identidade visual do OPERADOR MOBILE (sistema principal).
 * Fundo #0b0f1a · paleta indigo→ciano→violeta (#6366f1 / #22d3ee / #a855f7).
 * Header superior com ABAS EM PÍLULA (mesmo padrão do MeuOperador), badge com
 * glow indigo pulsante e logo NFC sofisticada (SVG inline, sem ativos externos).
 * Fonte Inter · cantos 14–16px · cards glass com borda indigo sutil.
 * ═══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0b0f1a;
  --panel: rgba(17, 24, 39, 0.6);
  --panel-solid: #111827;
  --panel2: #0f172a;
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #d1d5db;
  --text-bright: #f3f4f6;
  --muted: #9ca3af;
  --muted2: #6b7280;
  /* paleta do Operador Mobile */
  --indigo: #6366f1;
  --indigo-strong: #4f46e5;
  --indigo-soft: rgba(99, 102, 241, 0.14);
  --indigo-border: rgba(99, 102, 241, 0.32);
  --indigo-text: #a5b4fc;
  --cyan: #22d3ee;
  --cyan-soft: #67e8f9;
  --violet: #a855f7;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 14px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.3); }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--red); font-size: 13px; margin-top: 10px; white-space: pre-wrap; font-weight: 500; }
h1, h2, h3 { color: var(--text-bright); letter-spacing: -0.3px; }

/* ═══════════ LOGO NFC (sofisticada, hexágono ciano→violeta com ondas de sinal) ═══════════ */
.nfc-logo { display: inline-flex; align-items: center; justify-content: center; }
.nfc-logo svg { filter: drop-shadow(0 0 10px rgba(129, 140, 248, 0.35)); }

/* ═══════════ LOGIN ═══════════ */
.login-view { position: relative; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; overflow: hidden; }
.login-glow {
  position: absolute; top: 30%; left: 50%; transform: translateX(-50%);
  width: 640px; height: 420px; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.16), rgba(34, 211, 238, 0.06) 60%, transparent 75%);
  border-radius: 50%; filter: blur(90px);
}
.login-wrap { position: relative; width: 100%; max-width: 400px; z-index: 1; }
.login-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 28px; }
.login-logo {
  width: 72px; height: 72px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center;
}
.login-brand h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; }
.login-sub { color: var(--muted); font-size: 13px; margin-top: 5px; }
.login-card {
  background: var(--panel-solid); border: 1px solid var(--indigo-border);
  border-radius: var(--radius-lg); padding: 26px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(99, 102, 241, 0.06);
}
.tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: rgba(11, 15, 26, 0.7); border: 1px solid var(--border);
  border-radius: 11px; padding: 4px;
}
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 9px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 12px;
  transition: all .15s;
}
.tab.active { background: var(--indigo-soft); color: var(--indigo-text); border-color: var(--indigo-border); }
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 7px;
}
input, select, textarea {
  width: 100%; padding: 11px 12px;
  background: rgba(11, 15, 26, 0.8); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #4b5563; }
input:focus, select:focus, textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.btn-login {
  width: 100%; padding: 12px; border: none; border-radius: 11px; cursor: pointer;
  font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35);
  transition: filter .15s, box-shadow .15s;
}
.btn-login:hover { filter: brightness(1.08); box-shadow: 0 4px 22px rgba(99, 102, 241, 0.45); }

/* ═══════════ LAYOUT DO PAINEL (header superior + abas em pílula) ═══════════ */
.panel-view { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 18px;
  height: 58px; padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand-logo { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; }
.brand-name { display: flex; flex-direction: column; font-weight: 800; font-size: 14px; color: var(--text-bright); line-height: 1.1; letter-spacing: -0.2px; }
.brand-sub { font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

/* ABAS em pílula — mesmo padrão do MeuOperador (bg-gray-900/70 border, ativa indigo). */
.sidenav {
  display: flex; align-items: center; gap: 3px;
  padding: 4px; border-radius: 11px; flex: 1; justify-content: center; min-width: 0;
  background: rgba(17, 24, 39, 0.7); border: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.sidenav::-webkit-scrollbar { display: none; }
.sidenav a {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 8px; color: var(--muted);
  cursor: pointer; font-size: 12.5px; font-weight: 500;
  border: 1px solid transparent; white-space: nowrap; transition: all .15s;
}
.sidenav a svg { flex-shrink: 0; opacity: 0.85; }
.sidenav a:hover { color: #e5e7eb; }
.sidenav a.active {
  background: var(--indigo-soft); color: var(--indigo-text);
  border-color: var(--indigo-border); font-weight: 600;
}
.nav-group { display: none; }

.topbar-right { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 20px; color: var(--cyan-soft);
  background: rgba(34, 211, 238, 0.08); border: 1px solid rgba(34, 211, 238, 0.25);
  white-space: nowrap;
}
/* Selo premium do operador geral — glow indigo pulsante (idêntico ao sistema principal). */
@keyframes opGlowPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(99, 102, 241, 0.45), 0 0 0 0 rgba(129, 140, 248, 0); }
  50%      { box-shadow: 0 2px 12px rgba(99, 102, 241, 0.7), 0 0 10px 1px rgba(129, 140, 248, 0.55); }
}
.badge.badge-owner {
  color: #c7d2fe; background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(79, 70, 229, 0.32));
  border: 1px solid rgba(129, 140, 248, 0.45); animation: opGlowPulse 2.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .badge.badge-owner { animation: none !important; } }
.whoami { font-size: 12px; color: var(--muted); white-space: nowrap; }
.btn-logout {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 6px 12px; border-radius: 9px; cursor: pointer; font-size: 12px; font-weight: 600;
  transition: all .15s; white-space: nowrap;
}
.btn-logout:hover { color: var(--red); background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.25); }

/* ═══════════ CONTEÚDO ═══════════ */
.content { flex: 1; padding: 28px 24px 40px; width: 100%; max-width: 1400px; margin: 0 auto; }
@keyframes om-fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.content > * { animation: om-fadein .3s ease both; }

h2.page-title { font-size: 21px; font-weight: 800; margin-bottom: 5px; letter-spacing: -0.4px; }
p.page-sub { color: var(--muted); margin-bottom: 22px; font-size: 13.5px; }

.card {
  background: var(--panel); border: 1px solid var(--indigo-border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px;
  backdrop-filter: blur(4px);
}
.card h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 14px; color: var(--text-bright); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat {
  background: var(--panel); border: 1px solid var(--indigo-border);
  border-radius: var(--radius); padding: 18px 16px;
  transition: transform .15s, border-color .15s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--indigo); }
.stat .num {
  font-size: 28px; font-weight: 800; color: var(--text-bright);
  letter-spacing: -0.6px; background: linear-gradient(135deg, #e0e7ff, #67e8f9);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat .lbl { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ═══════════ BOTÕES ═══════════ */
.btn {
  border: 1px solid var(--border); padding: 10px 15px; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-size: 13px; background: var(--panel2); color: var(--text);
  transition: all .15s;
}
.btn:hover { border-color: var(--border-strong); }
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; border: none;
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: rgba(248, 113, 113, 0.1); color: var(--red); border-color: rgba(248, 113, 113, 0.28); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); }
.btn-success { background: rgba(74, 222, 128, 0.1); color: var(--green); border-color: rgba(74, 222, 128, 0.28); }
.btn-success:hover { background: rgba(74, 222, 128, 0.2); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ═══════════ TABELAS ═══════════ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 9px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(99, 102, 241, 0.05); }

/* ═══════════ PILLS ═══════════ */
.pill {
  display: inline-block; padding: 2.5px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.pill.online { background: rgba(74, 222, 128, 0.1); color: var(--green); border-color: rgba(74, 222, 128, 0.22); }
.pill.offline { background: rgba(248, 113, 113, 0.1); color: var(--red); border-color: rgba(248, 113, 113, 0.22); }
.pill.new { background: var(--indigo-soft); color: var(--indigo-text); border-color: var(--indigo-border); }
.pill.used { background: rgba(107, 114, 128, 0.16); color: var(--muted); border-color: rgba(107, 114, 128, 0.22); }
.pill.revoked { background: rgba(248, 113, 113, 0.1); color: var(--red); border-color: rgba(248, 113, 113, 0.22); }
.pill.activo { background: rgba(74, 222, 128, 0.1); color: var(--green); border-color: rgba(74, 222, 128, 0.22); }
.pill.inativo { background: rgba(107, 114, 128, 0.16); color: var(--muted); border-color: rgba(107, 114, 128, 0.22); }
/* sub-operador dono do cartão (aparece no card do par, ao lado de "Vítima") */
.pill.sub { background: rgba(34, 211, 238, 0.1); color: #67e8f9; border-color: rgba(34, 211, 238, 0.24); }

/* ═══════════ CHIPS DE APARELHO VINCULADO (aba Sub-operadores) ═══════════ */
.dev-cells { max-width: 260px; }
.chip-dev {
  display: inline-flex; align-items: center; gap: 5px; margin: 2px 3px 2px 0;
  padding: 2px 4px 2px 9px; border-radius: 16px; font-size: 10.5px; font-family: 'Consolas', 'JetBrains Mono', monospace;
  background: var(--indigo-soft); color: var(--indigo-text); border: 1px solid var(--indigo-border);
}
.chip-x {
  border: 0; background: rgba(248, 113, 113, 0.14); color: var(--red); cursor: pointer;
  border-radius: 50%; width: 16px; height: 16px; line-height: 1; font-size: 10px; padding: 0;
}
.chip-x:hover { background: var(--red); color: #0b0f1a; }

.pin-box {
  font-family: 'Consolas', 'JetBrains Mono', monospace; font-size: 22px; letter-spacing: 4px; font-weight: 700;
  background: var(--panel2); padding: 10px 14px; border-radius: 10px;
  border: 1px dashed var(--indigo); display: inline-block; color: var(--text-bright);
}
.empty { color: var(--muted); text-align: center; padding: 32px; font-size: 13.5px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.label-mini { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; font-weight: 600; }
textarea { min-height: 80px; resize: vertical; font-family: 'Consolas', 'JetBrains Mono', monospace; }

.toast {
  position: fixed; bottom: 22px; right: 22px; background: var(--panel-solid);
  border: 1px solid var(--indigo-border); color: var(--text);
  padding: 12px 18px; border-radius: 11px; font-size: 14px; z-index: 99;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(99, 102, 241, 0.08);
  animation: om-fadein .25s ease both;
}
.log-stream { font-family: 'Consolas', 'JetBrains Mono', monospace; font-size: 12px; max-height: 300px; overflow-y: auto; background: rgba(11, 15, 26, 0.8); border-radius: 10px; padding: 12px; }
.log-stream .dir { color: var(--indigo-text); }
.mono { font-family: 'Consolas', 'JetBrains Mono', monospace; font-size: 12px; word-break: break-all; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.apdu-log table { font-size: 11px; }
.pair-card { border-color: var(--border-strong); }
.preview { background: var(--panel2); border-radius: 12px; padding: 20px; text-align: center; }

/* ═══════════ PARCAMENTO: discriminação visual (vítima vs operador) ═══════════ */
.legend {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.legend-item { display: flex; gap: 10px; align-items: flex-start; flex: 1; min-width: 220px; font-size: 12.5px; color: var(--text); }
.legend-item strong { color: var(--text-bright); display: block; margin-bottom: 2px; font-size: 12.5px; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; display: inline-block; }
.dot-reader { background: var(--amber); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.15); }
.dot-emulator { background: var(--violet); box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.18); }
.pair-roles { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.role { display: flex; gap: 10px; align-items: center; flex: 1; min-width: 200px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(11, 15, 26, 0.5); }
.role strong { font-size: 13px; color: var(--text-bright); }
.role .muted { font-size: 11px; }
.role-victim { border-color: rgba(251, 191, 36, 0.3); }
.role-operator { border-color: rgba(168, 85, 247, 0.32); }
.role-arrow { font-size: 20px; color: var(--muted); font-weight: 700; flex-shrink: 0; }

/* Containers de papel (vítima × operador) com tint e borda esquerda forte */
.role-box { border-radius: 14px; padding: 14px; margin: 10px 0; border: 1px solid; border-left: 4px solid; background: rgba(11, 15, 26, 0.45); }
.role-box-victim { border-color: rgba(251, 191, 36, 0.28); border-left-color: var(--amber); background: rgba(251, 191, 36, 0.06); }
.role-box-operator { border-color: rgba(168, 85, 247, 0.3); border-left-color: var(--violet); background: rgba(168, 85, 247, 0.07); }
.role-box-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.role-box-head strong { font-size: 12px; letter-spacing: 0.4px; color: var(--text-bright); }
.role-tag { font-size: 10.5px; color: var(--muted); background: rgba(148, 163, 184, 0.12); padding: 2px 8px; border-radius: 999px; margin-left: auto; }
.role-box .field { margin: 0; }

/* ═══════════ RESPONSIVO ═══════════ */
@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand-name { display: none; }
  .whoami { display: none; }
  .sidenav { justify-content: flex-start; }
  .content { padding: 18px 14px 32px; }
}
