/* ========================================================
   BITÁCORA DE OBRA · FREIRÍA LORENZO
   Guía de Estilo y Design System Oficial
   ======================================================== */

:root {
  /* Fondos y Paneles */
  --bg: #0f172a;           /* Slate 900 - Fondo general */
  --panel: #1e293b;        /* Slate 800 - Fondo de paneles y tarjetas */
  --panel-hover: #273548;  /* Resalte al pasar el cursor */
  --border: #334155;       /* Slate 700 - Bordes estructurales */

  /* Colores de Acento Corporativo */
  --accent: #2563eb;       /* Blue 600 - Primario */
  --accent-hover: #1d4ed8; /* Blue 700 */
  --accent-light: #38bdf8; /* Sky 400 - Títulos secundarios, badges */
  --accent-bg: #1e3a5f;    /* Azul petróleo - Fondos activos */

  /* Jerarquía de Texto */
  --text: #e2e8f0;         /* Slate 200 - Texto principal */
  --text-dim: #94a3b8;     /* Slate 400 - Etiquetas, secundarios */
  --text-muted: #64748b;   /* Slate 500 - Metadatos */
  --white: #ffffff;        /* Blanco puro */

  /* Estados Semánticos de Calidad y Control */
  --success: #22c55e;      /* Verde - Conforme */
  --warning: #f59e0b;      /* Ámbar - Con reservas / Atención */
  --danger: #ef4444;       /* Rojo - No conforme / Alerta */
  --info: #06b6d4;         /* Cyan */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ================= HEADER ================= */
.header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  height: 58px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.logo-fallback {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--white);
}

.header-title h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title span {
  color: var(--accent-light);
  font-weight: 400;
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ================= BOTONES ================= */
.btn {
  padding: 7px 13px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--panel-hover); border-color: var(--text-muted); }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #16a34a; }

.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #d97706; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 4px 8px; font-size: 11px; }
.btn-lg { padding: 12px 20px; font-size: 14px; font-weight: 600; }

.btn-ghost { background: transparent; color: var(--text-dim); border: none; padding: 5px 8px; }
.btn-ghost:hover { color: var(--text); background: var(--panel-hover); }

/* ================= LAYOUT 3 COLUMNAS ================= */
.app-body {
  display: flex;
  flex: 1;
  height: calc(100vh - 58px);
  overflow: hidden;
}

/* 1. Panel de Proyectos / Obras */
.nav-panel {
  width: 280px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-input-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.search-box:focus { border-color: var(--accent); }

.project-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.project-card {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.project-card:hover {
  background: var(--panel-hover);
  border-color: var(--accent);
}

.project-card.active {
  background: var(--accent-bg);
  border-color: var(--accent-light);
}

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.project-exp {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-light);
  font-family: monospace;
}

.project-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-active { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,0.6); }
.dot-paused { background: var(--warning); }
.dot-finished { background: var(--text-muted); }

.project-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}

.project-sit {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.project-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
  padding-top: 5px;
}

.hours-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.hours-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

/* 2. Barra Lateral de Visitas */
.visits-sidebar {
  width: 320px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.visits-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.visit-card {
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.visit-card:hover {
  background: var(--panel-hover);
}

.visit-card.active {
  background: var(--accent-bg);
  border-color: var(--accent-light);
}

.visit-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.visit-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-light);
}

.visit-date {
  font-size: 11px;
  color: var(--text-dim);
}

.visit-phase {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.visit-brief {
  font-size: 11px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.visit-tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.tag-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
}

/* 3. Lienzo Principal */
.main-canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
}

