/* ============================================================
   CRM Amaculla — Rediseño visual premium
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Montserrat:wght@600;700;800&display=swap');

:root {
  --color-primary: #E79A5A;
  --color-primary-strong: #D47F3A;
  --color-secondary: #2E3192;
  --color-accent-pink: #D47A8C;
  --font-brand: 'Montserrat', 'Inter', sans-serif;
  --color-background: #F7F7F5;
  --color-surface: #FFFFFF;
  --color-surface-soft: #F2F1EE;
  --color-border: #E9E8E4;
  --color-text: #1F1F1F;
  --color-muted: #75726C;
  --color-success: #22C55E;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 4px 16px rgba(31, 31, 31, 0.05);
  --shadow-soft: 0 2px 8px rgba(31, 31, 31, 0.04);
  --transition: 180ms ease;
  --spacing: 24px;
  --spacing-xs: 6px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-background);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; }

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
  background: var(--color-background);
}

.sidebar {
  width: 270px;
  background: var(--color-background);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  overflow: hidden;
}

.sidebar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 140px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 270 140' preserveAspectRatio='none'%3E%3Cpath d='M0,140 L0,110 L40,70 L70,90 L110,45 L150,85 L190,55 L230,95 L270,60 L270,140 Z' fill='%232E3192'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: bottom;
  background-size: 100% 100%;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px 28px;
  margin-bottom: 12px;
}

.sidebar-brand .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-surface-soft);
  color: var(--color-secondary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  border: 1px solid rgba(229, 231, 235, 0.9);
  flex-shrink: 0;
}

.sidebar-brand .brand-mark svg {
  width: 26px;
  height: 26px;
}

.sidebar-brand strong {
  font-family: var(--font-brand);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.sidebar-brand span {
  display: block;
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 500;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 4px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav-group {
  margin-bottom: 20px;
}

.sidebar-nav-group:last-child {
  margin-bottom: 0;
}

.sidebar-nav-group-title {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-muted);
  padding: 16px 12px 8px;
  margin-bottom: 6px;
  opacity: 0.6;
}

.sidebar-nav-group:first-of-type .sidebar-nav-group-title {
  padding-top: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 10px;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.sidebar-nav a:hover {
  background: var(--color-surface-soft);
  color: var(--color-secondary);
  transform: translateX(2px);
}

.sidebar-nav a.active {
  background: var(--color-secondary);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.sidebar-nav a.active .icon {
  color: #fff;
}

.sidebar-nav a .icon {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav a .icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 2px;
}

.sidebar-user {
  margin-top: auto;
  padding: 20px 12px;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 12px;
}

.sidebar-user strong {
  display: block;
  color: var(--color-text);
  font-size: 13px;
  margin-bottom: 4px;
  font-weight: 700;
}

.theme-toggle {
  margin-top: 10px;
  border: 1px solid var(--color-border);
  background: rgba(229, 149, 82, 0.14);
  color: var(--color-text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(229, 149, 82, 0.22);
  transform: translateY(-1px);
}

.main-content {
  flex: 1;
  padding: 40px 48px 56px;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 14px 4px 18px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.topbar::after {
  content: '';
  position: absolute;
  right: -10px;
  bottom: -14px;
  width: 360px;
  height: 90px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120' preserveAspectRatio='xMaxYMax meet'%3E%3Cpath d='M0,120 L0,86 L35,50 L60,72 L95,28 L125,58 L155,36 L185,68 L215,32 L248,62 L280,40 L312,74 L345,26 L375,56 L400,44 L400,120 Z' fill='%232E3192'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: bottom right;
  background-size: contain;
  opacity: 0.055;
  pointer-events: none;
}

[data-theme="dark"] .topbar::after {
  opacity: 0.09;
}

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

.topbar > *:first-child {
  flex: 1;
  min-width: 0;
}

.page-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 2px;
}

.breadcrumb svg {
  width: 12px;
  height: 12px;
}

/* ── Topbar utilities (búsqueda, notificaciones, avatar) ── */
.topbar-utilities {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0 12px;
  height: 38px;
  min-width: 260px;
  color: var(--color-muted);
  transition: border-color var(--transition), background var(--transition);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(31, 31, 31, 0.16);
  padding: 8px;
  z-index: 200;
}

