/* ============================================
   it2go Portal · Estilos principales
   ============================================ */

:root {
  --brand: #00836F;
  --brand-dark: #006e5d;
  --brand-light: #00a085;
  --navy: #012640;
  --navy-light: #013858;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e3e6eb;
  --border-soft: #eef1f4;
  --text: #012640;
  --text-dim: #5a6b7a;
  --text-faint: #8a98a7;
  --success: #00836F;
  --warn: #f59e0b;
  --danger: #dc2626;
  --info: #0284c7;
  --purple: #7c3aed;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  position: relative;
  overflow-x: hidden;
}

.mono { font-family: 'SF Mono', Menlo, monospace; font-feature-settings: 'tnum'; }

/* ===== ANIMATED TECH MESH BACKGROUND ===== */
.bg-animation {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at top left, rgba(0, 131, 111, 0.04), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(1, 38, 64, 0.03), transparent 50%);
}

#meshCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

/* ===== LOGIN ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 1px 2px rgba(1, 38, 64, 0.04), 0 24px 60px rgba(1, 38, 64, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo-wrap { margin: 0 auto 18px; display: inline-block; }

.login-logo {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--brand), var(--navy));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(0, 131, 111, 0.35);
  position: relative;
  overflow: hidden;
}
.login-logo::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
  animation: shine 3s ease-in-out infinite;
}
@keyframes shine {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(50%, 50%); }
}

.login-logo-text {
  color: white;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.7px;
  margin-bottom: 4px;
  color: var(--navy);
}

.login-card .sub { font-size: 14px; color: var(--text-dim); }

.field { margin-bottom: 14px; }

.field input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(250, 251, 252, 0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s;
}

.field input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0, 131, 111, 0.12);
}

.checkbox-row {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0; font-size: 13px; color: var(--text-dim);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: 0 8px 20px rgba(0, 131, 111, 0.25);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0, 131, 111, 0.35); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.security-notice {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

/* ===== APP ===== */
.app { position: relative; z-index: 1; }

.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid rgba(1, 38, 64, 0.06);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }

.topbar-logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--brand), var(--navy));
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: -0.3px;
  box-shadow: 0 4px 12px rgba(0, 131, 111, 0.25);
}

.topbar-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--navy);
  letter-spacing: -0.2px;
}

.topbar-status {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulse 2s infinite;
  box-shadow: 0 0 0 0 rgba(0, 131, 111, 0.4);
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 131, 111, 0.4); }
  50% { opacity: 0.5; box-shadow: 0 0 0 6px rgba(0, 131, 111, 0); }
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.select-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}

.date-pill {
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'SF Mono', monospace;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 8px;
}

/* ===== AVATAR ===== */
.avatar-wrap {
  position: relative;
  cursor: pointer;
}

.avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand), var(--navy));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 8px rgba(1, 38, 64, 0.15);
  transition: all 0.2s;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-wrap:hover .avatar {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 131, 111, 0.3);
}

.avatar-upload-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--brand);
  border: 2px solid var(--surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: white;
  opacity: 0;
  transition: opacity 0.2s;
}

.avatar-wrap:hover .avatar-upload-icon { opacity: 1; }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { color: var(--brand); }

/* ===== MODALS ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(1, 38, 64, 0.5);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 30px 80px rgba(1, 38, 64, 0.25);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.modal .modal-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.profile-preview {
  width: 120px; height: 120px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--navy));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 42px;
  font-weight: 700;
  overflow: hidden;
  border: 4px solid var(--surface);
  box-shadow: 0 8px 24px rgba(1, 38, 64, 0.15);
}

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

.modal-actions { display: flex; gap: 10px; }

.btn-upload {
  flex: 1;
  padding: 12px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-upload:hover { background: var(--brand-dark); }

.btn-remove {
  padding: 12px 18px;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-remove:hover { color: var(--danger); border-color: var(--danger); }

.btn-close-modal {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}

/* ===== QUICK NAV ===== */
.quicknav {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(1, 38, 64, 0.06);
  padding: 0 32px;
  display: flex;
  gap: 4px;
  position: sticky;
  top: 63px;
  z-index: 99;
  overflow-x: auto;
}

.qnav-link {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}
.qnav-link:hover { color: var(--brand); }

