/* ═══════════════════════════════════════════════════════════════════
   DASHBOARD FREELANCE — Design System Premium
   Inspirado en Linear · Vercel · Notion
   Tema oscuro nativo · Mobile-first
═══════════════════════════════════════════════════════════════════ */

/* ─── Variables ──────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --color-bg:        #060609;
  --color-surface:   #0d0d15;
  --color-surface-2: #131320;
  --color-surface-3: #1a1a2b;

  /* Borders */
  --color-border:       rgba(255,255,255,0.07);
  --color-border-hover: rgba(255,255,255,0.13);
  --color-border-focus: rgba(124,110,245,0.6);

  /* Text */
  --color-text:   #e1e4e8;
  --color-text-2: #7d8590;
  --color-text-3: #3d444d;

  /* Brand / Primary */
  --color-primary:       #7c6ef5;
  --color-primary-hover: #6d5fe4;
  --color-primary-light: rgba(124,110,245,0.12);
  --color-primary-glow:  rgba(124,110,245,0.25);

  /* Status */
  --color-success:      #3fb950;
  --color-success-bg:   rgba(63,185,80,0.12);
  --color-warning:      #d29922;
  --color-warning-bg:   rgba(210,153,34,0.12);
  --color-danger:       #f85149;
  --color-danger-bg:    rgba(248,81,73,0.12);
  --color-info:         #58a6ff;
  --color-info-bg:      rgba(88,166,255,0.12);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.5);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5), 0 1px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.6), 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.7), 0 2px 8px rgba(0,0,0,0.5);
  --shadow-xl: 0 24px 48px rgba(0,0,0,0.8), 0 4px 12px rgba(0,0,0,0.5);
  --shadow-primary: 0 0 0 3px rgba(124,110,245,0.15), 0 0 20px rgba(124,110,245,0.08);

  /* Dimensions */
  --sidebar-w: 240px;
  --header-h:  48px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Typography */
  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Animation */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 0.15s ease;
}

/* Light mode override */
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --color-bg:        #f4f4f8;
    --color-surface:   #ffffff;
    --color-surface-2: #f0f0f5;
    --color-surface-3: #e8e8f0;
    --color-border:    rgba(0,0,0,0.08);
    --color-border-hover: rgba(0,0,0,0.16);
    --color-text:      #1a1a2e;
    --color-text-2:    #5a5a7a;
    --color-text-3:    #9090b0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  }
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* Aura Radial */
body::before {
  content: '';
  position: absolute;
  top: -10%; left: 10%; width: 80vw; height: 60vh;
  background: radial-gradient(ellipse at center, var(--color-primary-light) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ─── Layout ─────────────────────────────────────────────────────── */
#app-layout {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ─── Header ─────────────────────────────────────────────────────── */
.app-header {
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  padding-left: 14px;
  padding-right: 14px;
  gap: 12px;
  background: rgba(6,6,9,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.hamburger-btn {
  display: none;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-text-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.hamburger-btn:hover { background: var(--color-surface-2); color: var(--color-text); }

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  user-select: none;
}
.header-brand-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
}
.header-brand-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 1px 6px;
  border-radius: 99px;
  border: 1px solid rgba(124,110,245,0.2);
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-page-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-2);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-date {
  font-size: 12px;
  color: var(--color-text-3);
  font-variant-numeric: tabular-nums;
}
.header-divider {
  width: 1px;
  height: 18px;
  background: var(--color-border);
}
.header-user {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}
.header-user:hover { background: var(--color-surface-2); }
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c6ef5, #5b4fcf);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text-2);
}

.btn-logout {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-2);
  transition: all var(--transition);
}
.btn-logout:hover {
  background: var(--color-danger-bg);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* ─── Sidebar ────────────────────────────────────────────────────── */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(6,6,9,0.6);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  overflow-x: clip;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 8px 8px;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-3);
  padding: 12px 10px 5px;
}

.nav-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 450;
  color: var(--color-text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--color-text);
}
.nav-item:active { background: rgba(255,255,255,0.06); }