.view-tabs {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.view-tab {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-tab:hover {
  color: var(--text);
}

.view-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
}

.canvas-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

/* ================= COMPONENTES FORMULARIOS ================= */
.form-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.form-panel h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.form-group label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-full {
  grid-column: 1 / -1;
}

/* ================= GRABADORA DE AUDIO Y DICTADO MÓVIL ================= */
.audio-recorder-box {
  background: linear-gradient(180deg, #1e293b 0%, #172033 100%);
  border: 2px dashed var(--accent);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}

.rec-btn-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--danger);
  border: 4px solid rgba(239, 68, 68, 0.3);
  color: #fff;
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.rec-btn-circle:hover {
  transform: scale(1.05);
}

.rec-btn-circle.recording {
  animation: pulse-red 1.5s infinite;
  background: #dc2626;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.audio-timer {
  font-size: 20px;
  font-weight: 700;
  font-family: monospace;
  margin: 12px 0 6px;
  color: var(--text);
}

.audio-status-text {
  font-size: 12px;
  color: var(--text-dim);
}

.audio-player-custom {
  margin-top: 12px;
  width: 100%;
}

/* ================= CAPTURA DE FOTOS ================= */
.photo-uploader {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.photo-uploader:hover {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.05);
}

.photo-grid-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.photo-preview-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.85);
  padding: 4px 6px;
  font-size: 10px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ================= COLETILLAS DE SEGURIDAD ================= */
.security-coletillas-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.coletilla-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.15s;
}

.coletilla-item.active {
  border-left-color: var(--success);
  background: rgba(34, 197, 94, 0.05);
}

.coletilla-item input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.coletilla-content {
  flex: 1;
}

.coletilla-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.coletilla-code {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-light);
  font-family: monospace;
}

.coletilla-cat {
  font-size: 10px;
  color: var(--text-muted);
}

.coletilla-text {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text);
}

/* ================= MODAL DEL CATÁLOGO DE 144 FRASES ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 90%;
  max-width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ================= INFORME OFICIAL DE IMPRESIÓN (A4) ================= */
.report-paper {
  background: #ffffff;
  color: #1a1a1a;
  max-width: 840px;
  margin: 0 auto 30px;
  padding: 30px 40px;
  font-family: 'Arial Narrow', Arial, -apple-system, sans-serif;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 5px 25px rgba(0,0,0,0.4);
  border-radius: 2px;
}

.report-header {
  border-bottom: 2px solid #2563eb;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.report-logo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-title-block {
  text-align: right;
}

.report-main-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e3a5f;
  letter-spacing: 0.5px;
}

.report-subtitle {
  font-size: 10.5px;
  color: #475569;
}

.report-cajetin {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 10px;
}

.report-cajetin td {
  border: 1px solid #94a3b8;
  padding: 4px 6px;
}

.report-cajetin-label {
  background: #f1f5f9;
  font-weight: 700;
  color: #1e3a5f;
}

.report-h2 {
  font-size: 11.5px;
  color: #1e3a5f;
  border-bottom: 1px solid #2563eb;
  padding-bottom: 2px;
  margin: 12px 0 6px;
  text-transform: uppercase;
  font-weight: 700;
}

.report-p {
  text-align: justify;
  margin-bottom: 8px;
  font-size: 10.5px;
}

.report-ul {
  margin: 4px 0 10px 18px;
  font-size: 10.5px;
}

.report-photos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 10px 0;
  page-break-inside: avoid;
}

.report-photo-box {
  border: 1px solid #cbd5e1;
  padding: 4px;
  background: #fafafa;
  border-radius: 3px;
  text-align: center;
}

.report-photo-box img {
  max-width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.report-photo-caption {
  font-size: 9px;
  color: #475569;
  margin-top: 4px;
  font-style: italic;
}

.report-firmas-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 10px;
  page-break-inside: avoid;
}

.report-firmas-table td {
  border: 1px solid #94a3b8;
  padding: 8px;
}

.report-footer {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #64748b;
  border-top: 1px solid #cbd5e1;
  padding-top: 6px;
  margin-top: 20px;
}

