/* ============================================================
   Gestor AFORE — Tema "Compass": vivido-pastel + iconos lineales
   ============================================================ */
:root {
  /* Paleta vivido-pastel */
  --blue:      #4a9df8;
  --blue-dark: #3b8de8;
  --blue-soft: #e8f2fe;
  --green:     #3ecf8e;
  --green-deep:#1f9d63;
  --green-soft:#e3f8ee;
  --orange:    #ffa94d;
  --orange-deep:#dd8312;
  --orange-soft:#fff1e0;
  --purple:    #a78bfa;
  --purple-soft:#f1ecfe;
  --pink:      #ff8fab;
  --pink-deep: #e0526a;
  --pink-soft: #ffe9ee;
  --amber:     #f5b53f;
  --amber-deep:#c98d0a;
  --amber-soft:#fff3dd;

  /* Estructura */
  --bg:           #f3f6fb;
  --bg-sidebar:   #ffffff;
  --bg-hover:     #f2f5fa;
  --bg-card:      #ffffff;
  --border:       #e8ecf3;
  --border-strong:#d5dce8;
  --text:         #3a4150;
  --text-muted:   #8a93a5;
  --text-faint:   #aab2c2;
  --accent:       var(--blue);
  --accent-soft:  var(--blue-soft);
  --radius: 12px;
  --shadow: 0 2px 10px rgba(70, 90, 130, 0.06);
  --shadow-lg: 0 10px 34px rgba(70, 90, 130, 0.12);
}

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

html, body {
  height: 100%;
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14.5px;
  line-height: 1.5;
}

.hidden { display: none !important; }
code { background: var(--bg-hover); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* Iconos lineales */
.ico { flex-shrink: 0; vertical-align: -2.5px; }
.nav-item .ico, .sidebar-footer .ico { color: var(--text-muted); }
.nav-item.active .ico { color: var(--blue); }
.ico-inline { display: inline-flex; margin-right: 4px; color: var(--text-muted); }

/* ============ LOGIN ============ */
#login-screen {
  height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f2fe 0%, #f1ecfe 50%, #e3f8ee 100%);
}
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 42px 38px;
  width: 370px;
  text-align: center;
}
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.3px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin: 4px 0 24px; }
.login-card form { text-align: left; display: flex; flex-direction: column; gap: 8px; }
.login-card label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.login-card input {
  border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 9px 12px; font-size: 14px; font-family: inherit; color: var(--text);
}
.login-card input:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.login-hint { margin-top: 14px; font-size: 12px; color: var(--text-faint); }
.login-error { color: var(--pink-deep); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ============ LAYOUT ============ */
#app { display: flex; height: 100vh; overflow: hidden; }

#sidebar {
  width: 236px; min-width: 236px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 12px;
}
.sidebar-user {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; padding: 8px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px;
  box-shadow: 0 4px 12px rgba(122, 90, 248, 0.3);
}
.sidebar-user-name { font-weight: 700; font-size: 14.5px; }
.sidebar-user-plan { font-size: 11.5px; color: var(--text-faint); }

.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px;
  color: var(--text-faint); text-transform: uppercase;
  padding: 4px 12px 6px;
}
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  background: none; border: none; cursor: pointer;
  text-align: left; font-size: 13.8px; color: var(--text);
  padding: 8px 12px; border-radius: 9px; width: 100%;
  font-family: inherit; font-weight: 500;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--blue-soft); color: var(--blue-dark); font-weight: 600; }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; }

#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Topbar azul estilo Compass */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  height: 60px;
  background: linear-gradient(90deg, var(--blue) 0%, #5fb0ff 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(74, 157, 248, 0.35);
  z-index: 5;
}
#page-title { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar-actions input {
  border: none;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 20px; padding: 8px 16px;
  font-size: 13.5px; width: 240px; font-family: inherit;
  color: #fff;
}
.topbar-actions input::placeholder { color: rgba(255, 255, 255, 0.75); }
.topbar-actions input:focus { outline: 2px solid rgba(255,255,255,0.45); }

.bell-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.18); border: none; cursor: pointer;
  font-size: 15px; padding: 7px 9px; border-radius: 50%;
  line-height: 1; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.bell-btn:hover { background: rgba(255, 255, 255, 0.3); }
.badge {
  position: absolute; top: -3px; right: -4px;
  background: var(--pink-deep); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid #fff;
}

#view { flex: 1; overflow-y: auto; padding: 24px 28px 60px; }

/* ============ COMPONENTES ============ */
.btn-primary {
  background: var(--blue); color: #fff; border: none;
  border-radius: 9px; padding: 8px 16px;
  font-size: 13.8px; font-weight: 600; cursor: pointer; font-family: inherit;
  box-shadow: 0 3px 8px rgba(74, 157, 248, 0.3);
  transition: transform .08s ease, background .15s ease;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:active { transform: scale(0.97); }
.btn-block { width: 100%; margin-top: 10px; padding: 10px; }

.btn-ghost {
  background: #fff; border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 6px 13px;
  font-size: 13px; cursor: pointer; color: var(--text); font-family: inherit;
}
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { color: var(--pink-deep); }

/* Stats con barra de progreso pastel */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 14px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.stat-sub { font-size: 12px; color: var(--text-faint); margin: 4px 0 10px; }
.stat-bar { height: 5px; background: var(--bg-hover); border-radius: 20px; overflow: hidden; }
.stat-bar > div { height: 100%; border-radius: 20px; transition: width .5s ease; }
.c-blue   { background: var(--blue); }
.c-green  { background: var(--green); }
.c-orange { background: var(--orange); }
.c-purple { background: var(--purple); }
.c-pink   { background: var(--pink); }

/* Tablas */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.notion-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.notion-table th {
  text-align: left; font-size: 11px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-faint);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfe;
}
.notion-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); }
.notion-table tr:last-child td { border-bottom: none; }
.notion-table tbody tr { cursor: pointer; }
.notion-table tbody tr:hover { background: var(--bg-hover); }