.nav-item.active {
  background: var(--color-primary-light);
  color: #b4a9ff;
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 2.5px;
  background: var(--color-primary);
  border-radius: 0 3px 3px 0;
}
.nav-item.active .nav-icon { color: var(--color-primary); }
.nav-badge {
  margin-left: auto;
  background: var(--color-danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
  min-width: 16px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid var(--color-border);
}
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--color-text-3);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-online { background: var(--color-success); box-shadow: 0 0 6px var(--color-success); }

/* ─── Main ───────────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
}
.main-inner {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px;
}

/* ─── Sections + page transitions ────────────────────────────────── */
.section { display: none; }
.section.active {
  display: block;
  position: relative;
  animation: pageIn 0.22s var(--ease) both;
}
@keyframes pageIn {
  from { opacity: 0; top: 6px; }
  to   { opacity: 1; top: 0; }
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.5px;
}
.section-subtitle {
  font-size: 13px;
  color: var(--color-text-3);
  margin-top: 1px;
}
.section-spacer { flex: 1; }

/* ─── Stats grid ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.015) 0%, transparent 60%);
  pointer-events: none;
}
.stat-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  line-height: 1.1;
}
.stat-sub {
  font-size: 11.5px;
  color: var(--color-text-3);
  margin-top: 5px;
}
.stat-card.primary {
  border-top: 2px solid var(--color-primary);
  background: linear-gradient(160deg, rgba(124,110,245,0.06) 0%, var(--color-surface) 50%);
}
.stat-card.primary .stat-value { color: var(--color-primary); }
.stat-card.success {
  border-top: 2px solid var(--color-success);
  background: linear-gradient(160deg, rgba(63,185,80,0.06) 0%, var(--color-surface) 50%);
}
.stat-card.success .stat-value { color: var(--color-success); }
.stat-card.warning {
  border-top: 2px solid var(--color-warning);
  background: linear-gradient(160deg, rgba(210,153,34,0.06) 0%, var(--color-surface) 50%);
}
.stat-card.warning .stat-value { color: var(--color-warning); }
.stat-card.danger {
  border-top: 2px solid var(--color-danger);
  background: linear-gradient(160deg, rgba(248,81,73,0.06) 0%, var(--color-surface) 50%);
}
.stat-card.danger  .stat-value { color: var(--color-danger); }

/* ─── Card ───────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--color-border-hover); }
.card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-3);
  margin-bottom: 14px;
}
.card-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  user-select: none;
  position: relative;
  text-decoration: none;
}
.btn [data-lucide], .btn svg { width: 16px; height: 16px; stroke-width: 2px; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(to bottom, #8276f7, #6d5fe4);
  color: #fff;
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover {
  background: linear-gradient(to bottom, #9087f8, #7a6de8);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.12), 0 0 0 3px rgba(124,110,245,0.18);
}

.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text-2);
  border-color: var(--color-border);
}
.btn-secondary:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
  border-color: var(--color-border-hover);
}

.btn-success {
  background: linear-gradient(to bottom, #47c95a, #35a347);
  color: #fff;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.btn-success:hover {
  background: linear-gradient(to bottom, #52d464, #3cb050);
  box-shadow: 0 0 0 3px rgba(63,185,80,0.2);
}

.btn-danger {
  background: linear-gradient(to bottom, #fa6060, #e63e3b);
  color: #fff;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.btn-danger:hover { box-shadow: 0 0 0 3px rgba(248,81,73,0.2); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-2);
  border-color: transparent;
  padding: 0 8px;
}
.btn-ghost:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-sm   { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-lg   { height: 38px; padding: 0 20px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { width: 30px; height: 30px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 26px; height: 26px; }

/* ─── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-verde    { background: var(--color-success-bg);  color: var(--color-success);  border-color: rgba(63,185,80,0.2); }
.badge-amarillo { background: var(--color-warning-bg);  color: var(--color-warning);  border-color: rgba(210,153,34,0.2); }
.badge-rojo     { background: var(--color-danger-bg);   color: var(--color-danger);   border-color: rgba(248,81,73,0.2); }
.badge-primary  { background: var(--color-primary-light); color: #b4a9ff; border-color: rgba(124,110,245,0.2); }
.badge-gray     { background: var(--color-surface-2);   color: var(--color-text-2);  border-color: var(--color-border); }
.badge-blue     { background: var(--color-info-bg);     color: var(--color-info);    border-color: rgba(88,166,255,0.2); }

/* ─── Semáforo ───────────────────────────────────────────────────── */
.semaforo {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.semaforo.verde    { background: var(--color-success); box-shadow: 0 0 6px rgba(63,185,80,0.5); }
.semaforo.amarillo { background: var(--color-warning); box-shadow: 0 0 6px rgba(210,153,34,0.5); }
.semaforo.rojo     { background: var(--color-danger);  box-shadow: 0 0 6px rgba(248,81,73,0.5); }

/* ─── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-2);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  height: 34px;
  padding: 0 11px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124,110,245,0.15);
  background: var(--color-surface-3);
}
.form-control::placeholder { color: var(--color-text-3); }
textarea.form-control {
  height: auto;
  padding: 9px 11px;
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}
select.form-control { cursor: pointer; }
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 11px; color: var(--color-text-3); margin-top: 4px; }

.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-right: 36px; }
.input-icon-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
}
.input-icon-btn:hover { color: var(--color-text-2); }

/* ─── Table ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { }
th {
  text-align: left;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-3);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  color: var(--color-text-2);
}
td strong { color: var(--color-text); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* ─── Progress bar ───────────────────────────────────────────────── */
.progress {
  background: var(--color-surface-3);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(to right, var(--color-primary), #9b8ef8);
  border-radius: 99px;
  transition: width 0.5s var(--ease);
}
.progress-bar.success { background: linear-gradient(to right, var(--color-success), #56d464); }
.progress-bar.warning { background: linear-gradient(to right, var(--color-warning), #e8c458); }
.progress-bar.danger  { background: linear-gradient(to right, var(--color-danger),  #fa7070); }

/* ─── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  overflow-y: auto;
  padding: 24px 20px;
}
.modal-overlay.open {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: overlayIn 0.18s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border-hover);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 520px;
  width: 100%;
  flex-shrink: 0;
  margin: auto 0;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: modalIn 0.2s var(--ease) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-lg { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
}
.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-3);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  transition: all var(--transition);
}
.modal-close:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border);
  color: var(--color-text);
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

/* ─── Tabs ───────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--color-surface-2);
  padding: 3px;
  border-radius: var(--radius-sm);
  width: fit-content;
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
}
.tab-btn {
  height: 26px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: none;
  color: var(--color-text-3);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--color-text-2); background: rgba(255,255,255,0.03); }
.tab-btn.active {
  background: var(--color-surface-3);
  color: var(--color-text);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--color-border);
}

/* ─── Kanban ─────────────────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: start;
}
.kanban-col {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-3);
}
.kanban-col-count {
  margin-left: auto;
  background: var(--color-surface-3);
  color: var(--color-text-3);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  border: 1px solid var(--color-border);
}
.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px;
  min-height: 80px;
}
.kanban-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: grab;
  transition: all 0.12s ease;
  position: relative;
}
.kanban-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.kanban-card:active { cursor: grabbing; transform: scale(0.98); }
.kanban-card.dragging { opacity: 0.4; transform: rotate(1.5deg) scale(1.02); }
.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 7px;
  line-height: 1.4;
}
.kanban-card-meta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }

/* ─── Sección Hoy ────────────────────────────────────────────────── */
.hoy-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
.ia-card {
  background: linear-gradient(135deg, rgba(92,79,207,0.2) 0%, rgba(72,54,180,0.1) 100%);
  border: 1px solid rgba(124,110,245,0.2);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.ia-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(120deg, transparent, rgba(124,110,245,0.8), transparent);
  animation: bgGlow 4s linear infinite;
  z-index: 0;
}
.ia-card::after {
  content: '';
  position: absolute;
  inset: 1px;
  background: linear-gradient(135deg, rgba(20,18,35,0.9) 0%, rgba(13,13,21,0.9) 100%);
  border-radius: calc(var(--radius-md) - 1px);
  z-index: 1;
}
@keyframes bgGlow {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.ia-label, .ia-text, .btn-ia { position: relative; z-index: 2; }
.ia-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(180,169,255,0.6);
  margin-bottom: 8px;
}
.ia-text {
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(225,228,232,0.9);
}
.btn-ia {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  background: rgba(124,110,245,0.2);
  color: #b4a9ff;
  border: 1px solid rgba(124,110,245,0.3);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 28px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-ia:hover { background: rgba(124,110,245,0.3); border-color: rgba(124,110,245,0.5); }

/* ─── Cliente cards ──────────────────────────────────────────────── */
.cliente-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.cliente-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}
.cliente-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.01) 0%, transparent 50%);
  pointer-events: none;
}
.cliente-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.cliente-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cliente-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(124,110,245,0.3), rgba(91,79,207,0.2));
  border: 1px solid rgba(124,110,245,0.2);
  color: #b4a9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.cliente-name { font-weight: 600; font-size: 14px; color: var(--color-text); }
.cliente-empresa { font-size: 11.5px; color: var(--color-text-3); margin-top: 1px; }
.cliente-actions { display: flex; gap: 6px; margin-top: 12px; }

/* ─── Flujos / Timer ─────────────────────────────────────────────── */
.timer-display {
  font-size: 48px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  color: var(--color-primary);
  text-align: center;
  letter-spacing: -2px;
  margin: 16px 0;
  text-shadow: 0 0 30px rgba(124,110,245,0.3);
}
.timer-controls { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }

.paso-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 6px;
  background: var(--color-surface-2);
  transition: all var(--transition);
}
.paso-item.activo {
  border-color: rgba(124,110,245,0.4);
  background: var(--color-primary-light);
}
.paso-item.completado { opacity: 0.35; }
.paso-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--color-surface-3);
  border: 1.5px solid var(--color-border-hover);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
  color: var(--color-text-3);
}
.paso-item.activo .paso-num { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.paso-item.completado .paso-num { background: var(--color-success); border-color: var(--color-success); color: #fff; }

/* ─── Finanzas bars ──────────────────────────────────────────────── */
.finanzas-bars {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 72px;
  margin-top: 12px;
}
.finanzas-bar {
  flex: 1;
  background: linear-gradient(to top, var(--color-primary), rgba(124,110,245,0.4));
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  opacity: 0.7;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}
.finanzas-bar:hover { opacity: 1; }
.finanzas-bar-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--color-text-3);
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* ─── Timeline ───────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 0; bottom: 0;
  width: 1px;
  background: var(--color-border);
}
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-dot {
  position: absolute;
  left: -18px;
  top: 5px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-primary);
}
.timeline-dot.nota    { background: var(--color-info); box-shadow: 0 0 0 1px var(--color-info); }
.timeline-dot.llamada { background: var(--color-success); box-shadow: 0 0 0 1px var(--color-success); }
.timeline-dot.email   { background: var(--color-warning); box-shadow: 0 0 0 1px var(--color-warning); }
.timeline-dot.whatsapp{ background: #25d366; box-shadow: 0 0 0 1px #25d366; }
.timeline-date {
  font-size: 11px;
  color: var(--color-text-3);
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.timeline-content {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--color-text-2);
  line-height: 1.5;
}

/* ─── Vault / Credenciales ───────────────────────────────────────── */
.cred-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}
.cred-item:last-child { border-bottom: none; }
.cred-name { font-weight: 500; font-size: 13px; color: var(--color-text); }
.cred-user { font-size: 11.5px; color: var(--color-text-3); }