/* ================= MEDIA PRINT ================= */
@media print {
  body {
    background: #ffffff !important;
    color: #1a1a1a !important;
    height: auto !important;
    overflow: visible !important;
  }

  .header,
  .nav-panel,
  .visits-sidebar,
  .view-tabs,
  .no-print {
    display: none !important;
  }

  .app-body {
    display: block !important;
    height: auto !important;
  }

  .main-canvas {
    overflow: visible !important;
    background: #ffffff !important;
    padding: 0 !important;
  }

  .report-paper {
    box-shadow: none !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  @page {
    size: A4 portrait;
    margin: 12mm 15mm 15mm 15mm;
  }
}

/* ================= RESPONSIVE MÓVIL (IPHONE / ANDROID) ================= */

/* Barra inferior móvil (oculta en escritorio) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

.mob-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 100%;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.mob-nav-btn:active,
.mob-nav-btn.active {
  color: var(--accent-light);
  background: rgba(37, 99, 235, 0.12);
}

.mob-icon { font-size: 18px; }
.mob-text { font-size: 10.5px; font-weight: 600; letter-spacing: 0.2px; }

@media (max-width: 900px) {
  body {
    height: 100dvh;
    overflow: hidden;
  }

  /* Header compacto con scroll horizontal suave para acciones */
  .header {
    height: auto;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-title h1 {
    font-size: 13.5px;
  }

  .header-title span {
    display: none; /* Ocultar subtítulo largo en móvil */
  }

  .header-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }
  .header-actions::-webkit-scrollbar { display: none; }

  /* Cuerpo de la app: altura ajustada restando header y barra inferior */
  .app-body {
    height: calc(100dvh - 100px - env(safe-area-inset-bottom, 0px));
    position: relative;
    overflow: hidden;
  }

  /* En móvil, los 3 paneles se comportan como vistas de pantalla completa conmutables */
  .nav-panel,
  .visits-sidebar,
  .main-canvas {
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    border-right: none !important;
    border-bottom: none !important;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  /* Vista activa visible */
  .nav-panel.mobile-active,
  .visits-sidebar.mobile-active,
  .main-canvas.mobile-active {
    display: flex !important;
  }

  .canvas-content {
    padding: 12px 12px 85px 12px !important;
  }

  .project-list,
  .visits-list {
    padding-bottom: 85px !important;
  }

  /* Mostrar barra inferior de navegación en smartphone */
  .mobile-bottom-nav {
    display: flex !important;
    justify-content: space-around;
    align-items: center;
  }

  /* Formularios a una sola columna en móvil */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  /* Fuentes a 16px para evitar auto-zoom molesto en iOS Safari */
  .form-group input,
  .form-group select,
  .form-group textarea,
  .search-box {
    font-size: 16px !important;
    padding: 9px 12px !important;
  }

  /* Botones táctiles cómodos para dedos */
  .btn {
    min-height: 38px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .btn-lg {
    min-height: 48px;
    font-size: 15px;
  }

  /* Modales a pantalla completa / centrados en móvil */
  .modal-content {
    width: 95% !important;
    max-height: 88dvh !important;
    margin: 10px auto;
  }

  /* Vista previa del informe en móvil: permitir scroll horizontal seguro */
  .report-paper {
    padding: 16px 14px !important;
    box-shadow: none;
    overflow-x: auto;
  }

  .report-photos-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ========================================================
   TELÓN DE AUTENTICACIÓN Y TECLADO PIN (ANTI-BRUTE FORCE)
   ======================================================== */
.auth-gate-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 30%, #1e293b 0%, #0f172a 70%, #080d1a 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-gate-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(37, 99, 235, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: authScaleIn 0.25s ease-out;
}

@keyframes authScaleIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.auth-header {
  padding: 24px 20px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.auth-logo {
  height: 44px;
  width: auto;
  margin-bottom: 10px;
}

.auth-header h2 {
  font-size: 17px;
  color: var(--white);
  font-weight: 700;
}

.auth-header h2 span {
  color: var(--accent-light);
  font-size: 13.5px;
  font-weight: 400;
}

.auth-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

.auth-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-light);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.auth-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-lock-icon {
  font-size: 24px;
  margin-bottom: 6px;
}

.auth-notice {
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 14px;
}

.pin-input-wrap {
  display: flex;
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

.pin-input {
  width: 100%;
  padding: 10px 42px 10px 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 6px;
  color: var(--accent-light);
  outline: none;
  transition: all 0.2s;
}

.pin-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.35);
}

.btn-toggle-pin {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.btn-toggle-pin:hover { color: var(--text); }

.auth-error-msg {
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 6px;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.auth-remember-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 14px;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 260px;
  margin: 0 auto 6px auto;
}

.keypad-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
}

.keypad-btn:hover {
  background: var(--panel-hover);
  border-color: var(--accent);
}

.keypad-btn:active {
  transform: scale(0.96);
  background: var(--accent);
}

.keypad-clear {
  color: var(--warning);
  font-size: 18px;
}

.keypad-submit {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}
.keypad-submit:hover {
  background: var(--accent-hover);
}
