/* ══════════════════════════════════════════
   SistemaMarca — Estilos
   Temas: [data-theme="dark"] (default) / [data-theme="light"]
══════════════════════════════════════════ */

/* ── TEMA OSCURO (default) ── */
:root,
[data-theme="dark"] {
  --bg: #0d0f14;
  --surface: #151820;
  --surface2: #1c2030;
  --surface3: #232840;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #e8eaf0;
  --text-muted: #8890a6;
  --text-dim: #555e78;
  --accent: #4f8ef7;
  --accent-glow: rgba(79, 142, 247, 0.18);
  --accent2: #34d399;
  --accent2-glow: rgba(52, 211, 153, 0.15);
  --danger: #f87171;
  --danger-glow: rgba(248, 113, 113, 0.15);
  --amber: #fbbf24;
  --amber-glow: rgba(251, 191, 36, 0.13);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --radius: 14px;
  --radius-sm: 8px;
}

/* ── TEMA CLARO ── */
[data-theme="light"] {
  --bg: #f0f2f7;
  --surface: #ffffff;
  --surface2: #f5f6fa;
  --surface3: #eaecf3;
  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.13);
  --text: #1a1d2e;
  --text-muted: #5a6080;
  --text-dim: #9099b8;
  --accent: #2f6de8;
  --accent-glow: rgba(47, 109, 232, 0.12);
  --accent2: #0f9e65;
  --accent2-glow: rgba(15, 158, 101, 0.12);
  --danger: #dc3535;
  --danger-glow: rgba(220, 53, 53, 0.1);
  --amber: #c27c00;
  --amber-glow: rgba(194, 124, 0, 0.1);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

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

/* ── BASE ── */
body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  transition:
    background 0.3s,
    color 0.3s;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition:
    background 0.3s,
    border-color 0.3s;
}
.logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.logo h1 {
  font-family: "Syne", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}