/* ===== CONTENT ===== */
.main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 32px 60px;
}

.section {
  margin-bottom: 36px;
  scroll-margin-top: 120px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  padding: 0 4px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--navy);
}

.section-meta { font-size: 13px; color: var(--text-dim); }

/* Hero */
.hero {
  background: linear-gradient(135deg, #ffffff 0%, #f9fbfa 100%);
  border-radius: 20px;
  padding: 28px 32px;
  margin-bottom: 28px;
  box-shadow: 0 2px 8px rgba(1, 38, 64, 0.04);
  border: 1px solid rgba(0, 131, 111, 0.08);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(0, 131, 111, 0.08), transparent 70%);
  border-radius: 50%;
}

.hero > * { position: relative; z-index: 1; }

.hero-greeting {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.hero-name {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 16px;
  color: var(--navy);
}

.hero-summary {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.5;
}

.hero-summary strong { color: var(--navy); font-weight: 600; }
.hero-summary .text-brand { color: var(--brand); }

/* ===== KPIS ===== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  transition: all 0.15s;
}
.kpi:hover {
  border-color: rgba(0, 131, 111, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(1, 38, 64, 0.06);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-feature-settings: 'tnum';
  color: var(--navy);
}

.kpi-meta {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(1, 38, 64, 0.03);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--navy);
}

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

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }

table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-feature-settings: 'tnum';
}

table.t thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

table.t tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}

table.t tbody tr:last-child td { border-bottom: none; }
table.t tbody tr:hover { background: var(--surface-2); }

.text-right { text-align: right; }
.text-center { text-align: center; }

.folio {
  color: var(--brand);
  font-family: 'SF Mono', monospace;
  font-weight: 600;
  font-size: 12px;
}

.amount { font-weight: 600; font-feature-settings: 'tnum'; }
.amount-lg { font-size: 14px; font-weight: 700; color: var(--navy); }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.b-paid { background: rgba(0, 131, 111, 0.12); color: var(--brand-dark); }
.b-overdue { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.b-sent { background: rgba(2, 132, 199, 0.12); color: #075985; }
.b-void { background: rgba(100, 116, 139, 0.12); color: #475569; }
.b-brand { background: rgba(124, 58, 237, 0.12); color: #6d28d9; }
.b-brand-ms { background: rgba(2, 132, 199, 0.15); color: #0369a1; }
.b-brand-ks { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.b-brand-generic { background: rgba(100, 116, 139, 0.12); color: #475569; }

/* ===== TWO COL ===== */
.two-col {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ===== METAS ===== */
.meta-row {
  display: grid;
  grid-template-columns: 200px 1fr 80px;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.meta-row:last-child { border-bottom: none; }

.meta-label-block { font-weight: 600; color: var(--navy); }
.meta-label-block .sub {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
  margin-top: 2px;
}

.meta-progress { display: flex; align-items: center; gap: 12px; }

.meta-track {
  flex: 1;
  background: var(--border-soft);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.meta-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
}

.meta-fill.brand { background: linear-gradient(90deg, var(--brand), var(--brand-light)); }
.meta-fill.navy { background: linear-gradient(90deg, var(--navy), var(--navy-light)); }
.meta-fill.purple { background: linear-gradient(90deg, var(--purple), #a855f7); }
.meta-fill.warn { background: linear-gradient(90deg, var(--warn), #fbbf24); }

.meta-numbers {
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'SF Mono', monospace;
  white-space: nowrap;
}

.meta-pct {
  text-align: right;
  font-weight: 700;
  font-size: 14px;
}

/* ===== ALERT BAR ===== */
.alert-bar { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }

.alert-pill {
  flex: 1;
  min-width: 250px;
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 3px solid;
  box-shadow: 0 1px 3px rgba(1, 38, 64, 0.03);
}

.alert-pill.danger { border-left-color: var(--danger); }
.alert-pill.warn { border-left-color: var(--warn); }
.alert-pill.brand { border-left-color: var(--brand); }

.alert-icon { font-size: 18px; }

.alert-text { font-size: 13px; flex: 1; color: var(--text); }
.alert-text strong { font-weight: 700; color: var(--navy); }

.alert-num {
  font-weight: 700;
  font-family: 'SF Mono', monospace;
  font-size: 15px;
}

/* ===== DENSE TABLE ===== */
.dense-table th, .dense-table td {
  padding: 10px 14px;
  font-size: 12px;
}

/* ===== BUTTONS ===== */
.btn-action {
  background: var(--brand);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(0, 131, 111, 0.2);
}
.btn-action:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0, 131, 111, 0.3); }

.btn-link {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* ===== UTILITIES ===== */
.text-success, .text-brand { color: var(--brand); }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-dim { color: var(--text-dim); }
.text-purple { color: var(--purple); }
.text-navy { color: var(--navy); }
.f-w-7 { font-weight: 700; }

/* Loading spinner */
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
  padding: 24px;
  position: relative;
  z-index: 1;
}
/* ============================================
   PANEL LATERAL DE PERFIL - V2.2
   AGREGAR AL FINAL DE app.css
   ============================================ */

/* Overlay oscuro de fondo */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 38, 64, 0.4);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

/* Panel lateral derecho */
.profile-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 920px;
  background: var(--bg);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -20px 0 60px rgba(1, 38, 64, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-panel.active {
  transform: translateX(0);
}

/* Header del panel */
.profile-panel-header {
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.btn-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-back:hover {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.btn-close-x {
  width: 36px;
  height: 36px;
  background: var(--surface-2);
  border: none;
  border-radius: 50%;
  font-size: 22px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-close-x:hover {
  background: var(--danger);
  color: white;
}

/* Hero del usuario en el panel */
.profile-hero {
  padding: 28px 24px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--navy) 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  pointer-events: none;
}

.profile-hero-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: white;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  z-index: 1;
}

.profile-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-hero-info {
  flex: 1;
  z-index: 1;
}

.profile-hero-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.profile-hero-email {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 8px;
}

.profile-role-badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: white !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Cuerpo del panel: menú + contenido */
.profile-panel {
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.profile-menu {
  display: none;
}

/* En pantallas grandes, sidebar de menú a la izquierda */
@media (min-width: 768px) {
  .profile-panel {
    grid-template-rows: auto auto 1fr;
  }

  .profile-panel::after {
    content: '';
    display: grid;
  }

  .profile-content-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow: hidden;
    flex: 1;
  }
}

/* Menú interno */
.profile-menu {
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 4px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
  flex-wrap: wrap;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .profile-menu {
    border-bottom: none;
    border-right: 1px solid var(--border-soft);
    overflow-x: visible;
    flex-wrap: nowrap;
    overflow-y: auto;
    min-width: 260px;
  }

  .profile-panel {
    display: grid;
    grid-template-areas:
      "header header"
      "hero hero"
      "menu content";
    grid-template-rows: auto auto 1fr;
    grid-template-columns: 280px 1fr;
  }

  .profile-panel-header { grid-area: header; }
  .profile-hero { grid-area: hero; }
  .profile-menu { grid-area: menu; }
  .profile-content { grid-area: content; }
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  white-space: nowrap;
  transition: all 0.15s;
}

.profile-menu-item:hover {
  background: var(--surface-2);
  color: var(--brand);
}

.profile-menu-item.active {
  background: linear-gradient(135deg, rgba(0, 131, 111, 0.12), rgba(0, 131, 111, 0.04));
  color: var(--brand);
}

.profile-menu-item.active::before {
  content: '';
  display: none;
}

@media (min-width: 768px) {
  .profile-menu-item.active {
    border-left: 3px solid var(--brand);
    padding-left: 13px;
  }
}

.profile-menu-item .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.profile-menu-item.logout {
  color: var(--danger);
}

.profile-menu-item.logout:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

/* Contenido scrollable */
.profile-content {
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--bg);
}

.profile-section h3 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--navy);
  margin-bottom: 6px;
}

.profile-section-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.profile-photo-preview {
  width: 140px;
  height: 140px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--navy));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 48px;
  font-weight: 700;
  overflow: hidden;
  border: 4px solid var(--surface);
  box-shadow: 0 8px 24px rgba(1, 38, 64, 0.15);
}

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

.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.profile-actions .btn-upload {
  flex: 1;
  min-width: 180px;
}

/* Form grid para usuarios */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* Card del formulario de usuario */
.user-form-card {
  margin-top: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(1, 38, 64, 0.04);
}

.user-form-card h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
}