.search-empty {
  padding: 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--color-muted);
}

.search-group + .search-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

.search-group-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  padding: 4px 8px;
}

.search-category {
  margin-bottom: 4px;
}

.search-category-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-muted);
  padding: 4px 8px;
}

.search-category-title svg {
  width: 13px;
  height: 13px;
}

.search-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  margin-left: 4px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-text);
  transition: background var(--transition);
}

.search-result:hover {
  background: var(--color-surface-soft);
}

.search-result-label {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-sub {
  font-size: 11.5px;
  color: var(--color-muted);
  flex-shrink: 0;
}

.topbar-search:focus-within {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.topbar-search svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--color-text);
  width: 100%;
  height: 100%;
}

.topbar-utilities .icon-chip {
  width: 38px;
  height: 38px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.topbar-utilities .icon-chip:hover {
  background: var(--color-surface-soft);
  border-color: var(--color-primary);
}

.topbar-utilities .icon-chip svg {
  width: 16px;
  height: 16px;
}

.topbar-utilities .avatar-pill {
  cursor: default;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.2;
}

.page-subtitle {
  color: var(--color-muted);
  font-size: 13px;
  margin-top: 6px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-pill,
.icon-chip,
.avatar-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 12.5px;
  font-weight: 600;
}

.icon-chip {
  width: 42px;
  height: 42px;
  justify-content: center;
  padding: 0;
}

.avatar-pill {
  color: var(--color-secondary);
  gap: 8px;
  padding-right: 14px;
}

.avatar-pill .avatar-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-surface-soft);
  color: var(--color-primary);
  display: grid;
  place-items: center;
  font-weight: 700;
}

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card-body {
  padding: 28px 32px;
}

/* ── KPI grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.kpi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.kpi-card .kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-surface-soft);
  color: var(--color-primary);
  display: grid;
  place-items: center;
}

.kpi-card .kpi-icon svg {
  width: 18px;
  height: 18px;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.kpi-trend.flat {
  background: var(--color-surface-soft);
  color: var(--color-muted);
}

.kpi-trend svg {
  width: 11px;
  height: 11px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--color-text);
}

.kpi-label {
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 600;
}

.kpi-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  margin-top: 4px;
}

.kpi-sparkline .bar {
  flex: 1;
  min-height: 2px;
  border-radius: 2px;
  background: var(--color-primary);
  opacity: 0.35;
  transition: opacity var(--transition);
}

.kpi-sparkline .bar:last-child {
  opacity: 0.9;
}

.kpi-card.danger .kpi-value { color: var(--color-danger); }
.kpi-card.warning .kpi-value { color: var(--color-warning); }
.kpi-card.success .kpi-value { color: var(--color-success); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
  letter-spacing: 0.01em;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(231, 154, 90, 0.22);
}

.btn-primary:hover { background: var(--color-primary-strong); }

/* Secundario: outline/ghost */
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
  box-shadow: none;
}
.btn-secondary:hover { background: var(--color-surface-soft); border-color: var(--color-primary); }

/* Terciario: solo texto */
.btn-ghost {
  background: transparent;
  color: var(--color-muted);
  border-color: transparent;
  box-shadow: none;
  padding-left: 10px;
  padding-right: 10px;
}
.btn-ghost:hover { color: var(--color-text); background: var(--color-surface-soft); transform: none; }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-icon { padding: 8px 10px; }

/* ── Tabla ── */
.table-wrap { overflow-x: auto; }

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

thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

tbody td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(229,231,235,0.7);
  vertical-align: middle;
}

tbody tr:hover td { background: #f9fafb; transition: background 0.15s ease; }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.badge:hover {
  transform: translateY(-1px);
}