/* ─── Toast ──────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-hover);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--color-text);
  max-width: 340px;
  animation: toastIn 0.2s var(--ease) both;
}
@keyframes toastIn {
  from { transform: translateX(120%) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}
.toast-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}
.toast.success .toast-icon { background: var(--color-success-bg); color: var(--color-success); }
.toast.error   .toast-icon { background: var(--color-danger-bg);  color: var(--color-danger); }
.toast.info    .toast-icon { background: var(--color-info-bg);    color: var(--color-info); }
.toast.success { border-left: 2px solid var(--color-success); }
.toast.error   { border-left: 2px solid var(--color-danger); }
.toast.info    { border-left: 2px solid var(--color-primary); }

/* ─── Empty state ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--color-text-3);
}
.empty-state .icon {
  font-size: 32px;
  margin-bottom: 14px;
  opacity: 0.4;
  display: block;
}
.empty-state h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-2);
  margin-bottom: 6px;
}
.empty-state p { font-size: 13px; color: var(--color-text-3); }

/* ─── Spinner ────────────────────────────────────────────────────── */
.page-loader {
  display: flex; justify-content: center; align-items: center; height: 300px;
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--color-surface-3);
  border-top-color: var(--color-primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm {
  width: 14px; height: 14px; border-width: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Skeleton Loaders ───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-3) 25%, var(--color-surface-2) 50%, var(--color-surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
  opacity: 0.7;
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton-title { width: 120px; height: 20px; margin-bottom: 8px; }
.skeleton-text { width: 100%; height: 12px; margin-bottom: 6px; }
.skeleton-text.short { width: 60%; }
.skeleton-card {
  padding: 16px; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); margin-bottom: 8px;
}

/* ─── IA Card Glow ───────────────────────────────────────────────── */
.ia-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ia-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, var(--color-primary), transparent, var(--color-primary));
  z-index: -1;
  animation: glow 3s linear infinite;
  opacity: 0.3;
}
@keyframes glow { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }

/* ─── Body Aura ──────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(124,110,245,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* ─── Divider ────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--color-border); margin: 18px 0; }

/* ─── Login ──────────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg);
  padding: 20px;
}
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 360px;
}
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-hover);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(124,110,245,0.5), transparent);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.login-sub {
  font-size: 13px;
  color: var(--color-text-3);
  margin-bottom: 24px;
  line-height: 1.5;
}
.login-error {
  font-size: 12.5px;
  color: var(--color-danger);
  background: var(--color-danger-bg);
  border: 1px solid rgba(248,81,73,0.2);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  margin-bottom: 12px;
  min-height: 0;
  display: none;
}
.login-error:not(:empty) { display: block; }
.login-footer {
  font-size: 11.5px;
  color: var(--color-text-3);
  text-align: center;
}

/* ─── Search input ───────────────────────────────────────────────── */
.search-input {
  height: 32px;
  padding: 0 11px 0 32px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%233d444d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}
.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124,110,245,0.15);
}

/* ─── Misc ───────────────────────────────────────────────────────── */
.text-muted  { color: var(--color-text-3); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.font-mono   { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-bold   { font-weight: 700; }

.surface-2 { background: var(--color-surface-2); }
.rounded    { border-radius: var(--radius-sm); }
.flex       { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ─── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 840px) {
  .hamburger-btn { display: flex; }
  .header-center { display: none; }

  .app-sidebar {
    position: fixed;
    left: -100%;
    top: var(--header-h);
    z-index: 90;
    height: calc(100vh - var(--header-h));
    transition: left 0.22s var(--ease);
    box-shadow: none;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface);
  }
  .app-sidebar.open {
    left: 0;
    box-shadow: var(--shadow-xl);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 89;
  }
  .sidebar-backdrop.open { display: block; }

  .main-inner { padding: 18px 16px; }
  .kanban-board { grid-template-columns: 1fr 1fr; }
  .hoy-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .kanban-board { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .main-inner { padding: 14px 12px; }
}