/* Sync info card */
.sync-info-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.sync-info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
}

.sync-info-row:last-child { border-bottom: none; }
.sync-info-row span { color: var(--text-dim); }
.sync-info-row strong { color: var(--navy); }

/* Filtro de período */
.periodo-filter {
  display: flex;
  gap: 6px;
  align-items: center;
}

.periodo-filter .select-input {
  font-weight: 600;
}

/* Banner de período */
.periodo-banner {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.25);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--info);
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.periodo-banner strong { color: var(--navy); }

/* Header dentro del modal de metas (re-usado en panel) */
.metas-modal-header {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}

.metas-modal-header > .year-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metas-modal-header > .year-selector label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
}

.metas-modal-header > .year-selector select {
  font-weight: 700;
  font-size: 15px;
  padding: 8px 14px;
  min-width: 110px;
}

.metas-modal-header > .quick-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Tabs metas */
.meta-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 16px;
}

.meta-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  border-radius: 9px;
  transition: all 0.2s;
}

.meta-tab.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: 0 2px 6px rgba(1, 38, 64, 0.08);
}

/* Tabla de metas */
.metas-table-wrap {
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface);
}

.metas-table {
  width: 100%;
  border-collapse: collapse;
}

.metas-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  text-align: left;
  z-index: 1;
}