.badge-blue { background: #EAF2FF; color: #2563eb; border: 1px solid rgba(37, 99, 235, 0.1); }
.badge-green { background: #EAF8EE; color: #15803d; border: 1px solid rgba(21, 128, 61, 0.1); }
.badge-orange { background: #FFF4E4; color: #c2410c; border: 1px solid rgba(194, 65, 12, 0.1); }
.badge-red { background: #FEE7E7; color: #b91c1c; border: 1px solid rgba(185, 28, 28, 0.1); }
.badge-gray { background: #F3F4F6; color: #475569; border: 1px solid rgba(71, 85, 105, 0.1); }
.badge-purple { background: #F0E9FF; color: #6d28d9; border: 1px solid rgba(109, 40, 217, 0.1); }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.form-control, .form-select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  font-size: 13.5px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(229, 149, 82, 0.16);
}

textarea.form-control { min-height: 92px; padding-top: 12px; resize: vertical; }

/* ── Filters bar ── */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filters-bar .form-control, .filters-bar .form-select {
  width: auto;
  min-width: 200px;
  height: 44px;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(45,45,45,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal {
  background: var(--color-surface);
  border-radius: 18px;
  box-shadow: 0 20px 48px rgba(31, 31, 31, 0.14);
  width: 600px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--color-muted); transition: color 0.2s ease; }
.modal-close:hover { color: var(--color-text); }
.modal-body { padding: 28px 32px; }
.modal-footer { padding: 20px 32px; border-top: 1px solid var(--color-border); display: flex; gap: 12px; justify-content: flex-end; }

/* ── Pipeline: barra de ascenso ── */
.pipeline-progress {
  display: flex;
  gap: 3px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--color-surface-soft);
}

.pipeline-progress-seg {
  border-radius: 2px;
  transition: flex var(--transition);
  min-width: 6px;
}

/* ── Pipeline: etapas apiladas verticalmente ── */
.pipeline-stages {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pipeline-stage {
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 18px 20px;
}

.pipeline-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pipeline-stage-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
}

.pipeline-stage-title svg { width: 16px; height: 16px; }

.pipeline-stage-value {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-muted);
}

.pipeline-stage-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.kanban-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 12px;
  color: var(--color-muted);
  font-size: 11.5px;
  text-align: center;
  opacity: 0.7;
}

.kanban-empty svg { width: 22px; height: 22px; }

.kanban-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.kanban-card-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; line-height: 1.3; }

.kanban-card-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.kanban-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent-pink), var(--color-primary));
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kanban-card-sub {
  font-size: 11.5px;
  color: var(--color-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-product-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--color-muted);
  background: var(--color-surface-soft);
  border-radius: 999px;
  padding: 3px 8px;
}

.kanban-product-tag svg { width: 11px; height: 11px; }

.kanban-card-value { font-size: 12.5px; color: var(--color-text); font-weight: 800; }

.kanban-card-date {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--color-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border);
}

.kanban-card-date svg { width: 11px; height: 11px; }

/* ── Ayuda ── */
.help-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}

.help-toc {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
}

.help-toc-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  padding: 4px 10px 8px;
}

.help-toc a {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.help-toc a:hover { background: var(--color-surface); color: var(--color-primary); }

.help-content { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.help-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  margin-bottom: 10px;
  scroll-margin-top: 20px;
}

.help-section h2 svg { width: 18px; height: 18px; color: var(--color-primary); }

.help-section p { color: var(--color-text); font-size: 13.5px; line-height: 1.65; margin-bottom: 10px; }
.help-section p:last-child { margin-bottom: 0; }
.help-section ul { margin: 0 0 10px 18px; padding: 0; }
.help-section li { font-size: 13.5px; line-height: 1.65; margin-bottom: 4px; }

@media (max-width: 980px) {
  .help-shell { grid-template-columns: 1fr; }
  .help-toc { position: static; flex-direction: row; flex-wrap: wrap; }
}

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-surface-soft) 0%, var(--color-background) 100%);
  padding: 24px;
}

.login-shell {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  width: min(100%, 980px);
  border-radius: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-hero {
  position: relative;
  overflow: hidden;
  padding: 48px 40px;
  background: var(--color-surface-soft);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.login-hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 55%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120' preserveAspectRatio='none'%3E%3Cpath d='M0,120 L0,80 L30,40 L55,65 L90,15 L120,55 L150,30 L180,70 L210,25 L245,60 L275,35 L310,75 L340,20 L370,55 L400,40 L400,120 Z' fill='%232E3192'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: bottom;
  background-size: 100% 100%;
  opacity: 0.05;
  pointer-events: none;
}

.login-hero > * {
  position: relative;
}

.login-hero .brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.login-hero .brand .mark {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--color-surface);
  display: grid;
  place-items: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.login-hero .brand .mark svg {
  width: 30px;
  height: 30px;
}

.login-hero h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-text);
}

