:root {
  --bg: #0b1020;
  --surface: #131a2e;
  --surface-2: #1a2340;
  --border: #232e4f;
  --text: #e8ecf6;
  --muted: #8b97b5;
  --accent: #5b8cff;
  --accent-2: #7c5bff;
  --green: #2ed47a;
  --red: #ff5b6e;
  --radius: 14px;

  /* Espaçamento fluido: cresce com a viewport */
  --space: clamp(12px, 1.5vw, 28px);
  --gap: clamp(12px, 1.2vw, 22px);

  /* Safe areas (iPhone notch/Dynamic Island, gestos Android) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Garante que [hidden] vence qualquer display definido em classes */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%; /* impede zoom automático de texto no iOS landscape */
  text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124, 91, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(91, 140, 255, 0.15), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh; /* corrige altura em barras dinâmicas do Safari iOS / Samsung Internet */
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: clamp(12px, 1.4vw, 22px) var(--space);
  padding-top: calc(clamp(12px, 1.4vw, 22px) + var(--safe-top));
  padding-left: calc(var(--space) + var(--safe-left));
  padding-right: calc(var(--space) + var(--safe-right));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); /* Safari iOS */
  position: sticky;
  top: 0;
  background: rgba(11, 16, 32, 0.85);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: clamp(10px, 1vw, 16px); min-width: 0; }

.brand-icon {
  font-size: clamp(22px, 2vw, 30px);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  width: clamp(40px, 3.5vw, 52px);
  height: clamp(40px, 3.5vw, 52px);
  display: grid; place-items: center;
  border-radius: 12px;
  flex-shrink: 0;
}

.brand h1 { font-size: clamp(16px, 1.5vw, 23px); font-weight: 800; letter-spacing: -0.3px; }
.brand p {
  font-size: clamp(10.5px, 0.9vw, 13px);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(11px, 0.95vw, 14px);
  color: var(--muted);
  flex-shrink: 0;
}

.topbar-nav { display: flex; gap: 6px; flex-shrink: 0; }

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: clamp(12px, 1vw, 14px);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.nav-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.nav-label { line-height: 1; }

.nav-link:hover { color: var(--text); background: var(--surface-2); }

.nav-link.active {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-off { background: var(--red); }

/* ---------- Layout (tela cheia, fluido) ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 24vw, 460px);
  gap: var(--gap);
  padding: var(--gap) var(--space);
  padding-left: calc(var(--space) + var(--safe-left));
  padding-right: calc(var(--space) + var(--safe-right));
  width: 100%;
}

.market { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.sidebar { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

/* ---------- Widgets compactos na topbar (WhatsApp + Alertas) ---------- */
.tb-widget { position: relative; display: inline-flex; }

.tb-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: relative;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

button.tb-chip { border: 1px solid transparent; }

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--red);
}
.chip-dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.chip-dot.wait { background: #ffc107; box-shadow: 0 0 6px rgba(255, 193, 7, 0.6); }
.chip-dot.off { background: var(--red); }

.chip-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}

.tb-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(340px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 18px 44px rgba(3, 6, 16, 0.55);
  z-index: 60;
  animation: modal-in 0.18s ease;
}

.tb-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.tb-pop-head h3 { font-size: 14px; font-weight: 700; }

/* ---------- Dashboard: visão única sem rolagem ---------- */
body.page-dashboard {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page-dashboard .topbar { flex-shrink: 0; }

.page-dashboard .layout-dashboard {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: clamp(10px, 1.4vh, 20px);
  padding-top: clamp(8px, 1.2vh, 18px);
  padding-bottom: clamp(8px, 1.2vh, 18px);
}

.page-dashboard .market {
  min-height: 0;
  gap: clamp(10px, 1.4vh, 20px);
}

.page-dashboard .highlights-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(10px, 1.4vh, 20px);
}

.page-dashboard .highlights-panel .panel-head { margin-bottom: clamp(6px, 1vh, 14px); }

.page-dashboard .highlights {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(6px, 1vh, 14px);
}