.metas-table thead th.text-right { text-align: right; }

.metas-table tbody td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.metas-table tbody td:first-child {
  font-size: 13px;
  color: var(--navy);
  font-weight: 600;
}

.metas-table tbody tr.mes-actual td:first-child::before {
  content: '●';
  color: var(--brand);
  margin-right: 6px;
}

.metas-table tbody tr.mes-actual {
  background: rgba(0, 131, 111, 0.04);
}

.metas-table tbody tr:hover { background: var(--surface-2); }

.metas-table .total-row {
  background: linear-gradient(180deg, rgba(0, 131, 111, 0.08), rgba(0, 131, 111, 0.03));
  font-weight: 700;
  border-top: 2px solid var(--brand);
}

.metas-table .total-row td {
  padding: 14px 16px;
  color: var(--navy);
  font-size: 14px;
}

.meta-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'SF Mono', monospace;
  text-align: right;
  font-feature-settings: 'tnum';
  color: var(--navy);
  font-weight: 600;
  transition: all 0.15s;
}

.meta-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0, 131, 111, 0.12);
}

.meta-input::-webkit-outer-spin-button,
.meta-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Form labels */
.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.field input,
.field select,
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}

.field input:focus,
.field select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 131, 111, 0.12);
}

.field input:disabled {
  background: var(--border-soft);
  color: var(--text-faint);
  cursor: not-allowed;
}

/* Móvil */
@media (max-width: 767px) {
  .profile-hero {
    padding: 20px;
  }
  .profile-hero-avatar {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }
  .profile-hero-name {
    font-size: 18px;
  }
  .profile-content {
    padding: 20px;
  }
  .profile-menu {
    flex-direction: row;
    overflow-x: auto;
  }
  .profile-menu-item {
    flex-shrink: 0;
  }
}
.tabla-excel-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.tabla-excel {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-feature-settings: 'tnum';
  min-width: 1100px;
}

.tabla-excel thead th {
  background: #2563eb;
  color: white;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  border: 1px solid #1e40af;
  white-space: nowrap;
}

.tabla-excel thead th.th-trim {
  background: #1e3a8a;
}

.tabla-excel tbody td {
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  text-align: right;
  white-space: nowrap;
  font-family: 'SF Mono', monospace;
}

.tabla-excel tbody td.col-mes {
  text-align: left;
  font-weight: 700;
  color: var(--navy);
  font-family: 'Inter', sans-serif;
  background: var(--surface-2);
}

