/* Victoria 365 - Opticas Victoria Lens
   Paleta extraida de la imagen de referencia del dashboard. */
:root {
  --primary-top: #B0014C;
  --primary-bottom: #6C0135;
  --primary: #A6134B;
  --primary-dark: #7A0D38;
  --primary-light: #FFE7F5;
  --pill-bg: #FFD5F1;
  --bg: #F6F6F8;
  --card: #FFFFFF;
  --text: #29242A;
  --muted: #767180;
  --border: #ECE7EC;
  --success-bg: #E6F9EA;
  --success-text: #147D29;
  --warning-bg: #FFF4E5;
  --warning-text: #B45309;
  --info-bg: #E7F1FC;
  --info-text: #1971C2;
  --pagos-card-bg: #FAE9F1;
  --shadow: 0 2px 10px rgba(108, 1, 53, 0.06);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; }
img { max-width: 100%; }

/* ===================== Layout ===================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  background: linear-gradient(180deg, var(--primary-top) 0%, var(--primary-bottom) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 18px;
}
.sidebar-logo .logo-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--primary);
  flex-shrink: 0;
}
.sidebar-logo .logo-text { line-height: 1.15; }
.sidebar-logo .logo-text small { display: block; font-size: 10px; letter-spacing: .12em; opacity: .85; }
.sidebar-logo .logo-text strong { font-size: 17px; font-style: italic; }

.sidebar-badge {
  text-align: center;
  font-size: 11px;
  letter-spacing: .15em;
  font-weight: 700;
  padding: 8px 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.18);
  margin-bottom: 10px;
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: .92;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.12); }
.sidebar-nav a.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  opacity: 1;
}
.sidebar-nav .icon { width: 18px; text-align: center; }

.sidebar-footer {
  margin-top: 14px;
  padding-top: 14px;
}
.sidebar-footer .promo-box {
  background: rgba(255,255,255,.10);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  margin-bottom: 12px;
}
.sidebar-footer .promo-box strong { display: block; font-size: 13px; letter-spacing: .08em; }
.sidebar-footer .promo-box span { font-size: 11px; opacity: .8; }
.sidebar-footer .version { text-align: center; font-size: 11px; opacity: .6; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 32px 10px;
  flex-wrap: wrap;
}
.topbar h1 { font-size: 22px; letter-spacing: .01em; }
.topbar-right { display: flex; align-items: center; gap: 18px; }

.notif-bell { position: relative; font-size: 20px; color: var(--text); }
.notif-bell .badge-count {
  position: absolute; top: -6px; right: -8px;
  background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 50%; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
}

.user-chip { display: flex; align-items: center; gap: 10px; cursor: default; }
.user-chip .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #ddd; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #888; overflow: hidden;
}
.user-chip .name { font-weight: 600; font-size: 13.5px; }
.user-chip .sub { font-size: 11.5px; color: var(--muted); }

.content { padding: 10px 32px 40px; flex: 1; }

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .06em;
  padding: 18px;
  text-transform: uppercase;
}

/* ===================== Search box ===================== */
.search-box {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
  border-radius: var(--radius);
  padding: 8px 10px;
  box-shadow: var(--shadow);
  max-width: 620px;
  margin: 14px 0 22px;
}
.search-box select, .search-box input[type=text], .search-box input[type=search] {
  border: none; outline: none; font-size: 14px; background: transparent; padding: 8px;
}
.search-box select { border-right: 1px solid var(--border); border-radius: 0; }
.search-box input { flex: 1; }

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; border-radius: 9px; padding: 10px 18px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--primary); padding: 6px 10px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn-success { background: var(--success-text); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ===================== Cards / grid ===================== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===================== Badges / pills ===================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 4px 10px;
  border-radius: 20px; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-neutral { background: #EFEDF0; color: var(--muted); }

.pill {
  background: var(--pill-bg); color: var(--primary);
  font-weight: 800; font-size: 13px;
  padding: 6px 16px; border-radius: 8px; display: inline-block;
}

/* ===================== Perfil de afiliado ===================== */
.profile-header {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 24px;
  display: grid;
  grid-template-columns: auto 1.4fr 1fr 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 20px;
}
@media (max-width: 1200px) {
  .profile-header { grid-template-columns: 1fr; }
}
.profile-avatar {
  width: 84px; height: 84px; border-radius: 50%;
  background: #eee; object-fit: cover;
  display: flex; align-items: center; justify-content: center; font-size: 30px; color: #aaa;
}
.profile-name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.profile-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.profile-detail-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 6px; color: #4a444d; }
.profile-detail-row .icon { color: var(--primary); width: 16px; }

.info-list .info-item { display: flex; align-items: flex-start; gap: 8px; font-size: 12.8px; margin-bottom: 10px; color: #4a444d; }
.info-list .info-item .icon { color: var(--primary); margin-top: 1px; }
.info-list .info-item strong { display: block; font-weight: 600; color: var(--text); }

.pagos-card {
  background: var(--pagos-card-bg);
  border-radius: var(--radius);
  padding: 18px;
}
.pagos-card .estado-title { color: var(--primary); font-weight: 700; font-size: 12px; text-transform: uppercase; margin-bottom: 8px; }
.pagos-card .estado-value { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; color: var(--success-text); margin-bottom: 12px; }
.pagos-card .estado-row { font-size: 12.5px; margin-bottom: 4px; color: #4a444d; }
.pagos-card .estado-row strong { display: block; color: var(--text); }

/* ===================== Listas de beneficios ===================== */
.benefit-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.benefit-row:last-of-type { border-bottom: none; }
.benefit-icon {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.benefit-info { flex: 1; min-width: 0; }
.benefit-info strong { display: block; font-size: 13px; }
.benefit-info span { font-size: 11.5px; color: var(--muted); }
.benefit-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* Timeline (historial de beneficios) */
.timeline { position: relative; padding-left: 6px; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 18px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-check {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--success-bg); color: var(--success-text);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px;
}
.timeline-body strong { display: block; font-size: 13px; }
.timeline-body span { display: block; font-size: 11.5px; color: var(--muted); }

/* ===================== Tablas ===================== */
table.table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.table th {
  text-align: left; color: var(--muted); font-weight: 600;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em;
  padding: 8px 6px; border-bottom: 1px solid var(--border);
}
table.table td { padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.table tr:last-child td { border-bottom: none; }

/* ===================== Familiares ===================== */
.family-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.family-row:last-of-type { border-bottom: none; }
.family-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.family-info { flex: 1; min-width: 0; }
.family-info strong { display: block; font-size: 13px; }
.family-info span { font-size: 11.5px; color: var(--muted); }

/* ===================== Forms ===================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: #4a444d; }
.form-group .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13.5px; background: #fff; font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); }
.form-control.is-invalid { border-color: #d64545; }
.field-error { color: #d64545; font-size: 11.5px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
.required-mark { color: var(--primary); }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: #FDEAEA; color: #B4232C; }
.alert-info { background: var(--info-bg); color: var(--info-text); }

/* ===================== Wizard (Nueva Afiliacion) ===================== */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 24px; }
.wizard-step {
  flex: 1; text-align: center; padding: 10px; border-radius: 8px;
  background: #EFEDF0; color: var(--muted); font-size: 12px; font-weight: 700;
}
.wizard-step.active { background: var(--primary); color: #fff; }
.wizard-step.done { background: var(--success-bg); color: var(--success-text); }
.wizard-card { max-width: 640px; margin: 0 auto; }

.upload-box {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 30px; text-align: center; color: var(--muted); cursor: pointer;
}
.upload-box:hover { border-color: var(--primary); color: var(--primary); }
.upload-preview { max-width: 100%; max-height: 340px; border-radius: 10px; margin-top: 12px; }

.plan-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.plan-pick-card {
  border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer;
}
.plan-pick-card.selected { border-color: var(--primary); background: var(--primary-light); }
.plan-pick-card h4 { color: var(--primary); font-size: 13px; margin-bottom: 4px; }
.plan-pick-card .price { font-weight: 700; font-size: 16px; margin: 6px 0; }
.plan-pick-card .price small { font-size: 11px; color: var(--muted); font-weight: 400; }

.qr-box { text-align: center; padding: 20px; }
.qr-box img { width: 220px; height: 220px; border: 1px solid var(--border); border-radius: 10px; }

/* ===================== Login ===================== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--primary-top), var(--primary-bottom));
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.login-card .logo-mark { width: 56px; height: 56px; border-radius: 14px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 800; margin: 0 auto 14px; font-size: 22px; }
.login-card h1 { text-align: center; font-size: 18px; margin-bottom: 4px; }
.login-card p.subtitle { text-align: center; color: var(--muted); font-size: 12.5px; margin-bottom: 24px; }

/* ===================== Error pages ===================== */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.error-box { text-align: center; }
.error-box h1 { font-size: 64px; color: var(--primary); }

/* ===================== Stat tiles / dashboard Inicio ===================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }

.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-tile .stat-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.stat-tile .stat-value { font-size: 30px; font-weight: 700; font-variant-numeric: proportional-nums; color: var(--text); line-height: 1.1; }
.stat-tile .stat-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; margin-top: 8px; }
.stat-tile .stat-delta.up { color: var(--success-text); }
.stat-tile .stat-delta.down { color: #B4232C; }
.stat-tile .stat-delta.flat { color: var(--muted); }

.stat-tile.tile-warning { border-color: #F3D2B0; background: var(--warning-bg); }
.stat-tile.tile-warning .stat-label { color: var(--warning-text); }
.stat-tile.tile-warning .stat-value { color: var(--warning-text); }

.stat-tile.tile-danger { border-color: #F5C2C2; background: #FDEAEA; }
.stat-tile.tile-danger .stat-label { color: #B4232C; }
.stat-tile.tile-danger .stat-value { color: #B4232C; }

/* Hero money tile ("comisión ganada") */
.money-tile {
  border-radius: var(--radius);
  padding: 28px;
  background: linear-gradient(135deg, var(--primary-top), var(--primary-bottom));
  color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.money-tile .money-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; flex-shrink: 0;
}
.money-tile .money-body { flex: 1; min-width: 200px; }
.money-tile .money-label { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .85; margin-bottom: 6px; }
.money-tile .money-value { font-size: 40px; font-weight: 800; font-variant-numeric: proportional-nums; line-height: 1.05; }
.money-tile .money-sub { font-size: 12.5px; opacity: .9; margin-top: 8px; }
.money-tile .money-badge { background: rgba(255,255,255,.2); border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 700; display: inline-block; margin-top: 10px; }

/* Segmented control (filtro de periodo) */
.segmented { display: inline-flex; background: #EFEDF0; border-radius: 9px; padding: 3px; gap: 2px; }
.segmented a {
  padding: 7px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); text-decoration: none;
}
.segmented a.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ===================== Utilidades ===================== */
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.link-more { font-size: 12.5px; font-weight: 600; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 20px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