.page-dashboard .updated {
  margin-top: clamp(4px, 0.6vh, 8px);
  font-size: clamp(9px, 1.1vh, 11px);
}

.page-dashboard .footer {
  flex-shrink: 0;
  padding: clamp(4px, 0.8vh, 10px) 18px;
  padding-bottom: calc(clamp(4px, 0.8vh, 10px) + var(--safe-bottom));
  margin-top: 0;
  font-size: clamp(9px, 1.1vh, 12px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(14px, 1.3vw, 24px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: clamp(12px, 1.1vw, 18px);
}

.panel-head h2 { font-size: clamp(13.5px, 1.1vw, 17px); font-weight: 700; }

.source {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ---------- Status ---------- */
.loading, .empty { text-align: center; color: var(--muted); padding: 24px !important; }

.updated { margin-top: 10px; font-size: 11px; color: var(--muted); text-align: right; }

/* ---------- Highlights (Top 10 cards) ---------- */
.highlights {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(10px, 1vw, 16px);
}

.hl-card {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: clamp(7px, 1.2vh, 16px) clamp(8px, 0.9vw, 16px);
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.6vh, 9px);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  transition: transform 0.15s, border-color 0.15s;
}

@media (hover: hover) {
  .hl-card:hover { transform: translateY(-3px); border-color: var(--accent); }
}

.hl-rank {
  position: absolute;
  top: clamp(5px, 0.9vh, 10px);
  right: clamp(7px, 0.8vw, 12px);
  font-size: clamp(9px, 1.2vh, 11px);
  font-weight: 800;
  color: var(--muted);
  opacity: 0.7;
}

.hl-head { display: flex; align-items: center; gap: clamp(6px, 0.6vw, 9px); min-height: 0; }

.hl-head img {
  width: clamp(20px, 3vh, 30px);
  height: clamp(20px, 3vh, 30px);
  border-radius: 50%;
  flex-shrink: 0;
}

/* Logotipos de ações: chip branco estilo ícone de app (favicons oficiais) */
.hl-head img.stock-logo {
  background: #fff;
  padding: clamp(2px, 0.4vh, 4px);
  border-radius: 26%;
  object-fit: contain;
  border: 1px solid var(--border);
}

.hl-sym {
  width: clamp(20px, 3vh, 30px);
  height: clamp(20px, 3vh, 30px);
  border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: clamp(7px, 1.1vh, 10px);
  font-weight: 800;
  flex-shrink: 0;
}

.hl-head b { font-size: clamp(11px, 1.7vh, 16px); display: block; line-height: 1.1; }
.hl-head span {
  font-size: clamp(8.5px, 1.25vh, 12px);
  color: var(--muted);
  display: block;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hl-price { font-size: clamp(12px, 2vh, 21px); font-weight: 800; font-variant-numeric: tabular-nums; }

.hl-change {
  font-size: clamp(9.5px, 1.4vh, 12px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: clamp(1px, 0.3vh, 3px) clamp(5px, 0.5vw, 8px);
  border-radius: 6px;
  width: fit-content;
}
.hl-change.up { color: var(--green); background: rgba(46, 212, 122, 0.12); }
.hl-change.down { color: var(--red); background: rgba(255, 91, 110, 0.12); }

.hl-spark {
  width: 100%;
  flex: 1;
  min-height: 14px;
  max-height: clamp(22px, 4.5vh, 52px);
  margin-top: 2px;
}

.hl-cap { font-size: clamp(8.5px, 1.25vh, 12px); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- WhatsApp ---------- */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.badge-off { background: rgba(255, 91, 110, 0.15); color: var(--red); }
.badge-wait { background: rgba(255, 193, 7, 0.15); color: #ffc107; }
.badge-on { background: rgba(46, 212, 122, 0.15); color: var(--green); }

.wa-content { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.wa-content .hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.qr-box {
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  display: inline-block;
  max-width: 100%;
}
.qr-box img {
  display: block;
  width: clamp(180px, 100%, 260px);
  height: auto;
  aspect-ratio: 1;
}

.tb-pop .qr-box { padding: 10px; }
.tb-pop .qr-box img { width: min(100%, 220px); }
.tb-pop .wa-content .hint { font-size: 12.5px; }

/* ---------- Forms ---------- */
.alert-form { display: flex; flex-direction: column; gap: 12px; }

.alert-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.alert-form input, .alert-form select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 12px;
  min-height: 44px; /* alvo de toque mínimo (Apple HIG / Material) */
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.alert-form input:focus, .alert-form select:focus { border-color: var(--accent); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  border: none;
  border-radius: 9px;
  padding: 11px 16px;
  min-height: 44px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  touch-action: manipulation; /* remove atraso de double-tap no mobile */
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.form-msg { font-size: 12px; min-height: 16px; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--red); }

/* ---------- Alerts list ---------- */
.alerts-summary { display: flex; flex-direction: column; gap: 10px; }

.alerts-summary .hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.page-dashboard .alerts-summary .hint { font-size: clamp(10px, 1.5vh, 12.5px); }

.summary-line { font-size: clamp(10.5px, 1.6vh, 13px); color: var(--muted); }
.summary-line b { color: var(--text); font-size: clamp(12px, 1.9vh, 15px); }

.summary-list { list-style: none; display: flex; flex-direction: column; gap: clamp(3px, 0.6vh, 6px); min-height: 0; overflow: hidden; }

.summary-list li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: clamp(4px, 0.8vh, 8px) 12px;
  font-size: clamp(10.5px, 1.55vh, 12.5px);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-list li b { color: var(--text); }

.summary-list li.more {
  background: transparent;
  border-style: dashed;
  text-align: center;
}

.panel-cta { text-decoration: none; display: inline-flex; align-items: center; }

.alerts-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.alerts-list li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.alerts-list li.empty { background: transparent; border: 1px dashed var(--border); justify-content: center; }

.alert-info b { display: block; font-size: 13px; }
.alert-info span { color: var(--muted); font-size: 11.5px; }

.alert-del {
  background: rgba(255, 91, 110, 0.12);
  color: var(--red);
  border: none;
  border-radius: 7px;
  width: 40px; height: 40px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  touch-action: manipulation;
}
.alert-del:hover { background: rgba(255, 91, 110, 0.25); }

/* ---------- Página de Gestão de Alertas ---------- */
.layout-alerts { grid-template-columns: 1fr; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.stat-value {
  font-size: clamp(22px, 2.2vw, 34px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label { font-size: clamp(11px, 0.9vw, 13px); color: var(--muted); }

.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 13px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.alerts-table { width: 100%; border-collapse: collapse; font-size: clamp(12.5px, 1vw, 14px); }

.alerts-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  padding: 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.alerts-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(35, 46, 79, 0.5);
  vertical-align: middle;
}

.alerts-table tr:last-child td { border-bottom: none; }

@media (hover: hover) {
  .alerts-table tbody tr:hover { background: rgba(91, 140, 255, 0.05); }
}

.alerts-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.actions-col { text-align: right; white-space: nowrap; }

.type-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.type-stock { background: rgba(91, 140, 255, 0.15); color: var(--accent); }
.type-crypto { background: rgba(124, 91, 255, 0.18); color: #a98cff; }

.phone-cell { color: var(--muted); font-variant-numeric: tabular-nums; }

.price-hit { color: var(--green); font-weight: 700; }

.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 38px; height: 38px;
  cursor: pointer;
  font-size: 14px;
  margin-left: 6px;
  transition: border-color 0.15s, background 0.15s;
  touch-action: manipulation;
}

.icon-btn.edit:hover { border-color: var(--accent); }
.icon-btn.del:hover { border-color: var(--red); background: rgba(255, 91, 110, 0.12); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
  padding-top: calc(16px + var(--safe-top));
  padding-bottom: calc(16px + var(--safe-bottom));
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px, 2vw, 26px);
  width: min(440px, 100%);
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h3 { font-size: 16px; font-weight: 700; }

.modal-x {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  width: 36px; height: 36px;
  cursor: pointer;
  font-size: 14px;
  touch-action: manipulation;
}
.modal-x:hover { color: var(--text); border-color: var(--accent); }

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

body.modal-open { overflow: hidden; }

/* ---------- Login / Gestão de Acessos ---------- */
body.page-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

.login-wrap {
  width: min(440px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: calc(16px + var(--safe-top)) 0 calc(16px + var(--safe-bottom));
}

.login-card {
  padding: clamp(24px, 4vw, 36px);
  animation: modal-in 0.25s ease;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  margin-bottom: 22px;
}

.login-brand .brand-icon {
  width: 56px;
  height: 56px;
  font-size: 28px;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(91, 140, 255, 0.35);
}

.login-brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.login-brand p { font-size: 13px; color: var(--muted); }

.login-step-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(91, 140, 255, 0.1);
  border: 1px solid rgba(91, 140, 255, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  margin-bottom: 4px;
}

.login-foot {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

/* Medidor de força de senha */
.pwd-meter {
  height: 5px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.pwd-meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width 0.25s, background 0.25s;
}

.pwd-meter span.weak { background: var(--red); }
.pwd-meter span.medium { background: #ffc107; }
.pwd-meter span.strong { background: var(--green); }

.pwd-rules {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pwd-rules li {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  transition: color 0.2s, border-color 0.2s;
}

.pwd-rules li.ok {
  color: var(--green);
  border-color: rgba(46, 212, 122, 0.4);
  background: rgba(46, 212, 122, 0.08);
}

.pwd-rules li.ok::before { content: '✓ '; }

/* Botão biométrico */
.biometric-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  text-align: center;
}

.btn-biometric {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  font-size: 15px;
}

.bio-icon { font-size: 20px; }

.biometric-box .hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* Botão sair na topbar */
.nav-logout {
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  color: var(--red);
  border: 1px solid transparent;
}

.nav-logout:hover { background: rgba(255, 91, 110, 0.1); color: var(--red); }

/* Painel Minha Conta */
.me-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.me-info { display: flex; align-items: center; gap: 14px; min-width: 0; }

.me-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}

.me-info b { font-size: 15px; display: block; }
.me-sub { display: block; font-size: 12px; color: var(--muted); }

.me-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Tabela de usuários */
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }

.user-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.row-self td { background: rgba(91, 140, 255, 0.04); }

.badge-active { background: rgba(46, 212, 122, 0.15); color: var(--green); }
.badge-locked { background: rgba(255, 91, 110, 0.15); color: var(--red); }

.bio-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
  touch-action: manipulation;
}

.bio-chip:not([disabled]):hover { border-color: var(--accent); }
.bio-chip[disabled] { opacity: 0.5; cursor: default; }

/* Lista de biometrias (modal) */
.bio-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.bio-list li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bio-item-info b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.bio-item-info span { display: block; font-size: 11.5px; color: var(--muted); }

.label-hint { font-weight: 400; font-size: 11px; color: var(--muted); }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 18px;
  padding-bottom: calc(18px + var(--safe-bottom));
  font-size: clamp(10.5px, 0.85vw, 13px);
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

/* =====================================================================
   RESPONSIVO — breakpoints unificados
   4K/ultrawide ≥ 2000px · desktop · notebook ≤ 1500px · tablet ≤ 1100px
   mobile L ≤ 768px · Samsung Galaxy S / iPhone ≤ 480px · compactos ≤ 380px
   ===================================================================== */

/* Monitores grandes (QHD/4K/ultrawide): limita e centraliza o conteúdo */
@media (min-width: 2000px) {
  .layout { max-width: 1920px; margin: 0 auto; }
  .topbar { padding-left: max(calc((100vw - 1920px) / 2 + var(--space)), var(--space)); padding-right: max(calc((100vw - 1920px) / 2 + var(--space)), var(--space)); }
}

/* Notebooks (13"–15", 1280–1500px): grade 5x2 mantém, sidebar encolhe */
@media (max-width: 1500px) {
  .layout { grid-template-columns: minmax(0, 1fr) clamp(300px, 26vw, 380px); }
  .page-dashboard .layout-dashboard { grid-template-columns: 1fr; }
}

/* Notebooks menores / janelas reduzidas: 4 colunas (10 cards = 3 linhas) */
@media (max-width: 1280px) {
  .highlights { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .page-dashboard .highlights {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }
}

/* Tablets e janelas estreitas: visão única inviável — scroll retorna */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    align-items: start;
  }

  body.page-dashboard { height: auto; min-height: 100dvh; overflow: auto; }
  .page-dashboard .layout-dashboard { overflow: visible; grid-template-columns: 1fr; }
  .page-dashboard .highlights {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    grid-template-rows: none;
  }
  .page-dashboard .highlights-panel { flex: none; }
  .page-dashboard .hl-spark { flex: none; height: 36px; max-height: none; }
}

/* Mobile landscape / tablets pequenos */
@media (max-width: 768px) {
  .highlights { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .sidebar { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* Smartphones: Samsung Galaxy S (360–412px) e iPhone (375–430px) */
@media (max-width: 480px) {
  .layout { padding: 12px; padding-left: calc(12px + var(--safe-left)); padding-right: calc(12px + var(--safe-right)); gap: 12px; }
  .topbar { padding: 10px 14px; padding-top: calc(10px + var(--safe-top)); }
  .brand p { display: none; } /* economiza espaço vertical na topbar */
  .conn-label-full { display: none; }

  /* Navegação compacta */
  .topbar-nav { gap: 4px; }
  .nav-link { padding: 9px; font-size: 12px; }

  /* Chips da topbar: só ícone + indicador; dropdown ocupa a largura */
  .nav-label { display: none; }
  .nav-ico { width: 20px; height: 20px; }
  .tb-pop {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(var(--safe-top) + 62px);
    width: auto;
  }

  /* Stats em 2 colunas */
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Tabela de alertas: esconde colunas secundárias */
  .alerts-table:not(.access-table) th:nth-child(5), .alerts-table:not(.access-table) td:nth-child(5),
  .alerts-table:not(.access-table) th:nth-child(6), .alerts-table:not(.access-table) td:nth-child(6),
  .alerts-table:not(.access-table) th:nth-child(7), .alerts-table:not(.access-table) td:nth-child(7) { display: none; }

  /* Tabelas de acessos: esconde último acesso/IP/datas, mantém ações */
  .access-table th:nth-child(3), .access-table td:nth-child(3),
  .access-table th:nth-child(4), .access-table td:nth-child(4),
  .access-table th:nth-child(5), .access-table td:nth-child(5) { display: none; }

  /* Gestão de acessos: painel Minha Conta empilhado */
  .me-grid { flex-direction: column; align-items: stretch; }
  .me-actions { flex-direction: column; }
  .me-actions .btn { width: 100%; }
  .nav-logout { padding: 9px; font-size: 12px; }

  .modal-actions { grid-template-columns: 1fr; }

  /* 2 cards por linha com preço legível */
  .highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hl-card { padding: 12px; }
  .hl-price { font-size: 16px; }
  .hl-spark { height: 36px; }

  /* iOS faz zoom automático em inputs com fonte < 16px — neutraliza */
  .alert-form input, .alert-form select { font-size: 16px; }

  .row { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .btn-sm { width: auto; }
  .panel { border-radius: 12px; }
}

/* Compactos (Galaxy S em modo compacto, iPhone SE/mini ≤ 380px) */
@media (max-width: 380px) {
  .highlights { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hl-card { padding: 10px; gap: 5px; }
  .hl-head span { max-width: 80px; }
  .hl-price { font-size: 14.5px; }
  .hl-change { font-size: 11px; }
  .qr-box img { width: 100%; }
}

/* Landscape em celulares (altura baixa): topbar compacta não-fixa e scroll liberado */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar { position: static; }
  .highlights { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  body.page-dashboard { height: auto; overflow: auto; }
  .page-dashboard .layout-dashboard { overflow: visible; }
  .page-dashboard .highlights { grid-template-rows: none; }
  .page-dashboard .hl-spark { flex: none; height: 32px; max-height: none; }
}

/* Acessibilidade: respeita preferência por menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