.tabla-excel tbody td.col-mes.q1 { border-left: 4px solid #00836F; }
.tabla-excel tbody td.col-mes.q2 { border-left: 4px solid #2563eb; }
.tabla-excel tbody td.col-mes.q3 { border-left: 4px solid #7c3aed; }
.tabla-excel tbody td.col-mes.q4 { border-left: 4px solid #f59e0b; }

.tabla-excel tbody tr.mes-actual td.col-mes::before {
  content: '●';
  color: var(--brand);
  margin-right: 6px;
}

.tabla-excel tbody tr.mes-actual {
  background: rgba(0, 131, 111, 0.04);
}

.tabla-excel tbody tr.row-total {
  background: linear-gradient(180deg, #f0fdf4, #dcfce7);
  font-weight: 700;
  color: var(--navy);
  border-top: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
}

.tabla-excel tbody tr.row-total td {
  padding: 10px;
  font-size: 13px;
}

.tabla-excel .celda-input {
  width: 100%;
  min-width: 100px;
  border: none;
  background: transparent;
  font-family: 'SF Mono', monospace;
  font-size: 12px;
  text-align: right;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--navy);
  font-weight: 600;
}

.tabla-excel .celda-input.ppto {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.tabla-excel .celda-input.cm {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.tabla-excel .celda-input:focus {
  outline: 2px solid var(--brand);
  background: var(--surface);
}

.tabla-excel .celda-readonly {
  background: var(--surface);
  color: var(--text);
}

.tabla-excel .celda-readonly.suma {
  font-weight: 700;
  color: var(--navy);
  background: rgba(2, 132, 199, 0.05);
}

.tabla-excel .celda-trim {
  background: rgba(124, 58, 237, 0.06);
  font-weight: 600;
  color: var(--navy);
  vertical-align: middle;
  text-align: right;
}


/* ============================================
   V2.3 - TABLA EXCEL DE PRESUPUESTOS
   AGREGAR AL FINAL DE app.css
   ============================================ */

.tabla-excel-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.tabla-excel {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-feature-settings: 'tnum';
  min-width: 1100px;
}

.tabla-excel thead th {
  background: #2563eb;
  color: white;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  border: 1px solid #1e40af;
  white-space: nowrap;
}

.tabla-excel thead th.th-trim {
  background: #1e3a8a;
}

.tabla-excel tbody td {
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  text-align: right;
  white-space: nowrap;
  font-family: 'SF Mono', monospace;
}

.tabla-excel tbody td.col-mes {
  text-align: left;
  font-weight: 700;
  color: var(--navy);
  font-family: 'Inter', sans-serif;
  background: var(--surface-2);
}

.tabla-excel tbody td.col-mes.q1 { border-left: 4px solid #00836F; }
.tabla-excel tbody td.col-mes.q2 { border-left: 4px solid #2563eb; }
.tabla-excel tbody td.col-mes.q3 { border-left: 4px solid #7c3aed; }
.tabla-excel tbody td.col-mes.q4 { border-left: 4px solid #f59e0b; }

.tabla-excel tbody tr.mes-actual td.col-mes::before {
  content: '●';
  color: var(--brand);
  margin-right: 6px;
}

.tabla-excel tbody tr.mes-actual {
  background: rgba(0, 131, 111, 0.04);
}

.tabla-excel tbody tr.row-total {
  background: linear-gradient(180deg, #f0fdf4, #dcfce7);
  font-weight: 700;
  color: var(--navy);
  border-top: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
}

.tabla-excel tbody tr.row-total td {
  padding: 10px;
  font-size: 13px;
}

.tabla-excel .celda-input {
  width: 100%;
  min-width: 100px;
  border: none;
  background: transparent;
  font-family: 'SF Mono', monospace;
  font-size: 12px;
  text-align: right;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--navy);
  font-weight: 600;
}

.tabla-excel .celda-input.ppto {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.tabla-excel .celda-input.cm {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.tabla-excel .celda-input:focus {
  outline: 2px solid var(--brand);
  background: var(--surface);
}

.tabla-excel .celda-readonly {
  background: var(--surface);
  color: var(--text);
}

.tabla-excel .celda-readonly.suma {
  font-weight: 700;
  color: var(--navy);
  background: rgba(2, 132, 199, 0.05);
}

.tabla-excel .celda-trim {
  background: rgba(124, 58, 237, 0.06);
  font-weight: 600;
  color: var(--navy);
  vertical-align: middle;
  text-align: right;
}

/* ============================================
   V2.3 - LOGO OFICIAL it2go
   ============================================ */
.topbar-logo {
  display: flex;
  align-items: center;
}
.topbar-logo-img {
  height: 38px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  display: block;
}
.topbar-logo-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.5px;
}


/* ============================================
   IT2GO id - Estilos específicos del portal
   ============================================ */

/* ── SIDEBAR ── */
#sidebar {
  width: 240px; min-height: 100vh;
  background: var(--navy);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200; transition: width .25s;
}
.sb-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
}
.sb-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--navy-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,131,111,.3);
}
.sb-brand-text { color: #fff; font-size: 15px; font-weight: 700; line-height: 1.2; }
.sb-brand-sub  { color: rgba(255,255,255,.35); font-size: 10px; }
.sb-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sb-section {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.25);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 14px 8px 6px;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  color: rgba(255,255,255,.55); font-size: 13px;
  transition: all .15s; margin-bottom: 1px; text-decoration: none;
}
.sb-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }
.sb-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.sb-item i { font-size: 17px; flex-shrink: 0; }
.sb-item .badge-count {
  margin-left: auto; background: rgba(255,255,255,.15);
  color: #fff; font-size: 10px; padding: 1px 7px; border-radius: 10px;
}
.sb-footer {
  padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.07);
}
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  transition: background .15s;
}
.sb-user:hover { background: rgba(255,255,255,.07); }
.sb-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sb-user-name  { color: #fff; font-size: 12px; font-weight: 500; }
.sb-user-plan  { color: rgba(255,255,255,.35); font-size: 11px; }

/* ── APP LAYOUT ── */
#app-wrap { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
#topbar-id {
  height: 54px; background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center;
  padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 100;
}
.tb-credits {
  flex: 1; display: flex; align-items: center;
  justify-content: center; gap: 8px;
  font-size: 13px; color: var(--text-dim);
}
.tb-credits strong { color: var(--navy); font-weight: 600; }
.tb-upgrade {
  background: var(--brand); color: #fff; border: none;
  padding: 6px 16px; border-radius: 20px; font-size: 12px;
  font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.tb-upgrade:hover { background: var(--brand-dark); }
.tb-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg,var(--brand),var(--navy));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(1,38,64,.15);
}

/* ── SECTIONS ── */
.id-section { display: none; flex-direction: column; flex: 1; }
.id-section.active { display: flex; }
#sec-historial, #sec-plan, #sec-admin { padding: 28px 32px; }
.sec-header { margin-bottom: 22px; }
.sec-header h1 { font-size: 22px; font-weight: 700; color: var(--navy); letter-spacing: -.3px; }
.sec-header p  { font-size: 13px; color: var(--text-faint); margin-top: 3px; }

/* ── BÚSQUEDA ── */
#sec-busqueda {
  background: var(--surface); flex: 1;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 60px 32px 50px;
  border-bottom: 1px solid var(--border-soft);
}
.search-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.search-logo .sb-logo { width: 44px; height: 44px; border-radius: 12px; font-size: 16px; }
.search-logo span { font-size: 30px; font-weight: 800; color: var(--navy); letter-spacing: -.5px; }
.search-logo span em { color: var(--brand); font-style: normal; }
.search-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }
.search-box-wrap { width: 100%; max-width: 620px; }
.search-field {
  width: 100%; height: 54px; border-radius: 12px;
  background: var(--bg); border: 1.5px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
  margin-bottom: 12px; transition: border .15s, box-shadow .15s;
}
.search-field:focus-within {
  border-color: var(--brand); background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0,131,111,.1);
}
.search-field input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px; font-family: inherit;
  text-transform: uppercase;
}
.search-field input::placeholder { color: var(--text-faint); text-transform: none; }
.tipo-pill {
  padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 700;
  display: none;
}
.tipo-rfc  { background: rgba(2,132,199,.12); color: #075985; }
.tipo-curp { background: rgba(124,58,237,.12); color: #6d28d9; }
.tipo-nss  { background: rgba(0,131,111,.12); color: var(--brand-dark); }
.btn-consultar {
  width: 100%; height: 50px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; border: none; font-size: 14px; font-weight: 700;
  letter-spacing: .5px; cursor: pointer; font-family: inherit;
  transition: all .15s; box-shadow: 0 8px 20px rgba(0,131,111,.25);
}
.btn-consultar:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,131,111,.35); }
.btn-consultar:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.search-hints { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.hint-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim); cursor: pointer; background: var(--surface);
  transition: all .15s;
}
.hint-chip:hover { border-color: var(--brand); color: var(--brand); background: rgba(0,131,111,.06); }

