/* ============================================================
   Mi CRM — Hoja de estilos
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e4e8f0;
  --text: #1c2333;
  --text-muted: #6b7488;
  --primary: #3b5bdb;
  --primary-dark: #2f4bb8;
  --primary-soft: #eef2ff;
  --danger: #d64545;
  --danger-soft: #fdeeee;
  --success: #2f9e62;
  --success-soft: #eaf7f0;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --purple: #7c3aed;
  --purple-soft: #f3eefe;
  --sidebar-w: 232px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 30, 60, .08);
}

/* ---------- Modo oscuro (variables) ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1420;
  --surface: #1a2233;
  --border: #2a3448;
  --text: #e6eaf2;
  --text-muted: #93a0b8;
  --primary: #6d8dff;
  --primary-dark: #5a78e8;
  --primary-soft: #1d2740;
  --danger: #f07171;
  --danger-soft: #3a1f22;
  --success: #4cc38a;
  --success-soft: #16301f;
  --warn: #f0a448;
  --warn-soft: #33280f;
  --purple: #a78bfa;
  --purple-soft: #2a2140;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35);
}

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

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #161d2e;
  color: #cdd5e4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 22px;
  font-size: 19px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo { color: #6d8dff; }
.brand-name { letter-spacing: .2px; }

.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: #cdd5e4; font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.user-box { margin-bottom: 10px; }
.user-name { color: #fff; font-weight: 600; }
.user-role { font-size: 12.5px; color: #8d97ab; }
.logout-link { font-size: 13.5px; color: #8d97ab; }
.logout-link:hover { color: #ff9d9d; text-decoration: none; }

.main { flex: 1; min-width: 0; padding: 0 28px 40px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 16px; gap: 12px; flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h1 { font-size: 24px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.content { max-width: 1200px; }

/* ---------- Menú móvil (off-canvas) ---------- */
.menu-toggle {
  display: none; /* visible solo en móvil */
  align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer;
  transition: all .15s ease;
}
.menu-toggle:hover { border-color: var(--primary); background: var(--primary-soft); }
.nav-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 12, 24, .55);
}
body.nav-locked { overflow: hidden; }

/* ---------- Toggle de tema ---------- */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 17px; line-height: 1; cursor: pointer; transition: all .15s ease;
}
.theme-toggle:hover { border-color: var(--primary); background: var(--primary-soft); }
.auth-theme-toggle { position: fixed; top: 16px; right: 16px; z-index: 50; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.btn:hover { background: #f2f5fb; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b93a3a; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-narrow { max-width: 640px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}
.card-header h2 { font-size: 16.5px; font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.empty { color: var(--text-muted); padding: 18px 0; text-align: center; }

/* ---------- KPIs ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.kpi-label { font-size: 13px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi-value { font-size: 28px; font-weight: 800; margin: 6px 0 2px; }
.kpi-sub { font-size: 13px; color: var(--text-muted); }
.kpi-won .kpi-value { color: var(--success); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge-soft { background: var(--primary-soft); color: var(--primary); }
.badge-nuevo { background: #eef1f6; color: #55607a; }
.badge-contacto { background: var(--primary-soft); color: var(--primary); }
.badge-contactado { background: var(--primary-soft); color: var(--primary); }
.badge-convertido { background: var(--success-soft, #e3f5e9); color: var(--success, #1a7f4b); }
.badge-descartado { background: #f2f2f3; color: #8a8f98; }
.badge-propuesta { background: var(--warn-soft); color: var(--warn); }
.badge-negociacion { background: var(--purple-soft); color: var(--purple); }
.badge-ganada { background: var(--success-soft); color: var(--success); }
.badge-perdida { background: var(--danger-soft); color: var(--danger); }
.badge-status-potencial { background: var(--warn-soft); color: var(--warn); }
.badge-status-activo { background: var(--success-soft); color: var(--success); }
.badge-status-inactivo { background: #eef1f6; color: #55607a; }

/* ---------- Barras de pipeline ---------- */
.stage-bars { display: flex; flex-direction: column; gap: 12px; }
.stage-bar-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text-muted);
}
.stage-bar-track { height: 10px; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.stage-bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.stage-fill-nuevo { background: #9aa5b8; }
.stage-fill-contacto { background: var(--primary); }
.stage-fill-propuesta { background: var(--warn); }
.stage-fill-negociacion { background: var(--purple); }
.stage-fill-ganada { background: var(--success); }
.stage-fill-perdida { background: var(--danger); }

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); padding: 10px 12px; border-bottom: 2px solid var(--border);
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfe; }
.table-main { font-weight: 600; color: var(--text); }
.table-main:hover { color: var(--primary); text-decoration: none; }
.table-sub { font-size: 13px; color: var(--text-muted); }
.table-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- Toolbar / búsqueda ---------- */
.toolbar { margin-bottom: 16px; }
.search-form { display: flex; gap: 10px; flex-wrap: wrap; }
.search-form input[type="search"] { min-width: 280px; flex: 1; }

/* ---------- Formularios ---------- */
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
input, select, textarea {
  width: 100%; margin-top: 5px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--surface);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 91, 219, .15);
}
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-row { display: flex; gap: 10px; align-items: flex-start; }
.form-row input { flex: 1; margin-top: 0; }
.form-row select { width: auto; margin-top: 0; }