.logo p {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 300;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 12px 4px;
  margin-top: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 400;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 500;
}
.nav-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}
.nav-item.active .dot {
  opacity: 1;
}
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.user-info p {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}
.user-info span {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── THEME TOGGLE ── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 12px;
  font-family: "DM Sans", sans-serif;
  transition: all 0.15s;
  margin-bottom: 10px;
  width: 100%;
  justify-content: center;
}
.theme-toggle:hover {
  background: var(--surface3);
  color: var(--text);
}
.theme-toggle svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── MAIN ── */
.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background 0.3s;
}
.topbar h2 {
  font-family: "Syne", sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.content {
  padding: 32px;
  flex: 1;
}
.page {
  display: none;
}
.page.active {
  display: block;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge.green {
  background: var(--accent2-glow);
  color: var(--accent2);
}
.badge.red {
  background: var(--danger-glow);
  color: var(--danger);
}
.badge.amber {
  background: var(--amber-glow);
  color: var(--amber);
}
.badge.blue {
  background: var(--accent-glow);
  color: var(--accent);
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition:
    background 0.3s,
    border-color 0.3s;
}
.card-title {
  font-family: "Syne", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── SCANNER ── */
.mark-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 900px;
}
.fp-scanner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.fp-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.5s;
}
.fp-ring.scanning {
  border-color: var(--accent);
  box-shadow:
    0 0 0 6px var(--accent-glow),
    0 0 32px var(--accent-glow);
  animation: pulse-ring 1.2s ease-in-out infinite;
}
.fp-ring.success {
  border-color: var(--accent2);
  box-shadow:
    0 0 0 6px var(--accent2-glow),
    0 0 32px var(--accent2-glow);
}
.fp-ring.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 6px var(--danger-glow);
  animation: shake 0.4s ease;
}
@keyframes pulse-ring {
  0%,
  100% {
    box-shadow:
      0 0 0 4px var(--accent-glow),
      0 0 24px var(--accent-glow);
  }
  50% {
    box-shadow:
      0 0 0 10px var(--accent-glow),
      0 0 48px var(--accent-glow);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
.fp-svg {
  width: 80px;
  height: 80px;
  opacity: 0.6;
  transition: opacity 0.3s;
}
.fp-ring.scanning .fp-svg {
  opacity: 1;
}
.scan-line {
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 1px;
  display: none;
  animation: scan 1.2s ease-in-out infinite;
}
.fp-ring.scanning .scan-line {
  display: block;
}
@keyframes scan {
  0% {
    top: 10%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 88%;
    opacity: 0;
  }
}
.fp-status {
  text-align: center;
}
.fp-status p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.fp-status strong {
  font-family: "Syne", sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ── BUTTONS ── */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn-ghost {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface3);
  color: var(--text);
}
.btn-success {
  background: var(--accent2-glow);
  color: var(--accent2);
  border: 1px solid rgba(52, 211, 153, 0.25);
}
.btn-danger {
  background: var(--danger-glow);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

/* ── RESULTADO ── */
.result-card {
  background: var(--surface2);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  display: none;
  border: 1px solid var(--border);
}
.result-card.show {
  display: block;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.result-name {
  font-family: "Syne", sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.result-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.result-time {
  font-size: 32px;
  font-weight: 300;
  font-family: "Syne", sans-serif;
  color: var(--accent);
  margin: 8px 0;
}

/* ── RELOJ ── */
.clock-big {
  font-family: "Syne", sans-serif;
  font-size: 52px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  text-align: center;
  color: var(--text);
}
.clock-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 300;
  text-align: center;
}

/* ── STATS ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: background 0.3s;
}
.stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.stat-value {
  font-family: "Syne", sans-serif;
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ── TABLA ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: background 0.3s;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.table-header h3 {
  font-family: "Syne", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.search-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  outline: none;
  width: 220px;
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
}
.search-input::placeholder {
  color: var(--text-dim);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  text-align: left;
  padding: 10px 24px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 13px 24px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: var(--surface2);
}
.emp-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  margin-right: 8px;
  vertical-align: middle;
}

/* ── MODAL ── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal-bg.open {
  display: flex;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 32px;
  width: 480px;
  max-width: 95vw;
  animation: modal-in 0.2s ease;
  transition: background 0.3s;
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.modal h3 {
  font-family: "Syne", sans-serif;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus {
  border-color: var(--accent);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.enroll-steps {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.enroll-step {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}
.enroll-step.done {
  background: var(--accent2);
}
.enroll-step.active {
  background: var(--accent);
}

/* ── SDK STATUS ── */
.sdk-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-muted);
}
.sdk-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  animation: blink 1.5s ease-in-out infinite;
}
.sdk-dot.connected {
  background: var(--accent2);
  animation: none;
}
.sdk-dot.error {
  background: var(--danger);
  animation: none;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ── LOG ── */
.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.log-item:last-child {
  border-bottom: none;
}
.log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.scroll-area {
  max-height: 260px;
  overflow-y: auto;
}
.scroll-area::-webkit-scrollbar {
  width: 4px;
}
.scroll-area::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

/* ── NOTIF ── */
.notif-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.notif {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  animation: notif-in 0.25s ease;
  min-width: 240px;
  transition: opacity 0.4s;
  color: var(--text);
}
@keyframes notif-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
/* ── HORARIOS ── */
.dia-btn {
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  text-align: center;
  color: var(--text-muted);
  transition: all 0.15s;
  user-select: none;
  line-height: 1.2;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dia-btn.activo {
  background: var(--accent2-glow);
  border-color: var(--accent2);
  color: var(--accent2);
  font-weight: 500;
}

.dia-cell {
  text-align: center;
  font-size: 16px;
}

/* ── REPORTES ── */
.reporte-btn {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.15s;
  user-select: none;
}

.reporte-btn:hover {
  background: var(--surface3);
  color: var(--text);
}

.reporte-btn.activo {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}