/* ── RESULTADO ── */
.result-wrap {
  background: var(--surface); border-radius: 14px;
  border: 1px solid var(--border-soft); overflow: hidden;
  margin: 20px 32px 28px;
  box-shadow: 0 2px 8px rgba(1,38,64,.04);
}
.result-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.result-head h3 {
  font-size: 14px; font-weight: 600; color: var(--navy);
  display: flex; align-items: center; gap: 8px;
}
.result-body { padding: 20px; }
.data-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 10px; margin-bottom: 16px; }
.data-cell { background: var(--bg); border-radius: 8px; border: 1px solid var(--border-soft); padding: 12px 14px; }
.data-cell.wide { grid-column: span 2; }
.data-label { font-size: 10px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.data-val { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.data-val.mono { font-family: 'SF Mono',monospace; font-size: 12px; }
@media(max-width:560px){ .data-cell.wide{ grid-column: span 1; } }
.section-label {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .7px;
  display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
}
.check-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 8px;
}
.check-icon {
  width: 32px; height: 32px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.check-icon.ok  { background: rgba(0,131,111,.1); color: var(--brand); }
.check-icon.err { background: rgba(220,38,38,.1); color: var(--danger); }
.check-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.check-sub   { font-size: 11px; color: var(--text-dim); }

/* ── ADMIN TABS ── */
.admin-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.atab {
  padding: 7px 18px; border-radius: 20px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); transition: all .12s; font-family: inherit;
}
.atab:hover { background: var(--bg); color: var(--text); }
.atab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── PLAN SELECTOR ── */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 8px; margin-bottom: 12px; }
.plan-option {
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px 10px; cursor: pointer; transition: all .15s;
  background: var(--surface); text-align: center;
}
.plan-option:hover { border-color: var(--brand); background: rgba(0,131,111,.04); }
.plan-option.selected {
  border-color: var(--brand); background: rgba(0,131,111,.07);
  box-shadow: 0 0 0 3px rgba(0,131,111,.15);
}
.plan-name  { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 3px; }
.plan-cons  { font-size: 11px; color: var(--text-dim); }
.plan-price { font-size: 12px; font-weight: 700; color: var(--brand); margin-top: 5px; }