/* Pills pastel */
.pill { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill-green  { background: var(--green-soft); color: var(--green-deep); }
.pill-red    { background: var(--pink-soft); color: var(--pink-deep); }
.pill-amber  { background: var(--amber-soft); color: var(--amber-deep); }
.pill-blue   { background: var(--blue-soft); color: var(--blue-dark); }
.pill-gray   { background: var(--bg-hover); color: var(--text-muted); }

/* Sección con título */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 26px 0 14px;
}
.section-head h3 { font-size: 15.5px; font-weight: 700; }
.section-head .count { color: var(--text-faint); font-weight: 400; font-size: 13px; margin-left: 6px; }

/* Formularios inline */
.inline-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  box-shadow: var(--shadow);
}
.inline-form .full { grid-column: 1 / -1; }
.inline-form label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; font-weight: 600; }
.inline-form input, .inline-form select, .inline-form textarea {
  width: 100%; border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 8px 11px;
  font-size: 13.5px; font-family: inherit; color: var(--text);
  background: #fff;
}
.inline-form input:focus, .inline-form select:focus, .inline-form textarea:focus {
  outline: 2px solid var(--blue-soft); border-color: var(--blue);
}
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }

/* Detalle */
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }

/* Checklist */
.checklist { list-style: none; }
.checklist li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.checklist li:last-child { border-bottom: none; }
.checklist input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.checklist li.done span { text-decoration: line-through; color: var(--text-faint); }
.checklist li.pending span { color: var(--amber-deep); font-weight: 600; }
.checklist li.pending::after {
  content: "falta"; margin-left: auto;
  font-size: 10.5px; color: var(--amber-deep);
  background: var(--amber-soft);
  padding: 2px 9px; border-radius: 12px; white-space: nowrap; font-weight: 600;
}
.checklist li.done::after { content: "✓ listo"; margin-left: auto;
  font-size: 10.5px; color: var(--green-deep); white-space: nowrap; font-weight: 600; }

/* Timeline */
.timeline-track { height: 10px; background: var(--bg-hover); border-radius: 20px; overflow: hidden; margin: 10px 0 6px; }
.timeline-fill {
  height: 100%; border-radius: 20px;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  transition: width .4s ease;
}
.timeline-fill.done { background: var(--green); }
.timeline-marks { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--text-faint); flex-wrap: wrap; }

/* Citas */
.cita-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 9px;
  box-shadow: var(--shadow);
}
.cita-date { min-width: 62px; text-align: center; border-right: 1px solid var(--border); padding-right: 14px; }
.cita-date .d { font-size: 20px; font-weight: 700; color: var(--blue-dark); }
.cita-date .m { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.cita-info { flex: 1; }
.cita-info .who { font-weight: 600; }
.cita-info .what { font-size: 13px; color: var(--text-muted); }

.empty { text-align: center; color: var(--text-faint); padding: 40px 0; font-size: 14px; }

.money-pos { color: var(--green-deep); font-weight: 600; }
.money-neg { color: var(--pink-deep); font-weight: 600; }

.back-link {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 13px; font-family: inherit;
  padding: 0 0 10px; display: inline-flex; gap: 4px; align-items: center; font-weight: 500;
}
.back-link:hover { color: var(--text); }

/* ============ NOTIFICACIONES ============ */
.notif-item {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 9px;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item .n-icon { display: inline-flex; margin-top: 1px; }
.notif-item .n-text { flex: 1; }
.notif-item .n-tag { font-size: 11px; color: var(--text-faint); display: block; margin-top: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.notif-rojo  { border-left-color: var(--pink); }
.notif-rojo  .n-icon, .notif-rojo  .n-tag { color: var(--pink-deep); }
.notif-ambar { border-left-color: var(--orange); }
.notif-ambar .n-icon, .notif-ambar .n-tag { color: var(--orange-deep); }
.notif-docs  { border-left-color: var(--blue); }
.notif-docs  .n-icon, .notif-docs  .n-tag { color: var(--blue-dark); }
.notif-cita  { border-left-color: var(--green); }
.notif-cita  .n-icon, .notif-cita  .n-tag { color: var(--green-deep); }

/* Progreso mini */
.progress-mini {
  width: 90px; height: 6px;
  background: var(--bg-hover);
  border-radius: 20px; overflow: hidden;
  display: inline-block; vertical-align: middle; margin-right: 8px;
}
.progress-mini > div { height: 100%; border-radius: 20px; background: var(--green); }
.progress-mini > div.partial { background: var(--orange); }

/* Detalle de cliente */
.cliente-head { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
.cliente-head .avatar { width: 52px; height: 52px; font-size: 21px; }
.cliente-head h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.2px; }
.cliente-head .meta { font-size: 13px; color: var(--text-muted); }
.cliente-head .meta .ico-inline { margin: 0 2px 0 10px; }
.cliente-head .meta .ico-inline:first-child { margin-left: 0; }

/* Scrollbar */
#view::-webkit-scrollbar { width: 8px; }
#view::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* Responsive */
@media (max-width: 760px) {
  #sidebar { width: 62px; min-width: 62px; padding: 14px 6px; }
  .sidebar-user div:not(.avatar), .nav-label, .sidebar-user-name, .sidebar-user-plan { display: none; }
  .nav-item { font-size: 0; justify-content: center; padding: 10px; gap: 0; }
  .nav-item .ico { width: 19px; height: 19px; }
  #topbar { padding: 0 14px; }
  #view { padding: 16px; }
  .topbar-actions input { width: 130px; }
}