/* ---------- Flashes ---------- */
.flashes { margin-bottom: 16px; }
.flash {
  padding: 11px 14px; border-radius: 10px; margin-bottom: 8px;
  font-size: 14px; font-weight: 500; border: 1px solid transparent;
}
.flash-success { background: var(--success-soft); color: #1d6b41; border-color: #cdeeda; }
.flash-error { background: var(--danger-soft); color: #a52c2c; border-color: #f6d4d4; }
.flash-warning { background: var(--warn-soft); color: #92560b; border-color: #f3dfc0; }
.flash-info { background: #eef2ff; color: #2f4bb8; border-color: #d8e0fc; }

/* ---------- Timeline (historial) ---------- */
.timeline { list-style: none; }
.timeline-item {
  display: flex; gap: 14px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item .badge { flex-shrink: 0; margin-top: 2px; }
.timeline-body p { margin-bottom: 4px; }
.timeline-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }
.link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 0; }
.link-danger:hover { text-decoration: underline; }

.interaction-form { margin-bottom: 10px; }

/* ---------- Tareas ---------- */
.task-list { list-style: none; }
.task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #b9c2d4; background: transparent;
  cursor: pointer; flex-shrink: 0;
}
.task-check:hover { border-color: var(--primary); }
.task-check.checked { background: var(--success); border-color: var(--success); }
.task-info { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-title { font-weight: 600; }
.task-done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-overdue .task-title { color: var(--danger); }
.task-client { font-size: 13px; color: var(--text-muted); }
.task-owner { font-size: 13px; color: var(--text-muted); }
.task-due { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.task-form { display: flex; gap: 10px; flex-wrap: wrap; }
.task-form input[type="text"] { flex: 1; min-width: 200px; margin-top: 0; }
.task-form input[type="date"], .task-form select { width: auto; margin-top: 0; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tab {
  padding: 8px 16px; border-radius: 8px 8px 0 0;
  font-weight: 600; color: var(--text-muted); font-size: 14px;
  border: 1px solid transparent; border-bottom: none;
}
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { background: var(--surface); border-color: var(--border); color: var(--primary); }

/* ---------- Tablero de ventas (kanban) ---------- */
.board {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 12px; align-items: start; overflow-x: auto;
}
@media (max-width: 1200px) { .board { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .board { grid-template-columns: 1fr; } }
.board-column {
  background: #eaeef5; border-radius: var(--radius);
  padding: 10px; min-width: 170px;
}
.board-column-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 4px 10px;
}
.board-count {
  background: #d8dee9; color: #55607a; font-size: 12px; font-weight: 700;
  border-radius: 999px; padding: 1px 8px;
}
.board-cards { display: flex; flex-direction: column; gap: 8px; }
.board-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 16px 0; }
.deal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; box-shadow: var(--shadow);
}
.deal-title { font-weight: 700; margin-bottom: 2px; }
.deal-client { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.deal-client a { color: var(--text-muted); }
.deal-client a:hover { color: var(--primary); }
.deal-value { font-weight: 700; color: var(--primary); font-size: 16px; margin-bottom: 8px; }
.deal-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
.deal-stage-form { display: flex; gap: 6px; align-items: center; }
.deal-stage-form select { margin-top: 0; padding: 5px 8px; font-size: 13px; flex: 1; }

/* ---------- Detalle de cliente ---------- */
.client-header { margin-bottom: 20px; }
.client-meta p { margin-bottom: 6px; color: var(--text-muted); }
.client-meta a { color: var(--text-muted); }
.client-notes {
  background: var(--primary-soft); border-radius: 8px;
  padding: 10px 14px; margin-top: 8px; font-size: 14px;
}

/* ---------- Usuarios ---------- */
.reset-pw { position: relative; }
.reset-pw summary { cursor: pointer; list-style: none; }
.reset-pw[open] summary { margin-bottom: 8px; }
.reset-pw-form { display: flex; gap: 6px; position: absolute; z-index: 10; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
  right: 0; top: 32px; }
.reset-pw-form input { width: 170px; margin-top: 0; }

/* ---------- Páginas de autenticación ---------- */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #161d2e 0%, #243250 100%);
  padding: 20px;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 36px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.auth-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 20px; font-weight: 800; margin-bottom: 18px;
}
.auth-brand .brand-logo { color: var(--primary); }
.auth-card h1 { font-size: 22px; margin-bottom: 18px; }
.auth-alt { margin-top: 16px; font-size: 14px; color: var(--text-muted); text-align: center; }

/* ---------- Modo oscuro (ajustes) ---------- */
[data-theme="dark"] .btn:hover { background: #232d42; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: var(--surface); }
[data-theme="dark"] .table tr:hover td { background: #1e2738; }
[data-theme="dark"] .badge-nuevo, [data-theme="dark"] .badge-status-inactivo { background: #232d42; color: #93a0b8; }
[data-theme="dark"] .stage-bar-track { background: #232d42; }
[data-theme="dark"] .stage-fill-nuevo { background: #5b6780; }
[data-theme="dark"] .task-check { border-color: #46536b; }
[data-theme="dark"] .board-column { background: #141b2b; }
[data-theme="dark"] .board-count { background: #2a3448; color: #93a0b8; }
[data-theme="dark"] .flash-success { background: var(--success-soft); color: #8fe0b5; border-color: #1f4a33; }
[data-theme="dark"] .flash-error { background: var(--danger-soft); color: #f5a3a3; border-color: #5a2525; }
[data-theme="dark"] .flash-warning { background: var(--warn-soft); color: #f5c07e; border-color: #5a4213; }
[data-theme="dark"] .flash-info { background: var(--primary-soft); color: #9db4ff; border-color: #2b3a66; }
[data-theme="dark"] .auth-card { background: var(--surface); }
[data-theme="dark"] .reset-pw-form { box-shadow: 0 4px 16px rgba(0, 0, 0, .5); }
[data-theme="dark"] ::placeholder { color: #5b6780; }

/* ============================================================
   MOBILE-FIRST — vistas optimizadas para celular (375px)
   ============================================================ */

/* ---------- Hasta 768px: teléfonos y tablets pequeñas ---------- */
@media (max-width: 768px) {
  .main { padding: 0 14px 32px; }
  .topbar { padding: 14px 0 12px; }
  .topbar h1 { font-size: 20px; }
  .content { max-width: 100%; }

  /* Menú off-canvas */
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(300px, 84vw); z-index: 100;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: none;
    height: 100dvh;
  }
  .layout.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 44px rgba(0, 0, 0, .45); }
  .layout.nav-open .nav-backdrop { display: block; }
  .nav-link { padding: 14px 12px; }

  /* Área táctil mínima 44px */
  .btn { min-height: 44px; padding: 11px 18px; justify-content: center; }
  .btn-sm { min-height: 44px; padding: 10px 16px; font-size: 14px; }
  .theme-toggle { width: 44px; height: 44px; }
  input, select, textarea { min-height: 44px; padding: 11px 12px; font-size: 16px; }
  .task-check { width: 28px; height: 28px; position: relative; }
  .task-check::before { content: ""; position: absolute; inset: -8px; }
  .link-danger { padding: 10px 12px; margin: -6px -12px; }

  /* Formularios en columna */
  .form-row { flex-direction: column; }
  .form-row input, .form-row select { width: 100%; }
  .search-form { flex-direction: column; align-items: stretch; }
  .search-form input[type="search"] { min-width: 0; }
  .search-form select { width: 100%; }
  .search-form .btn { width: 100%; }

  /* Tareas */
  .task-item { flex-wrap: wrap; row-gap: 6px; }
  .task-info { min-width: 0; flex-basis: calc(100% - 60px); }
  .task-due { margin-left: 32px; }
  .task-form { flex-direction: column; }
  .task-form input[type="text"], .task-form input[type="date"], .task-form select { width: 100%; min-width: 0; }
  .task-form .btn { width: 100%; }

  /* Tablero kanban */
  .deal-stage-form { flex-wrap: wrap; }
  .deal-stage-form .btn { flex: 1; }

  /* Popup reset de contraseña dentro de la fila */
  .reset-pw { position: static; }
  .reset-pw-form { position: static; flex-direction: column; width: 100%; box-shadow: none; margin-top: 8px; }
  .reset-pw-form input { width: 100%; }
  .reset-pw-form .btn { width: 100%; }

  /* Encabezado de tarjeta */
  .card-header { flex-wrap: wrap; }
}

/* ---------- Hasta 640px: tablas se convierten en tarjetas ---------- */
@media (max-width: 640px) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .table tr:hover td { background: transparent; }
  .table td {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; overflow-wrap: break-word;
    gap: 4px 14px; padding: 9px 12px;
    border-bottom: 1px solid var(--border);
  }
  .table td > * { min-width: 0; }
  .table td:last-child { border-bottom: none; }
  .table td::before {
    content: attr(data-label);
    font-size: 11.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .4px;
    color: var(--text-muted); flex-shrink: 0; text-align: left;
  }
  .table td[data-label=""]::before, .table td:not([data-label])::before { content: none; }
  .table td:has(> .table-actions) { justify-content: flex-end; }
  .table td > .table-actions { justify-content: flex-end; }
  .table td.table-actions { flex-wrap: wrap; justify-content: flex-end; }
  .table-actions { gap: 8px; }
  .inline-form { display: inline-flex; }
  .reset-pw { flex: 1 1 100%; }
  .reset-pw summary { width: 100%; justify-content: center; }
}

/* ---------- Hasta 480px: pantallas muy pequeñas ---------- */
@media (max-width: 480px) {
  .auth-body { padding: 16px; }
  .auth-card { padding: 26px 20px; }
  .kpi-value { font-size: 24px; }
  .tabs { overflow-x: auto; }
}

/* ============================================================
   SISTEMA DE CITAS — página pública /agendar + calendario CRM
   ============================================================ */

/* ---------- Página pública /agendar ---------- */
.public-body { background: linear-gradient(160deg, #161d2e 0%, #243250 55%, #1d2a44 100%); min-height: 100vh; }
.public-wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }
.public-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0 18px; }
.public-brand { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; color: #fff; }
.public-brand:hover { text-decoration: none; }
.public-header .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #fff; }
.public-header .btn:hover { background: rgba(255,255,255,.18); }
.public-main .card { background: var(--surface); }
.hero { padding: 6px 2px 18px; }
.hero h1 { font-size: 30px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.hero p { color: #b9c4da; font-size: 15.5px; max-width: 520px; }

.success-banner {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--success-soft); border: 1px solid #cdeeda;
  color: #1d6b41; border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.success-icon {
  width: 34px; height: 34px; border-radius: 50%; background: var(--success); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; font-size: 18px;
}
.success-banner p { margin-top: 3px; color: inherit; }

.day-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.day-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 62px; min-height: 64px; padding: 8px 10px;
  border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
  flex-shrink: 0; transition: border-color .15s ease, background .15s ease;
}
.day-chip:hover { border-color: var(--primary); text-decoration: none; color: var(--text); }
.day-chip.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.day-chip-week { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; opacity: .8; }
.day-chip-day { font-size: 20px; font-weight: 800; line-height: 1.15; }
.day-chip-month { font-size: 11.5px; text-transform: capitalize; opacity: .85; }

.slot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
@media (max-width: 560px) { .slot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.slot-btn { position: relative; margin: 0; }
.slot-btn input { position: absolute; opacity: 0; pointer-events: none; }
.slot-face {
  display: flex; align-items: center; justify-content: center;
  min-height: 46px; border: 2px solid var(--border); border-radius: 10px;
  font-weight: 700; font-size: 15px; color: var(--text);
  cursor: pointer; background: var(--surface);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
  user-select: none;
}
.slot-btn input:checked + .slot-face { border-color: var(--primary); background: var(--primary); color: #fff; }
.slot-btn input:focus-visible + .slot-face { outline: 3px solid rgba(59, 91, 219, .35); outline-offset: 2px; }
.slot-btn:hover .slot-face { border-color: var(--primary); }

.public-footer { text-align: center; color: #8d97ab; font-size: 13px; padding: 22px 0 4px; }
.page-help { color: var(--text-muted); font-size: 13.5px; margin-bottom: 16px; }
.page-help a { color: var(--primary); }

/* ---------- Calendario: navegación ---------- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-nav-title { font-size: 17px; font-weight: 800; text-transform: capitalize; }
.cal-fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.cal-fieldset legend { font-weight: 700; font-size: 13.5px; padding: 0 6px; color: var(--text-muted); }
.workday-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .workday-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.workday-chip { position: relative; margin: 0; }
.workday-chip input { position: absolute; opacity: 0; pointer-events: none; }
.workday-chip span {
  display: flex; align-items: center; justify-content: center; min-height: 44px;
  border: 2px solid var(--border); border-radius: 10px; font-weight: 600; font-size: 14px;
  cursor: pointer; background: var(--surface); color: var(--text);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.workday-chip input:checked + span { border-color: var(--primary); background: var(--primary); color: #fff; }
.check-line { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 4px 0 16px; }
.check-line .check-inline { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: var(--primary); }

/* ---------- Calendario: cuadrícula mensual ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); padding: 4px 0; }
.cal-cell {
  min-height: 56px; border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 4px; display: flex; flex-direction: column; gap: 3px; align-items: center;
  background: var(--surface); overflow: hidden;
}
.cal-other { opacity: .45; }
.cal-today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.cal-daynum {
  font-size: 13px; font-weight: 700; color: var(--text); min-height: 22px;
  display: flex; align-items: center; justify-content: center; min-width: 22px; border-radius: 6px;
}
.cal-today .cal-daynum { background: var(--primary); color: #fff; }
.cal-daynum:hover { text-decoration: none; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cal-dot-cita { background: var(--primary); }
.cal-dot-bloqueo { background: var(--danger); }
.cal-dot-cancelled { opacity: .3; }

.cal-day-section { margin-bottom: 14px; }
.cal-day-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; text-transform: capitalize; }
.cal-day-title a { color: var(--text); }
.cal-day-title a:hover { color: var(--primary); text-decoration: none; }
.cal-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px;
  background: var(--surface);
}
.cal-row-bloqueo { border-left: 4px solid var(--danger); background: var(--danger-soft); }
.cal-row-time { font-weight: 700; color: var(--primary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cal-row-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Calendario: vista de día ---------- */
.cal-day-list { display: flex; flex-direction: column; gap: 10px; }
.cal-day-card {
  display: flex; gap: 14px; padding: 14px;
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 12px; background: var(--surface); box-shadow: var(--shadow);
}
.cal-day-card-bloqueo { border-left-color: var(--danger); background: var(--danger-soft); }
.cal-day-time { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; min-width: 68px; }
.cal-day-time-start { font-weight: 800; font-size: 17px; color: var(--primary); font-variant-numeric: tabular-nums; }
.cal-day-card-bloqueo .cal-day-time-start { color: var(--danger); }
.cal-day-time-end { font-size: 12.5px; color: var(--text-muted); }
.cal-day-body { flex: 1; min-width: 0; }
.cal-day-title { font-weight: 700; font-size: 15.5px; margin-bottom: 4px; }
.cal-day-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-day-dur { font-size: 13px; color: var(--text-muted); }
.cal-day-notes { flex-basis: 100%; font-size: 13.5px; color: var(--text-muted); }
.cal-day-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cal-details summary { list-style: none; cursor: pointer; margin-bottom: 4px; }
.cal-details summary::-webkit-details-marker { display: none; }
.cal-form { margin-top: 12px; }

/* ---------- Badges de citas ---------- */
.badge-appt-pendiente { background: var(--warn-soft); color: var(--warn); }
.badge-appt-confirmada { background: var(--primary-soft); color: var(--primary); }
.badge-appt-completada { background: var(--success-soft); color: var(--success); }
.badge-appt-cancelada { background: #eef1f6; color: #55607a; }
.badge-bloqueo { background: var(--danger-soft); color: var(--danger); }
.badge-source { background: #eef1f6; color: #55607a; font-weight: 600; }
.badge-source-lead { background: var(--success-soft); color: var(--success); }

/* ---------- Ajustes móvil (hasta 640px) ---------- */
@media (max-width: 640px) {
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 48px; padding: 4px 2px; }
  .cal-day-card { flex-direction: column; gap: 8px; }
  .cal-day-time { flex-direction: row; align-items: baseline; gap: 6px; }
  .hero h1 { font-size: 26px; }
  .public-wrap { padding: 12px 12px 32px; }
}

/* ============================================================
   REPORTES — vista de reportes (módulo del mismo sistema)
   ============================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.period-form select {
  min-height: 44px;
  padding: 8px 34px 8px 12px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
@media (max-width: 480px) {
  .period-form select { max-width: 150px; }
}

/* Barras horizontales (gráficos simples, mobile-first) */
.hbar-list { display: flex; flex-direction: column; gap: 10px; }
.hbar {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.hbar-label {
  font-size: 12px; font-weight: 700;
  color: var(--text-muted); white-space: nowrap;
}
.hbar-track {
  height: 14px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.hbar-fill { height: 100%; border-radius: 999px; min-width: 2px; }
.hbar-clients { background: var(--primary); }
.hbar-won { background: var(--success); }
.hbar-source { background: var(--purple, #7c5cd6); }
.hbar-value {
  font-size: 13px; font-weight: 800;
  text-align: right; min-width: 26px; color: var(--text);
}
.hbar-sub {
  font-size: 11.5px; font-weight: 600;
  color: var(--text-muted); text-align: right; margin-top: 2px;
}
@media (max-width: 480px) {
  .hbar { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .hbar-label { font-size: 11px; }
}

/* ============================================================
   Finanzas
   ============================================================ */
.kpi-income .kpi-value { color: var(--success); }
.kpi-expense .kpi-value { color: var(--danger); }
.kpi-bad .kpi-value { color: var(--danger); }

.fin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.fin-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.fin-card-name { font-weight: 700; font-size: 16px; }
.fin-card-brand { font-weight: 400; font-size: 13px; color: var(--text-muted); }
.fin-card-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.fin-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.fin-card-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 12px 0 8px;
}
.fin-stat {
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 8px 10px;
}
.fin-stat-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.fin-stat-value { display: block; font-weight: 700; font-size: 15px; margin-top: 2px; }
.fin-card-perks { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.fin-hint { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.fin-muted { font-size: 13.5px; color: var(--text-muted); margin-bottom: 10px; }
.fin-muted code { background: var(--primary-soft); padding: 1px 5px; border-radius: 5px; }

.fin-pos { color: var(--success); }
.fin-neg { color: var(--danger); }
.fin-txn-amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Tickets con foto (finanzas) */
.ticket-thumb {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
}
.ticket-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ticket-alert {
  background: var(--warn-soft); color: var(--warn);
  border-radius: 10px; padding: 10px 12px; margin: 10px 0 4px;
  font-size: 14px; line-height: 1.45;
}
.ticket-alert-hint { display: block; opacity: .8; font-size: 12.5px; margin-top: 2px; }
input[type="file"] { min-height: 44px; }
/* Evitar desborde horizontal de badges dentro de hints (375px) */
.fin-hint .badge { white-space: normal; }

.fin-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.fin-card-row:last-child { border-bottom: 0; }
.fin-card-main { min-width: 0; }
.fin-card-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.fin-card-amount { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

.fin-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}
.fin-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.fin-check input { width: 18px; height: 18px; }
.fin-field { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.fin-field input {
  width: 90px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}
.fin-filter-form { display: flex; gap: 8px; flex-wrap: wrap; }
.fin-balance-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}
.fin-balance-form input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}
details#cardForm summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  padding: 4px 0 10px;
  color: var(--primary);
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 640px) {
  .fin-card-row { align-items: flex-start; }
  .fin-card-side { text-align: left; align-items: flex-start; }
  .fin-inline-form { flex-direction: column; align-items: stretch; }
  .fin-field { flex-wrap: wrap; }
  .fin-filter-form { flex-direction: column; }
}

/* ============================================================
   FINANZAS — deudas e inversiones (ingresos pasivos)
   ============================================================ */
.form-grid label.full { grid-column: 1 / -1; }

#debtorForm summary, #debtForm summary, #invForm summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  padding: 4px 0 10px;
  color: var(--primary);
  -webkit-tap-highlight-color: transparent;
}

.fin-new-client {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
@media (max-width: 700px) { .fin-new-client { grid-template-columns: 1fr; } }

.fin-plan-line {
  font-size: 13px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 6px;
}
.fin-plan-box { margin-top: 2px; }
.fin-plan-box .fin-plan-line { margin-top: 0; }

.fin-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.fin-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fin-chip-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.fin-chip-value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

.fin-balance-form input[type="date"] { flex: 0 0 auto; width: 150px; }
@media (max-width: 640px) {
  .fin-balance-form { flex-wrap: wrap; }
  .fin-balance-form input[type="date"] { width: 100%; }
}

/* --- Finanzas v2: ámbitos, categorías, recurrentes --- */
.fin-scope { font-weight: 600; color: var(--text-muted); }
.fin-cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fin-cat-chip {
  display: inline-flex; flex-direction: column; gap: 2px;
  padding: 10px 14px; border-radius: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; text-decoration: none;
  min-height: 44px; justify-content: center;
}
.fin-cat-chip.fin-cat-in { background: rgba(34, 197, 94, 0.12); color: var(--positive, #16a34a); }
.fin-cat-chip.fin-cat-out { background: rgba(239, 68, 68, 0.12); color: var(--danger, #dc2626); }
.fin-cat-name { font-weight: 500; font-size: 12.5px; opacity: 0.85; }
.fin-section-title { margin: 18px 0 8px; font-size: 15px; }
.fin-cat-group { margin-bottom: 10px; }
.fin-cat-list { display: flex; flex-wrap: wrap; gap: 8px; }
.fin-cat-item {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface, #f1f5f9); border-radius: 10px; padding: 4px 8px;
}
[data-theme="dark"] .fin-cat-item { background: #141b2b; }
.fin-cat-icon { font-size: 15px; }
.fin-cat-edit summary { cursor: pointer; font-size: 13.5px; padding: 4px 2px; }
.fin-cat-edit .fin-inline-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fin-cat-edit .fin-inline-form input[type="text"] { width: auto; min-width: 110px; }
.fin-cat-edit .fin-inline-form select { width: auto; }
.deal-pay-badge {
  font-size: 12px; color: var(--text-muted); margin: 4px 0 0;
  padding: 4px 8px; background: rgba(99, 102, 241, 0.12); border-radius: 8px;
  font-weight: 600;
}
.deal-inv-badge {
  font-size: 11.5px; font-weight: 700; margin: 4px 0 0;
  padding: 3px 8px; border-radius: 8px; display: inline-block;
  background: rgba(245, 158, 11, 0.15); color: #b45309;
}
.deal-inv-badge.facturada { background: rgba(22, 163, 74, 0.14); color: #15803d; }
.deal-inv-badge.no_aplica { background: rgba(100, 116, 139, 0.14); color: #64748b; }
[data-theme="dark"] .deal-inv-badge { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
[data-theme="dark"] .deal-inv-badge.facturada { background: rgba(22, 163, 74, 0.20); color: #4ade80; }
[data-theme="dark"] .deal-inv-badge.no_aplica { background: rgba(100, 116, 139, 0.20); color: #94a3b8; }
.deal-pay-details { margin: 14px 0; padding: 12px; border: 1px dashed var(--border, #cbd5e1); border-radius: 12px; }
.deal-pay-details summary { cursor: pointer; font-weight: 700; }
.deal-pay-details .full { grid-column: 1 / -1; }

/* ---------- Líneas de venta (catálogo) + estado de cuenta ---------- */
.deal-item-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px; margin-bottom: 8px;
  background: rgba(99, 102, 241, 0.05); border: 1px solid var(--border, #cbd5e1);
  border-radius: 10px;
}
.deal-item-row .item-select { flex: 1 1 150px; min-width: 130px; }
.deal-item-row .item-qty { width: 76px; min-width: 76px; }
.deal-item-row .item-subtotal {
  font-weight: 700; font-size: 14px; white-space: nowrap;
  min-width: 72px; text-align: right; color: var(--primary, #4f46e5);
}
.deal-item-tools {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  justify-content: space-between; margin-top: 4px;
}
.item-total { font-size: 14px; color: var(--text-muted); }
.item-total strong { color: var(--text); }
@media (max-width: 480px) {
  .deal-item-row .item-select { flex-basis: 100%; }
  .deal-item-row .item-qty { flex: 1 1 70px; }
  .deal-item-row .item-subtotal { flex: 1 1 auto; }
}
/* Estado de cuenta por cliente */
.ec-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.ec-summary .ec-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px; padding: 14px; box-shadow: var(--shadow, none);
}
.ec-card .ec-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.ec-card .ec-value { display: block; font-size: 20px; font-weight: 800; margin-top: 4px; }
.ec-card.ec-adeudo .ec-value { color: #dc2626; }
.ec-card.ec-pagado .ec-value { color: #16a34a; }
.ec-mov-row {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--border, #eef2f7);
}
.ec-mov-row:last-child { border-bottom: none; }
.ec-mov-tag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.ec-mov-tag.pago { background: rgba(22, 163, 74, 0.14); color: #15803d; }
.ec-mov-tag.cargo { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.ec-mov-concepto { flex: 1 1 200px; font-size: 14px; }
.ec-mov-monto { font-weight: 700; font-size: 14px; white-space: nowrap; }
.ec-mov-monto.pago { color: #16a34a; }
.ec-mov-monto.cargo { color: #dc2626; }
.ec-mov-fecha { font-size: 12px; color: var(--text-muted); }
@media (max-width: 560px) {
  .ec-summary { grid-template-columns: 1fr; }
  .ec-mov-row { padding: 12px 0; }
}
[data-theme="dark"] .deal-item-row { background: rgba(99, 102, 241, 0.10); }
[data-theme="dark"] .ec-mov-tag.pago { color: #86efac; }
[data-theme="dark"] .ec-mov-tag.cargo { color: #fca5a5; }
[data-theme="dark"] .ec-mov-monto.pago { color: #86efac; }
[data-theme="dark"] .ec-mov-monto.cargo { color: #fca5a5; }
[data-theme="dark"] .ec-card.ec-adeudo .ec-value { color: #f87171; }
[data-theme="dark"] .ec-card.ec-pagado .ec-value { color: #4ade80; }

/* ---------- Catálogo de productos/servicios ---------- */
.catalog-list { display: flex; flex-direction: column; gap: 10px; }
.catalog-item {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
  padding: 12px; border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px; background: var(--surface, #fff);
}
.catalog-item.catalog-off { opacity: 0.55; }
.catalog-info { flex: 1 1 220px; min-width: 0; }
.catalog-name { font-size: 15px; font-weight: 600; }
.catalog-price { font-weight: 800; font-size: 16px; color: var(--primary, #4f46e5); margin-top: 2px; }
.catalog-notes { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.catalog-actions { display: flex; gap: 6px; }
.catalog-edit summary { cursor: pointer; font-size: 13px; color: var(--text-muted); font-weight: 600; }
.catalog-edit[open] summary { margin-bottom: 4px; }
@media (max-width: 480px) {
  .catalog-actions { width: 100%; justify-content: flex-end; }
  .catalog-edit { flex-basis: 100%; }
}

/* ===== Perfil 360: citas, WhatsApp y resumen IA (2026-08-04) ===== */
.appt-badge {
  display: inline-block; margin-top: 8px; padding: 8px 14px;
  background: rgba(249, 115, 22, 0.12); border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: 10px; font-size: 14px;
}
.wa-preview {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 320px; overflow-y: auto; padding: 8px 0;
}
.wa-preview .wa-msg { display: flex; flex-direction: column; }
.wa-preview .wa-bubble {
  max-width: 85%; padding: 8px 12px; border-radius: 12px;
  background: var(--surface, #f1f5f9); font-size: 13.5px; white-space: pre-wrap;
  word-break: break-word;
}
[data-theme="dark"] .wa-preview .wa-bubble { background: #141b2b; }
.wa-preview .wa-msg-client .wa-bubble { align-self: flex-end; background: rgba(37, 99, 235, 0.14); }
.wa-preview .wa-msg-bot .wa-bubble { align-self: flex-start; }
.wa-preview .wa-msg-time { font-size: 11px; opacity: 0.6; margin-top: 2px; }
.ai-summary {
  padding: 14px 16px; border-radius: 12px; line-height: 1.55;
  background: rgba(201, 168, 92, 0.08); border: 1px solid rgba(201, 168, 92, 0.3);
  white-space: pre-wrap; font-size: 14px;
}

/* ===== Botón flotante + modal de gasto rápido (2026-08-08) ===== */
.fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 18px 0 16px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  box-shadow: 0 6px 20px rgba(20, 30, 60, .35);
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.fab:hover { background: var(--primary-dark); transform: translateY(-1px); }
.fab:active { transform: translateY(0); }
.fab-icon { font-size: 22px; line-height: 1; }

.fab-modal[hidden] { display: none; }
.fab-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.fab-modal-backdrop { position: absolute; inset: 0; background: rgba(10, 15, 30, .55); }
.fab-modal-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .28);
}
.fab-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.fab-modal-header h2 { font-size: 17px; font-weight: 700; margin: 0; }
.fab-modal-close {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}
.fab-modal-close:hover { background: var(--bg); color: var(--text); }
.fab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fab-modal label { margin-bottom: 12px; }
.fab-actions { display: flex; gap: 10px; margin-top: 6px; }
.fab-actions .btn { flex: 1; justify-content: center; min-height: 48px; }

@media (min-width: 700px) {
  .fab-modal { align-items: center; padding: 24px; }
  .fab-modal-panel { border-radius: 16px; border-bottom: 1px solid var(--border); }
  .fab { right: 24px; bottom: 24px; }
}
@media (max-width: 700px) {
  .fab-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   Diagnóstico de llamada (calculadora comercial) — Zios Negocios
   ===================================================================== */
.dg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .dg-grid { grid-template-columns: 1fr; } .dg-side { order: -1; } .dg-sticky { position: static; } }
.dg-side { position: relative; }
.dg-sticky { position: sticky; top: 16px; }
.dg-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
@media (max-width: 720px) { .dg-fields { grid-template-columns: 1fr; } }
.dg-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.dg-fields label small { font-weight: 400; }
.dg-wide { grid-column: 1 / -1; }
.dg-label { font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.dg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dg-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; background: var(--surface); }
.dg-chip input { width: auto; margin: 0; }
.dg-mini { margin: 0; }
.dg-mini td { padding: 6px 8px; }
.dg-mini input { margin: 0; }
.dg-tabs { margin-bottom: 12px; }
.dg-submit { display: flex; gap: 10px; margin: 4px 0 30px; }
.dg-live { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.dg-live-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.dg-live-row span { color: var(--muted, #6b7280); }
.dg-live-big { font-size: 14px; }
.dg-live-big b { font-size: 16px; }
.dg-verdict { font-size: 12.5px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--border); }
.dg-verdict.dg-verde { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.5); color: #047857; }
.dg-verdict.dg-amarillo { background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.5); color: #b45309; }
.dg-verdict.dg-rojo { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.5); color: #b91c1c; }
.dg-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.dg-pill.dg-verde { background: rgba(16,185,129,.18); color: #047857; }
.dg-pill.dg-amarillo { background: rgba(245,158,11,.2); color: #b45309; }
.dg-pill.dg-rojo { background: rgba(239,68,68,.18); color: #b91c1c; }
.dg-result { border-width: 2px; }
.dg-border-verde { border-color: rgba(16,185,129,.55); }
.dg-border-amarillo { border-color: rgba(245,158,11,.55); }
.dg-border-rojo { border-color: rgba(239,68,68,.55); }
.dg-result-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.dg-name { margin: 0 0 4px; }
.dg-verdict-big { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; text-align: right; }
.dg-reasons { margin: 12px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.5; }
.dg-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 18px; align-items: start; }
.dg-kv { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px; font-size: 13px; }
.dg-kv > div { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.dg-kv span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted, #6b7280); }
.dg-kv b { font-size: 14.5px; }
.dg-kv-hl b { font-size: 16px; }
.dg-kv .dg-wide { grid-column: 1 / -1; }
.dg-small { font-size: 11.5px !important; }
.dg-leaks { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.dg-leak-t { font-weight: 800; }
.dg-leak-d { line-height: 1.45; }
.dg-leak-m { font-weight: 700; color: #b45309; }
.dg-nohacer { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px; font-size: 13px; }
.dg-nohacer ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.5; }
.dg-ai-summary { font-size: 14px; line-height: 1.55; font-weight: 600; }
.dg-op1 { border: 1px solid rgba(16,185,129,.5); background: rgba(16,185,129,.07); border-radius: 12px; padding: 14px 16px; margin: 10px 0 16px; }
.dg-op1 h3 { margin: 8px 0 6px; font-size: 17px; }
.dg-op1 p { margin: 4px 0; font-size: 13px; line-height: 1.5; }
.dg-accion { font-weight: 700; }
.dg-impacto { font-weight: 800; }
.dg-order { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.dg-answers b { font-weight: 600; word-break: break-word; }
.dg-guide { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; line-height: 1.45; color: var(--text); }
.dg-guide:empty { display: none; }
.dg-mode { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; cursor: pointer; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; }
.dg-mode input { width: auto; margin: 0; }
.dg-esc { padding: 4px 0 10px; }
.dg-esc .dg-kv { margin-top: 6px; }
.dg-actionsbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.dg-actionsbar form { margin: 0; }
.dg-cmp .dg-up { color: #047857; font-weight: 800; }
.dg-cmp .dg-down { color: #b91c1c; font-weight: 800; }
.dg-story { font-size: 13px; line-height: 1.5; margin: 12px 0 0; font-weight: 600; }
.dg-adq-list { margin: 6px 0 14px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.45; }
.dg-plan { margin: 8px 0 14px; }
.dg-args { margin: 8px 0 14px; }
.dg-adq-idea { font-weight: 700; }
.dg-adq-why { font-size: 12.5px; color: var(--muted, #6b7280); margin-top: 3px; line-height: 1.45; }
.dg-adq-tipo { display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; margin-right: 6px; }
.dg-src { display: inline-block; font-size: 9.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.dg-src-data { background: rgba(16,185,129,.16); color: #047857; }
.dg-src-common { background: rgba(107,114,128,.16); color: #4b5563; }
.dg-gaps { margin-top: 10px; font-size: 12.5px; line-height: 1.45; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 10px; }
.dg-gaps:empty { display: none; }
.dg-soft { background: rgba(59,130,246,.14); color: #1d4ed8; }
.dg-gapsbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 6px 18px; margin-top: 12px; font-size: 12.5px; }
.dg-gapsbox > div { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.dg-gapsbox span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted, #6b7280); }


/* Panel de Personas (2026-11-26) */
.badge-sin_contactar { background: #eef1f6; color: #55607a; }
.badge-contactado { background: var(--primary-soft); color: var(--primary); }
.badge-respondio { background: var(--warn-soft); color: var(--warn); }
.badge-interesado { background: var(--purple-soft); color: var(--purple); }
.badge-analisis_agendado { background: var(--primary-soft); color: var(--primary); }
.badge-analisis_hecho { background: var(--purple-soft); color: var(--purple); }
.badge-propuesta_enviada { background: var(--warn-soft); color: var(--warn); }
.badge-cliente { background: var(--success-soft); color: var(--success); }
.badge-perdido { background: var(--danger-soft); color: var(--danger); }
.badge-nuevo { background: #eef1f6; color: #55607a; }
.badge-cita { background: var(--primary-soft); color: var(--primary); }
.badge-venta { background: var(--success-soft); color: var(--success); }

.personas-card { position: sticky; top: 0; z-index: 30; background: var(--bg, #fff); }
.personas-card .card-body { max-height: 46vh; overflow: auto; }
.personas-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.personas-col .card-body { max-height: 38vh; overflow: auto; padding: 0; }
.persona-row { display: flex; justify-content: space-between; gap: .5rem; align-items: center;
  padding: .55rem .75rem; border-bottom: 1px solid var(--border, #ececf1); text-decoration: none; color: inherit; }
.persona-row:hover { background: var(--primary-soft); }
.persona-row.active { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.persona-row .pr-name { font-weight: 600; font-size: .88rem; }
.persona-row .pr-sub { font-size: .74rem; color: var(--muted, #7a8090); }
.persona-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
@media (max-width: 980px) {
  .personas-cols { grid-template-columns: 1fr; }
  .personas-card { position: static; }
  .personas-card .card-body { max-height: none; }
  .personas-col .card-body { max-height: 30vh; }
}

/* ---- Ficha 360 de Personas (2026-11-26) ---- */
.p360 { position: sticky; top: 0; z-index: 30; background: var(--bg, #fff); padding: 0; }
.p360-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.1rem .8rem; border-bottom: 1px solid var(--border, #ececf1); }
.p360-name { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: .3rem; }
.p360-contact { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .8rem; color: var(--muted, #7a8090); margin-top: .35rem; }
.p360-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.p360-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border-bottom: 1px solid var(--border, #ececf1); }
.p360-kpi { padding: .65rem .9rem; border-right: 1px solid var(--border, #ececf1); display: flex; flex-direction: column; gap: .1rem; }
.p360-kpi:last-child { border-right: 0; }
.p360-kpi-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted, #7a8090); font-weight: 700; }
.p360-kpi-value { font-size: 1.05rem; font-weight: 800; }
.p360-kpi-sub { font-size: .68rem; color: var(--muted, #7a8090); }
.p360-alert .p360-kpi-value { color: var(--danger, #c0392b); }
.p360-body { display: grid; grid-template-columns: 1fr 300px; }
.p360-main { min-width: 0; border-right: 1px solid var(--border, #ececf1); }
.p360-tabs { display: flex; gap: .2rem; padding: .5rem .9rem 0; border-bottom: 1px solid var(--border, #ececf1); }
.p360-tab { padding: .45rem .8rem; font-size: .8rem; font-weight: 700; color: var(--muted, #7a8090); border-bottom: 2px solid transparent; text-decoration: none; }
.p360-tab.active { color: var(--text, #111); border-bottom-color: var(--primary, #2b59ff); }
.p360-scroll { max-height: 34vh; overflow: auto; padding: .75rem .9rem; }
.p360-side { padding: .75rem .9rem; background: var(--surface-2, #fafafb); }
.p360-h3 { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted, #7a8090); margin: 0 0 .45rem; font-weight: 800; }
.p360-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.p360-form { display: flex; flex-direction: column; gap: .25rem; }
.p360-form label { font-size: .72rem; color: var(--muted, #7a8090); }
.p360-form button { margin-top: .4rem; align-self: flex-start; }
.p360-data { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; }
.p360-data span { color: var(--muted, #7a8090); display: inline-block; min-width: 96px; }
.p360-timeline { list-style: none; margin: 0; padding: 0; }
.p360-timeline li { display: flex; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed var(--border, #ececf1); }
.p360-tl-icon { width: 1.2rem; text-align: center; }
.p360-tl-text { font-size: .84rem; }
.p360-tl-sub { font-size: .68rem; color: var(--muted, #7a8090); }
.p360-mini { list-style: none; margin: 0; padding: 0; font-size: .78rem; }
.p360-mini li { padding: .2rem 0; display: flex; gap: .35rem; }
.p360-mini-text { color: var(--text, #111); }
.p360-upload { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; padding: .6rem .9rem; border-bottom: 1px solid var(--border, #ececf1); }
.p360-foot { padding: .5rem .9rem; border-top: 1px solid var(--border, #ececf1); }
.p360-empty { padding: 1rem .9rem; }
.input-sm { font-size: .8rem; padding: .3rem .45rem; }
@media (max-width: 1100px) {
  .p360-kpis { grid-template-columns: repeat(2, 1fr); }
  .p360-body { grid-template-columns: 1fr; }
  .p360-main { border-right: 0; }
  .p360-side { border-top: 1px solid var(--border, #ececf1); }
  .p360-grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 980px) { .p360 { position: static; } .p360-scroll { max-height: none; } }

/* fix tabs en móvil (2026-11-26) */
.p360-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
.p360-tabs::-webkit-scrollbar { height: 4px; }
@media (max-width: 980px) { .p360-tab { padding: .4rem .55rem; font-size: .74rem; white-space: nowrap; } }

/* ---- Modales de Personas (2026-11-26) ---- */
.p360-side { background: var(--bg) !important; }
.p360-pen { background: transparent; border: 0; cursor: pointer; font-size: .85rem; opacity: .55; padding: 0 .2rem; }
.p360-pen:hover { opacity: 1; }
.p360-kpi-btn { background: transparent; border: 0; border-right: 1px solid var(--border, #ececf1); text-align: left; cursor: pointer; font: inherit; color: inherit; }
.p360-kpi-btn:hover { background: var(--bg); }
.p360-side-actions { display: flex; flex-direction: column; gap: .35rem; }
.p360-notes { white-space: pre-wrap; font-size: .85rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .7rem; min-height: 3rem; }
.pmodal { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; }
.pmodal::backdrop { background: rgba(10, 15, 30, .55); }
.pmodal-panel { width: min(520px, 94vw); max-height: 88dvh; overflow-y: auto; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: .35rem; }
.pmodal-panel h3 { font-size: 1.02rem; margin: 0 0 .4rem; }
.pmodal-panel label { font-size: .72rem; color: var(--text-muted, #7a8090); margin-top: .35rem; }
.pmodal-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.pmodal-hint { font-size: .72rem; color: var(--text-muted, #7a8090); margin: .4rem 0 0; }
.pmodal-actions { display: flex; justify-content: flex-end; gap: .4rem; margin-top: .9rem; }
@media (max-width: 640px) {
  .pmodal { margin: auto 0 0; width: 100%; }
  .pmodal-panel { width: 100%; border-radius: 16px 16px 0 0; }
}

/* ---- Tickets de soporte (2026-11-26) ---- */
.badge-abierto { background: var(--danger-soft); color: var(--danger); }
.badge-en_proceso { background: var(--warn-soft); color: var(--warn); }
.badge-resuelto { background: var(--success-soft); color: var(--success); }
.badge-cerrado { background: #f2f2f3; color: #8a8f98; }