.login-hero p {
  color: var(--color-muted);
  max-width: 480px;
  font-size: 14px;
}

.login-box {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-box h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.login-box p { color: var(--color-muted); font-size: 13px; margin-bottom: 22px; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  color: var(--color-muted);
}

.empty-state .icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(212, 122, 140, 0.16), rgba(231, 154, 90, 0.16));
  color: var(--color-primary-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state .icon svg {
  width: 32px;
  height: 32px;
  stroke-width: 1.5px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 24px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-muted);
  color: var(--color-text);
  box-shadow: 0 8px 24px rgba(31, 31, 31, 0.12);
  animation: slideIn .2s ease;
}

.toast-success { border-left-color: var(--color-success); }
.toast-error { border-left-color: var(--color-danger); }
.toast-info { border-left-color: var(--color-secondary); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Skeleton loading ── */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--color-surface-soft);
  border-radius: 6px;
  color: transparent !important;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(212, 122, 140, 0.28), rgba(231, 154, 90, 0.28), transparent);
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}

[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(212, 122, 140, 0.14), rgba(231, 154, 90, 0.14), transparent);
}

@keyframes skeleton-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* ── Separador con silueta de montaña ── */
.section-divider {
  position: relative;
  height: 1px;
  background: var(--color-border);
  margin: 40px 0;
}

.section-divider::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 28px;
  background-color: var(--color-background);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 60'%3E%3Cpolygon points='2,54 24,10 34,54' fill='%23D47A8C'/%3E%3Cpolygon points='22,54 24,10 40,26 52,14 66,24 76,54' fill='%23E79A5A'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px 22px;
  padding: 0 8px;
}

/* ── Misc ── */
.text-muted { color: var(--color-muted); }
.text-small { font-size: 12px; }
.mt-16 { margin-top: 20px; }
.mt-24 { margin-top: 32px; }
.mb-16 { margin-bottom: 20px; }
.mt-32 { margin-top: 40px; }
.mb-24 { margin-bottom: 32px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
.grid-2.mt-24 { margin-top: 28px; }
.grid-2.mt-16 { margin-top: 20px; }

/* ── Dark Theme ── */
[data-theme="dark"] {
  --color-background: #171717;
  --color-surface: #232323;
  --color-surface-soft: #2A2A2A;
  --color-border: #363636;
  --color-text: #F2F1EE;
  --color-muted: #A8A6A1;
  --shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] body {
  background: var(--color-background);
}

[data-theme="dark"] .layout {
  background: var(--color-background);
}

[data-theme="dark"] .sidebar {
  background: #1A1A1A;
  border-right-color: var(--color-border);
}

[data-theme="dark"] .topbar {
  border-color: var(--color-border);
}

[data-theme="dark"] .card,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .modal,
[data-theme="dark"] .kanban-card {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .search-pill,
[data-theme="dark"] .icon-chip,
[data-theme="dark"] .avatar-pill {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-muted);
}

[data-theme="dark"] .avatar-pill .avatar-dot,
[data-theme="dark"] .sidebar-brand .brand-mark,
[data-theme="dark"] .kpi-card .kpi-icon {
  background: var(--color-surface-soft);
}

[data-theme="dark"] .pipeline-stage {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea.form-control {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--color-text);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(231, 154, 90, 0.22);
}

[data-theme="dark"] thead th {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] tbody td {
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] tbody tr:hover td {
  background: var(--color-surface-soft);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .pipeline-stage-header {
  border-color: var(--color-border);
}

[data-theme="dark"] .btn-secondary {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

[data-theme="dark"] .btn-secondary:hover {
  background: var(--color-surface-soft);
  border-color: var(--color-primary);
}

[data-theme="dark"] .btn-ghost:hover {
  background: var(--color-surface-soft);
}

[data-theme="dark"] .empty-state .icon {
  opacity: 0.95;
}

@media (max-width: 980px) {
  .sidebar { width: 220px; }
  .main-content { padding: 24px 20px 32px; }
  .login-shell { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .main-content { margin-left: 0; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .grid-2 { grid-template-columns: 1fr; }
}