/* ── MODAL ── */
.id-overlay {
  position: fixed; inset: 0; background: rgba(1,38,64,.45);
  z-index: 400; display: none; align-items: center;
  justify-content: center; padding: 20px;
  backdrop-filter: blur(4px);
}
.id-overlay.open { display: flex; }
.id-modal {
  background: var(--surface); border-radius: 20px;
  width: 100%; max-width: 620px; max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(1,38,64,.25);
  animation: modalIn .22s ease;
}
.id-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.id-modal-head h3 { font-size: 15px; font-weight: 700; color: var(--navy); }
.id-modal-body { padding: 22px; }

/* ── ALERTS ── */
.id-alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; display: none; }
.id-alert.ok   { background: rgba(0,131,111,.1); color: #065f46; display: block; }
.id-alert.err  { background: rgba(220,38,38,.1); color: #991b1b; display: block; }
.id-alert.warn { background: rgba(245,158,11,.1); color: #92400e; display: block; }

/* ── LOADING ── */
.id-loading { text-align: center; padding: 48px; color: var(--text-faint); font-size: 15px; }
.spin { animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PROGRESS BAR ── */
.prog-bar { background: var(--border-soft); border-radius: 99px; height: 7px; }
.prog-fill { background: linear-gradient(90deg, var(--brand), var(--brand-light)); height: 100%; border-radius: 99px; transition: width .4s; }
.prog-fill.warn { background: linear-gradient(90deg, var(--warn), #fbbf24); }
.prog-fill.danger { background: linear-gradient(90deg, var(--danger), #ef4444); }

/* ── DROPDOWN MENÚ ── */
.tb-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; min-width: 220px;
  box-shadow: 0 8px 32px rgba(1,38,64,.12); z-index: 200;
  overflow: hidden; display: none;
}
.tb-menu.open { display: block; }
.tb-menu-head {
  background: var(--navy); padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
}
.tb-menu-av { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; }
.tb-menu-name { color: #fff; font-size: 13px; font-weight: 600; }
.tb-menu-email { color: rgba(255,255,255,.5); font-size: 11px; }
.tb-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--text-dim); font-size: 13px;
  cursor: pointer; transition: background .12s; border: none;
  background: none; width: 100%; font-family: inherit; text-align: left;
}
.tb-menu-item:hover { background: var(--bg); color: var(--text); }
.tb-menu-item.danger { color: var(--danger); }
.tb-menu-sep { height: 1px; background: var(--border-soft); margin: 4px 0; }

/* ── TABLE ── */
.id-table-wrap { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; overflow: auto; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(1,38,64,.04); }
.id-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.id-table thead tr { background: var(--navy); }
.id-table thead th { padding: 11px 16px; color: rgba(255,255,255,.8); font-weight: 500; text-align: left; font-size: 12px; white-space: nowrap; }
.id-table tbody tr { border-bottom: 1px solid var(--border-soft); transition: background .1s; }
.id-table tbody tr:last-child { border-bottom: none; }
.id-table tbody tr:hover { background: rgba(0,131,111,.03); }
.id-table tbody td { padding: 11px 16px; color: var(--text); vertical-align: middle; }
.td-mono { font-family: 'SF Mono',monospace; font-size: 12px; color: var(--navy); font-weight: 600; }
.td-empty { text-align: center; color: var(--text-faint); padding: 36px !important; }

/* ── PAGINACIÓN ── */
.id-pages { display: flex; gap: 4px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pg-btn {
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: 6px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all .12s;
}
.pg-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pg-btn:hover:not(.active) { background: var(--bg); }

/* ── KPI ADMIN ── */
.id-kpis { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 12px; margin-bottom: 24px; }
.id-kpi { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; padding: 16px; box-shadow: 0 1px 4px rgba(1,38,64,.04); transition: all .15s; }
.id-kpi:hover { border-color: rgba(0,131,111,.3); transform: translateY(-2px); }
.id-kpi-label { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.id-kpi-value { font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: -.5px; }
.id-kpi-value.brand { color: var(--brand); }

/* ── TOOLBAR ── */
.id-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.id-search {
  flex: 1; min-width: 200px; height: 38px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); display: flex; align-items: center;
  padding: 0 12px; gap: 8px;
}
.id-search input { flex: 1; border: none; outline: none; font-size: 13px; font-family: inherit; color: var(--text); background: none; }
.id-search i { font-size: 15px; color: var(--text-faint); }
.btn-sm {
  height: 36px; padding: 0 14px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text-dim);
  font-size: 12px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-family: inherit;
  transition: all .12s; white-space: nowrap;
}
.btn-sm:hover { background: var(--bg); color: var(--text); }
.btn-sm.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-sm.primary:hover { background: var(--brand-dark); }
.btn-sm.danger { color: var(--danger); border-color: rgba(220,38,38,.3); }
.btn-sm.danger:hover { background: rgba(220,38,38,.06); }

/* ── RESPONSIVE ── */
@media(max-width:768px){
  #sidebar { width: 60px; }
  .sb-brand-text,.sb-brand-sub,.sb-item span,.sb-section,.sb-user-name,.sb-user-plan { display: none; }
  .sb-item { justify-content: center; }
  #app-wrap { margin-left: 60px; }
  #sec-busqueda { padding: 40px 16px; }
  .result-wrap { margin: 16px; }
  #sec-historial, #sec-plan, #sec-admin { padding: 20px 16px; }
}

/* ── FIX LAYOUT PANTALLA COMPLETA ── */
#view-app { display: flex !important; flex-direction: row; min-height: 100vh; }
#app-wrap  { flex: 1; display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }
#sec-busqueda {
  flex: 1 !important;
  min-height: calc(100vh - 54px) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}
.id-section { min-height: calc(100vh - 54px); }
.id-section.active { display: flex !important; flex-direction: column; flex: 1; }
#sec-historial.active, #sec-plan.active, #sec-admin.active { display: block !important; }

/* Fix topbar solo visible logueado */
#view-app { display: none; }
#view-app[style*='flex'] #topbar-id,
#view-app[style*='block'] #topbar-id { display: flex; }
