/* ===================================================
   HOMILOTECH - Admin & Billing Suite
   Styles for Dashboard, Invoice/Proposal Generator & Accounting
=================================================== */

:root {
  color-scheme: dark;
  --primary: #4facfe;
  --primary-dark: #1a6ed8;
  --primary-glow: rgba(79, 172, 254, 0.25);
  --accent: #00f2fe;
  --accent-purple: #7c3aed;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --accent-yellow: #eab308;

  --bg-base: #070d1f;
  --bg-sidebar: #09122c;
  --bg-card: #0d1b3e;
  --bg-card-hover: #122452;
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(79, 172, 254, 0.1);

  --border: rgba(79, 172, 254, 0.15);
  --border-strong: rgba(79, 172, 254, 0.35);

  --text-primary: #f0f6ff;
  --text-secondary: #94a3c8;
  --text-muted: #5a6a8a;

  --grad-primary: linear-gradient(135deg, #4facfe, #00f2fe);
  --grad-brand: linear-gradient(135deg, #4facfe 0%, #1a6ed8 100%);
  --grad-green: linear-gradient(135deg, #22c55e, #16a34a);
  --grad-red: linear-gradient(135deg, #ef4444, #dc2626);
  --grad-orange: linear-gradient(135deg, #f97316, #ea580c);

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(79, 172, 254, 0.1);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-title: 'Outfit', sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ===================================================
   LOGIN / AUTH MODAL
=================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 13, 31, 0.95);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px var(--primary-glow);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.auth-card h2 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.8rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-input {
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 2px;
  transition: all 0.2s ease;
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
  background: var(--bg-input-focus);
}

.auth-btn {
  background: var(--grad-brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--primary-glow);
}

.auth-error {
  color: var(--accent-red);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: none;
}

/* ===================================================
   APP LAYOUT
=================================================== */
.admin-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* SIDEBAR */
.admin-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
}

.sidebar-brand h1 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-brand span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(79, 172, 254, 0.15), rgba(0, 242, 254, 0.05));
  border-color: var(--border-strong);
  box-shadow: 0 0 15px rgba(79, 172, 254, 0.15);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1.2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-logout:hover {
  color: var(--accent-red);
}

.btn-home-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* MAIN CONTENT AREA */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100vh;
}

.topbar {
  padding: 1rem 2rem;
  background: rgba(7, 13, 31, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title h2 {
  font-family: var(--font-title);
  font-size: 1.4rem;
}

.topbar-title p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.sync-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  display: inline-block;
}

.sync-status-indicator.cloud-active .sync-dot {
  background: #00f2fe;
  box-shadow: 0 0 10px #00f2fe;
}

.sync-status-indicator.offline .sync-dot {
  background: #eab308;
  box-shadow: 0 0 6px #eab308;
}

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(26, 110, 216, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-danger {
  background: var(--grad-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.btn-success {
  background: var(--grad-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

/* CONTENT VIEW WRAPPER */
.content-wrapper {
  padding: 2rem;
  flex: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================================================
   TAB 1: DASHBOARD CONTABLE & FINANCIERO
=================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.blue::before { background: var(--grad-brand); }
.stat-card.green::before { background: var(--grad-green); }
.stat-card.orange::before { background: var(--grad-orange); }
.stat-card.red::before { background: var(--grad-red); }

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}

.stat-card.blue .stat-icon { color: var(--primary); }
.stat-card.green .stat-icon { color: var(--accent-green); }
.stat-card.orange .stat-icon { color: var(--accent-orange); }
.stat-card.red .stat-icon { color: var(--accent-red); }

.stat-value {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.stat-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* CASHFLOW & RECENT ACTIVITY */
.dashboard-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.data-table th {
  padding: 0.8rem 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(79, 172, 254, 0.03);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-draft { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.badge-sent { background: rgba(79, 172, 254, 0.15); color: var(--primary); }
.badge-paid { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.badge-pending { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.badge-overdue { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* ===================================================
   TAB 2: GENERADOR DE FACTURAS Y PROPUESTAS
=================================================== */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1.8rem;
  align-items: start;
  position: relative;
  transition: all 0.3s ease;
}

/* ===================================================
   MODO VISTA PREVIA COMPLETA (FORMULARIO ENCOGIDO/OCULTO)
=================================================== */
.editor-layout.form-collapsed {
  grid-template-columns: 1fr !important;
}

.editor-layout.form-collapsed .editor-form-panel {
  display: none !important;
}

.editor-layout.form-collapsed .preview-panel {
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.editor-layout.form-collapsed .preview-scale-wrapper {
  max-height: calc(100vh - 110px);
}

/* Botón en la barra de herramientas de la vista previa */
.btn-toggle-view {
  background: rgba(79, 172, 254, 0.12);
  color: var(--primary);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.btn-toggle-view:hover {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 12px var(--primary-glow);
}

.editor-layout.form-collapsed .btn-toggle-view {
  background: var(--grad-brand);
  color: #ffffff;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  box-shadow: 0 4px 15px rgba(26, 110, 216, 0.4);
}

/* Botón de encoger formulario en la cabecera (Donde señaló el usuario en imagen 2) */
.btn-collapse-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--primary);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-collapse-toggle:hover {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 12px var(--primary-glow);
}

.editor-form-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.8rem;
  box-shadow: var(--shadow-card);
}

.doc-type-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.3rem;
  margin-bottom: 1.5rem;
}

.toggle-option {
  flex: 1;
  text-align: center;
  padding: 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.toggle-option.active {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s;
  color-scheme: dark;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-input-focus);
}

/* ===================================================
   FIX MENÚS DESPLEGABLES (<select> Y <option>)
   Garantiza fondo oscuro sólido y texto blanco nítido
=================================================== */
select,
.form-select {
  color-scheme: dark !important;
  background-color: #0d1b3e !important;
  color: #f0f6ff !important;
  cursor: pointer;
}

select option,
.form-select option {
  background-color: #0b152e !important;
  color: #ffffff !important;
  padding: 10px 14px !important;
  font-size: 0.92rem !important;
}

select option:hover,
select option:focus,
select option:checked {
  background-color: #1a6ed8 !important;
  color: #ffffff !important;
}

.data-table select.form-select {
  background-color: #0d1b3e !important;
  color: #ffffff !important;
  color-scheme: dark !important;
}

.data-table select.form-select option {
  background-color: #0b152e !important;
  color: #ffffff !important;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* ITEMS TABLE IN EDITOR */
.items-builder {
  margin: 1.5rem 0;
}

.items-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.item-row {
  display: grid;
  grid-template-columns: 3fr 1fr 1.3fr 1.2fr 40px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.item-row input {
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
}

.btn-remove-item {
  background: transparent;
  border: none;
  color: var(--accent-red);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
}

.btn-remove-item:hover {
  background: rgba(239, 68, 68, 0.15);
  border-radius: 6px;
}

.quick-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.preset-chip {
  background: rgba(79, 172, 254, 0.08);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.preset-chip:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: var(--primary);
}

/* TOTALS SUMMARY IN FORM */
.totals-summary {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin: 1.2rem 0;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.totals-row.grand-total {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}

.grand-total span:last-child {
  color: var(--primary);
}

/* ACTIONS BAR */
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

/* ===================================================
   LIVE PREVIEW CONTAINER (HOJA A4)
=================================================== */
.preview-panel {
  position: sticky;
  top: 5rem;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 0.8rem 1.2rem;
}

.preview-toolbar span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.preview-scale-wrapper {
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  padding: 1.5rem 1rem;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
}

/* THE A4 DOCUMENT SHEET */
.a4-document {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  color: #1e293b;
  padding: 18mm 16mm;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  box-sizing: border-box;
}

.a4-document.with-letterhead {
  background-image: url('membrete-homilotech.jpg');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: top center;
  padding-top: 46mm;
  padding-bottom: 18mm;
  padding-left: 16mm;
  padding-right: 16mm;
}

/* HEADER DEL DOCUMENTO */
.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.doc-logo-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #0b192c;
  line-height: 1.1;
}

.doc-brand-subtitle {
  font-size: 11px;
  color: #1e6ed8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.doc-meta-box {
  text-align: right;
}

.doc-type-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #1e6ed8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.doc-number {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  margin-top: 2px;
}

.doc-dates {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

/* CLIENT & EMITTER INFO */
.doc-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

.party-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
}

.party-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #1e6ed8;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.party-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 3px;
}

.party-details {
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
}

/* ITEMS TABLE IN PDF */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.doc-table th {
  background: #0b192c;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  text-align: left;
}

.doc-table th:last-child,
.doc-table td:last-child {
  text-align: right;
}

.doc-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11.5px;
  color: #1e293b;
}

.doc-table tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

.doc-item-title {
  font-weight: 600;
  color: #0f172a;
}

.doc-item-desc {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
}

/* SUMMARY TOTALS & PAYMENT INFO */
.doc-bottom-section {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 25px;
  margin-bottom: 25px;
}

.payment-info-box {
  background: #f1f5f9;
  border-left: 3px solid #1e6ed8;
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
}

.payment-title {
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.payment-details {
  font-size: 10.5px;
  color: #475569;
  line-height: 1.45;
}

.doc-totals-table {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.doc-totals-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 3px 0;
  font-size: 11px;
  color: #475569;
}

.doc-totals-row span:last-child {
  font-weight: 600;
  color: #0f172a;
}

.doc-totals-row.final {
  border-top: 2px solid #0f172a;
  margin-top: 6px;
  padding-top: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: #0b192c;
}

.doc-totals-row.final span:last-child {
  color: #1a6ed8;
  font-size: 15px;
}

/* TERMS AND SIGNATURE */
.doc-terms {
  font-size: 9.5px;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  margin-top: auto;
  line-height: 1.4;
}

.doc-footer-legal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  color: #94a3b8;
  margin-top: 15px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 8px;
}

/* FIRMA DIGITAL AUTORIZADA */
.pv-signature-block {
  text-align: center;
  position: relative;
}

#pv-signature-wrap {
  transition: opacity 0.2s ease;
}

#pv-signature-img {
  image-rendering: auto;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.04));
}

/* ===================================================
   TAB 3: GASTOS & CONTROL CONTABLE
=================================================== */
.expense-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}

/* ===================================================
   PRINT STYLES (Generates 100% Vector Crisp PDF)
=================================================== */
@page {
  size: A4 portrait;
  margin: 0mm !important;
}

@media print {
  html, body {
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    overflow: hidden !important;
  }

  /* Ocultar TODO lo que sea interfaz de usuario */
  .admin-sidebar,
  .topbar,
  .auth-overlay,
  .editor-form-panel,
  .preview-toolbar,
  .btn-toggle-view,
  .btn-collapse-toggle,
  .divider-toggle-btn,
  .ticket-modal-overlay,
  .view-section:not(#view-editor) {
    display: none !important;
  }

  .admin-main,
  .content-wrapper,
  .editor-layout,
  .preview-panel,
  .preview-scale-wrapper {
    display: block !important;
    width: 210mm !important;
    max-width: 210mm !important;
    min-width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    overflow: hidden !important;
  }

  .a4-document {
    width: 210mm !important;
    height: 295mm !important;
    max-height: 295mm !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    margin: 0 auto !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    page-break-before: avoid !important;
    overflow: hidden !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .a4-document.with-letterhead {
    background-image: url('membrete-homilotech.jpg') !important;
    background-size: 100% 100% !important;
    background-repeat: no-repeat !important;
    background-position: center top !important;
    padding-top: 44mm !important;
    padding-bottom: 16mm !important;
    padding-left: 14mm !important;
    padding-right: 14mm !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .doc-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  .doc-table th, .doc-table td {
    word-break: break-word !important;
  }

  .doc-bottom-section {
    display: grid !important;
    grid-template-columns: 1.2fr 1fr !important;
    gap: 16px !important;
    margin-bottom: 16px !important;
  }

  .doc-totals-table {
    width: 100% !important;
  }

  .doc-totals-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 2.5px 0 !important;
  }

  .pv-signature-block {
    display: block !important;
    text-align: center !important;
  }

  #pv-signature-img {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Impresión exclusiva de Ticket (Optimizado para POS 80mm e Impresoras estándar) */
  body.printing-ticket {
    background: transparent !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  body.printing-ticket html {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.printing-ticket * {
    visibility: hidden;
  }
  body.printing-ticket #printable-ticket,
  body.printing-ticket #printable-ticket * {
    visibility: visible;
  }
  body.printing-ticket .admin-sidebar,
  body.printing-ticket .topbar,
  body.printing-ticket .admin-main,
  body.printing-ticket .content-wrapper,
  body.printing-ticket .editor-layout,
  body.printing-ticket .preview-panel,
  body.printing-ticket .ticket-actions {
    display: none !important;
  }
  body.printing-ticket #ticket-modal {
    position: static !important;
    display: block !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 auto !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
  body.printing-ticket .ticket-modal-wrapper {
    display: block !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 80mm !important;
  }
  body.printing-ticket #printable-ticket {
    position: static !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
    margin: 0 auto !important;
    box-shadow: none !important;
    border: 1px solid #1e293b !important;
    background: #0b1118 !important;
    color: #fff !important;
    max-width: 80mm !important;
    width: 100% !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ===================================================
   TICKET / COMPROBANTE DE PAGO MODAL
=================================================== */
.ticket-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

.ticket-modal-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 440px;
  margin: auto;
}

.ticket-card {
  background: #0b1118;
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  padding: 2.2rem 2rem 2rem 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 242, 254, 0.12);
  color: #f1f5f9;
  font-family: var(--font-main);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.ticket-header {
  text-align: center;
  margin-bottom: 1.2rem;
}

.ticket-brand {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 900;
  color: #00f2fe;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.ticket-subtitle {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 4px;
}

.ticket-badge-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.2rem 0 0.8rem 0;
}

.ticket-badge-label {
  font-size: 10px;
  font-weight: 700;
  color: #22c55e;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.ticket-number {
  background: #04080e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.5rem 1.5rem;
  border-radius: 10px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 2px;
}

.ticket-datetime {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 1.2rem;
  font-family: monospace;
}

.ticket-divider {
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
  margin: 1.2rem 0;
}

.ticket-field {
  margin-bottom: 1.2rem;
  text-align: left;
}

.ticket-field-label {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.ticket-field-value {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.ticket-concept-text {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.45;
}

.ticket-breakdown-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin: 1rem 0;
}

.ticket-breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 0.4rem;
  color: #94a3b8;
}

.ticket-breakdown-row strong {
  color: #ffffff;
}

.ticket-breakdown-row.saldo {
  color: #f97316;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 0.4rem;
  margin-top: 0.4rem;
}

.ticket-breakdown-row.saldo strong {
  color: #f97316;
}

.ticket-totals-area {
  margin: 1.2rem 0;
}

.ticket-subtotal-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 0.6rem;
}

.ticket-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
}

.ticket-total-row .total-amount {
  font-family: var(--font-title);
  font-size: 26px;
  color: #ffffff;
}

/* SLANTED STAMP (SELLO INCLINADO) */
.ticket-stamp-wrapper {
  display: flex;
  justify-content: center;
  margin: 1.6rem 0 1rem 0;
}

.ticket-stamp {
  display: inline-block;
  padding: 0.45rem 1.6rem;
  border-radius: 8px;
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  transform: rotate(-9deg);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.ticket-stamp.stamp-pendiente {
  border: 2.8px solid #f97316;
  color: #f97316;
  background: rgba(249, 115, 22, 0.08);
}

.ticket-stamp.stamp-pagado {
  border: 2.8px solid #22c55e;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

.ticket-stamp.stamp-abono {
  border: 2.8px solid #00f2fe;
  color: #00f2fe;
  background: rgba(0, 242, 254, 0.08);
}

/* TICKET MODAL ACTIONS */
.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  width: 100%;
  max-width: 440px;
  margin-top: 1.2rem;
  justify-content: center;
}

.ticket-btn-close {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ticket-btn-close:hover {
  background: #334155;
  color: #ffffff;
}

.ticket-btn-print {
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 114, 255, 0.35);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 1 1 auto;
}

.ticket-btn-print:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 114, 255, 0.5);
}

.ticket-btn-png {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 1 1 auto;
}

.ticket-btn-png:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.ticket-btn-printer {
  background: #334155;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.ticket-btn-printer:hover {
  background: #475569;
}

.ticket-btn-wa {
  background: #25d366;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.ticket-btn-wa:hover {
  transform: scale(1.05);
}

.ticket-btn-pay {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 1 1 100%;
}

.ticket-btn-pay:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

.ticket-btn-edit {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.ticket-btn-edit:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #ffffff;
}

/* ===================================================
   RESPONSIVE DESIGN
=================================================== */
@media (max-width: 1024px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
  .expense-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Contenedor general */
  .admin-container {
    flex-direction: column !important;
    min-height: 100vh !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Barra lateral adaptada a cabecera móvil */
  .admin-sidebar {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
    flex-shrink: 0 !important;
  }

  .sidebar-header {
    padding: 0.9rem 1rem !important;
  }

  .sidebar-brand h1 {
    font-size: 1.15rem !important;
  }

  .sidebar-nav {
    flex-direction: row !important;
    overflow-x: auto !important;
    padding: 0.5rem 0.8rem !important;
    gap: 0.45rem !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none !important;
  }

  .nav-item {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .sidebar-footer {
    padding: 0.5rem 1rem !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-top: 1px solid var(--border) !important;
    background: rgba(0, 0, 0, 0.2) !important;
  }

  /* Área principal de contenido */
  .admin-main {
    max-height: none !important;
    overflow-y: visible !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Barra superior (Topbar) - Se adapta verticalmente sin encimar ni flotar */
  .topbar {
    position: relative !important;
    top: auto !important;
    padding: 1rem 0.9rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.8rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: var(--bg-card) !important;
    backdrop-filter: none !important;
  }

  .topbar-title {
    width: 100% !important;
  }

  .topbar-title h2 {
    font-size: 1.25rem !important;
    margin-bottom: 0.2rem !important;
  }

  .topbar-title p {
    font-size: 0.78rem !important;
  }

  .topbar-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }

  .topbar-actions .sync-status-indicator {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.76rem !important;
  }

  .topbar-actions .btn-secondary,
  .topbar-actions .btn-primary {
    padding: 0.45rem 0.75rem !important;
    font-size: 0.78rem !important;
    flex: 1 1 auto !important;
    justify-content: center !important;
  }

  /* Envoltorio del contenido */
  .content-wrapper {
    padding: 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Tarjetas KPI y Dashboard */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
    margin-bottom: 1.2rem !important;
  }

  .stat-card {
    padding: 1.1rem !important;
  }

  .stat-value {
    font-size: 1.6rem !important;
  }

  .dashboard-columns {
    grid-template-columns: 1fr !important;
    gap: 1.2rem !important;
  }

  .dashboard-card {
    padding: 1.1rem 0.9rem !important;
  }

  .card-title {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.6rem !important;
  }

  /* Formularios responsivos */
  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr !important;
    gap: 0.8rem !important;
  }

  /* Filas de ítems en el editor de factura */
  .item-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    background: rgba(255, 255, 255, 0.02) !important;
    padding: 0.75rem !important;
    border-radius: 8px !important;
    border: 1px solid var(--border) !important;
  }

  .item-row input:first-child {
    grid-column: 1 / -1 !important;
  }

  .item-row .btn-remove-item {
    justify-self: end !important;
  }

  .editor-actions {
    flex-direction: column !important;
    gap: 0.6rem !important;
  }

  .editor-actions button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Panel de previsualización y membrete A4 en móvil */
  .preview-panel {
    padding: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .preview-toolbar {
    padding: 0.6rem 0.8rem !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    justify-content: space-between !important;
  }

  .preview-scale-wrapper {
    display: block !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0.8rem 0.4rem !important;
    text-align: left !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-height: 480px !important;
  }

  .a4-document {
    min-width: 210mm !important;
    width: 210mm !important;
    margin: 0 auto !important;
    display: flex !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  }

  /* Tablas adaptadas con desplazamiento horizontal suave */
  .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Modal de ticket en móvil */
  .ticket-card {
    max-width: 95vw !important;
    padding: 1.5rem 1rem !important;
    border-radius: 16px !important;
    margin: 0.8rem auto !important;
  }

  /* Modal de 2FA en móvil */
  .mfa-card {
    max-width: 95vw !important;
    margin: 0.8rem auto !important;
  }

  /* Diálogos HomiloDialog en móvil */
  .homilo-dialog-card {
    max-width: 95vw !important;
    margin: 0.8rem auto !important;
  }
}


/* ===================================================
   ESTILOS MODAL 2FA / TOTP (HOMILOTECH THEME)
=================================================== */
.mfa-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1.5rem;
}

.mfa-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mfa-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(10, 15, 30, 0.99));
  border: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(0, 242, 254, 0.15);
  overflow: hidden;
  animation: mfaPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mfaPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.mfa-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.mfa-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(0, 242, 254, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mfa-title {
  font-family: var(--font-title), sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.mfa-subtitle {
  font-size: 0.76rem;
  color: var(--text-secondary, #94a3b8);
  margin: 0.2rem 0 0;
}

.mfa-btn-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.2s;
}

.mfa-btn-close:hover { color: #fff; }

.mfa-body {
  padding: 1.5rem;
}

.mfa-qr-box {
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.mfa-manual-key {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

.mfa-manual-label {
  font-size: 0.72rem;
  color: #94a3b8;
  display: block;
  margin-bottom: 0.3rem;
}

.mfa-secret-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.mfa-secret-badge code {
  font-family: monospace;
  font-size: 0.82rem;
  color: #00f2fe;
  background: rgba(0, 242, 254, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.btn-copy-secret {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-copy-secret:hover { background: rgba(0, 242, 254, 0.25); }

.otp-input-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.otp-digit-input {
  width: 220px;
  height: 52px;
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid rgba(0, 242, 254, 0.4);
  border-radius: 12px;
  color: #00f2fe;
  font-family: monospace;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 10px;
  text-align: center;
  outline: none;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.1);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.otp-digit-input:focus {
  border-color: #00f2fe;
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.35);
}


/* ===================================================
   MODAL DE DIÁLOGOS Y ALERTAS ELEGANTES (HOMILOTECH)
=================================================== */
.homilo-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 1.5rem;
}

.homilo-dialog-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.homilo-dialog-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(10, 15, 30, 0.99));
  border: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.85), 0 0 35px rgba(0, 242, 254, 0.18);
  overflow: hidden;
  animation: dialogScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dialogScale {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.homilo-dialog-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.homilo-dialog-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(0, 242, 254, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.homilo-dialog-title {
  font-family: var(--font-title), sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.01em;
}

.homilo-dialog-subtitle {
  font-size: 0.74rem;
  color: var(--text-secondary, #94a3b8);
  margin: 0.15rem 0 0;
}

.homilo-dialog-close {
  position: absolute;
  right: 1.2rem;
  top: 1.2rem;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s;
}

.homilo-dialog-close:hover { color: #ffffff; }

.homilo-dialog-body {
  padding: 1.5rem;
  font-size: 0.92rem;
  color: #cbd5e1;
  line-height: 1.6;
  white-space: normal;
  word-break: break-word;
}

.homilo-dialog-body strong,
.homilo-dialog-body b {
  color: #00f2fe;
  font-weight: 700;
}

.homilo-dialog-input-group {
  padding: 0 1.5rem 1rem 1.5rem;
}

.homilo-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.25rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.homilo-dialog-footer .btn-primary,
.homilo-dialog-footer .btn-secondary {
  padding: 9px 18px;
  font-size: 0.85rem;
  min-width: 90px;
  justify-content: center;
}

/* Modificador de peligro (Rojo) */
.homilo-dialog-card.danger {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.85), 0 0 35px rgba(239, 68, 68, 0.2);
}

.homilo-dialog-card.danger .homilo-dialog-icon-badge {
  background: rgba(239, 68, 68, 0.15);
}

.homilo-dialog-card.danger .btn-primary {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border-color: #ef4444;
}
