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

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

:root {
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --border: rgba(226, 232, 240, 0.7);
  --border-solid: #e2e8f0;

  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --text4: #cbd5e1;

  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #eff6ff;
  --blue-mid: #bfdbfe;
  --green: #059669;
  --green-light: #ecfdf5;
  --orange: #d97706;
  --orange-light: #fffbeb;
  --red: #dc2626;
  --red-light: #fef2f2;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;

  --sidebar-w: 260px;
  --topbar-h: 64px;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 20px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.06), 0 12px 36px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 20px rgba(0,0,0,0.08), 0 24px 56px rgba(0,0,0,0.12);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; background: none; }
input, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* ─── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border-solid);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 2px 0 20px rgba(0,0,0,0.05);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-solid);
}
.sidebar-logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; color: white;
  letter-spacing: -0.5px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(37,99,235,0.4), 0 1px 3px rgba(0,0,0,0.1);
}
.sidebar-brand-text strong {
  display: block; color: var(--text); font-size: 13px; font-weight: 800; line-height: 1.3;
}
.sidebar-brand-text span {
  font-size: 11px; color: var(--text3); font-weight: 500; letter-spacing: 0.01em;
}

.sidebar-nav { flex: 1; padding: 10px 12px; }

.sidebar-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.09em;
  color: var(--text4); text-transform: uppercase;
  padding: 16px 8px 6px;
}

.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  color: var(--text2);
  transition: all 0.15s ease;
  margin-bottom: 1px;
  position: relative;
}
.sidebar-item:hover { background: var(--bg); color: var(--text); }
.sidebar-item.active {
  background: linear-gradient(135deg, var(--blue-light) 0%, rgba(124,58,237,0.05) 100%);
  color: var(--blue);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(37,99,235,0.12);
}
.sidebar-item.active::before {
  content: '';
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: linear-gradient(180deg, #2563eb, #7c3aed);
  border-radius: 0 3px 3px 0;
}
.sidebar-icon-wrap {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text3);
  transition: all 0.15s;
}
.sidebar-item.active .sidebar-icon-wrap {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  box-shadow: 0 2px 8px rgba(37,99,235,0.4);
}
.sidebar-item:hover:not(.active) .sidebar-icon-wrap {
  background: var(--bg);
  color: var(--text2);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-solid);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-user:hover { background: var(--bg); }
.sidebar-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: white; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37,99,235,0.3);
}
.sidebar-user-info strong { display: block; font-size: 12.5px; color: var(--text); font-weight: 700; }
.sidebar-user-info span { font-size: 11px; color: var(--text3); }
.sidebar-logout-icon { margin-left: auto; color: var(--text4); }

/* ═══════════════════════════════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-solid);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.btn-menu {
  display: none;
  color: var(--text2); padding: 6px;
  border-radius: var(--radius-sm);
}
.topbar-title { font-size: 17px; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }
.topbar-sub { font-size: 12px; color: var(--text3); font-weight: 500; margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-solid);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; position: relative;
}
.topbar-icon-btn:hover { background: var(--border-solid); color: var(--text); }
.notif-badge {
  position: absolute; top: -5px; right: -5px;
  width: 18px; height: 18px;
  background: var(--red); border-radius: 50%;
  font-size: 9px; color: white; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(220,38,38,0.4);
}
.topbar-profile {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-solid);
  border-radius: 24px; cursor: pointer; transition: all 0.15s;
}
.topbar-profile:hover { background: var(--border-solid); }
.topbar-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: white;
  box-shadow: 0 1px 4px rgba(37,99,235,0.3);
}
.topbar-profile-name { font-size: 13px; font-weight: 700; color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
}
.page-content { padding: 32px; max-width: 1280px; }

/* ═══════════════════════════════════════════════════════════════════
   WELCOME BAR
═══════════════════════════════════════════════════════════════════ */
.welcome-bar {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px;
}
.welcome-greeting { font-size: 26px; font-weight: 900; color: var(--text); line-height: 1.2; letter-spacing: -0.5px; }
.welcome-sub { font-size: 14px; color: var(--text2); margin-top: 5px; font-weight: 500; }
.date-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-solid);
  border-radius: 20px;
  font-size: 13px; font-weight: 600; color: var(--text2);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0; white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   KPI CARDS
═══════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: linear-gradient(145deg, #ffffff 0%, #fafcff 100%);
  border: 1px solid rgba(226,232,240,0.8);
  border-radius: var(--radius-xl);
  padding: 24px 24px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

/* decorative blob background */
.kpi-card::before {
  content: '';
  position: absolute;
  top: -24px; right: -24px;
  width: 110px; height: 110px;
  background: var(--kpi-bg, rgba(37,99,235,0.06));
  border-radius: 50%;
  pointer-events: none;
  transition: transform 0.3s;
}
.kpi-card:hover::before { transform: scale(1.1); }

/* bottom accent line */
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--kpi-accent, var(--blue)), color-mix(in srgb, var(--kpi-accent, var(--blue)) 60%, transparent));
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }

.kpi-icon {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: var(--kpi-bg, var(--blue-light));
  border: 1px solid rgba(0,0,0,0.04);
  display: flex; align-items: center; justify-content: center;
  color: var(--kpi-color, var(--blue));
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.kpi-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; padding: 4px 9px;
  border-radius: 20px; white-space: nowrap;
  letter-spacing: 0.01em;
}
.badge-red { background: rgba(220,38,38,0.1); color: var(--red); border: 1px solid rgba(220,38,38,0.15); }
.badge-orange { background: rgba(217,119,6,0.1); color: var(--orange); border: 1px solid rgba(217,119,6,0.15); }
.badge-green { background: rgba(5,150,105,0.1); color: var(--green); border: 1px solid rgba(5,150,105,0.15); }
.badge-blue { background: rgba(37,99,235,0.1); color: var(--blue); border: 1px solid rgba(37,99,235,0.15); }
.badge-purple { background: rgba(124,58,237,0.1); color: var(--purple); border: 1px solid rgba(124,58,237,0.15); }

.kpi-value {
  font-size: 32px; font-weight: 900; color: var(--text); line-height: 1;
  margin-bottom: 6px; letter-spacing: -1px;
}
.kpi-label {
  font-size: 11.5px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px;
}
.kpi-sub { font-size: 12px; color: var(--text3); font-weight: 500; }

.kpi-progress-track {
  height: 6px; background: var(--bg); border-radius: 6px;
  margin-top: 16px; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.kpi-progress-fill {
  height: 100%; border-radius: 6px;
  background: var(--kpi-accent, var(--blue));
  transition: width 1s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* ═══════════════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(226,232,240,0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(226,232,240,0.6);
}
.card-title { font-size: 14px; font-weight: 800; color: var(--text); letter-spacing: -0.2px; }
.card-subtitle { font-size: 12px; color: var(--text3); margin-top: 3px; font-weight: 500; }
.card-body { padding: 22px 24px 24px; }

/* ─── Grids ──────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.grid-3-1 { display: grid; grid-template-columns: 1.8fr 1fr; gap: 20px; margin-bottom: 24px; }

/* ═══════════════════════════════════════════════════════════════════
   RECEIVABLES BAR CHART
═══════════════════════════════════════════════════════════════════ */
.recv-list { display: flex; flex-direction: column; gap: 16px; }
.recv-row { display: flex; align-items: center; gap: 14px; }
.recv-month {
  width: 36px; font-size: 11.5px; font-weight: 800; color: var(--text);
  flex-shrink: 0; letter-spacing: 0.01em;
}
.recv-track {
  flex: 1; height: 12px;
  background: var(--bg);
  border-radius: 12px; overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.07);
}
.recv-fill {
  height: 100%; border-radius: 12px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.fill-blue { background: linear-gradient(90deg, #2563eb 0%, #60a5fa 100%); box-shadow: 0 1px 4px rgba(37,99,235,0.4); }
.fill-blue-mid { background: linear-gradient(90deg, #3b82f6 0%, #93c5fd 100%); }
.fill-orange { background: linear-gradient(90deg, #d97706 0%, #fbbf24 100%); box-shadow: 0 1px 4px rgba(217,119,6,0.3); }
.fill-red { background: linear-gradient(90deg, #dc2626 0%, #f87171 100%); box-shadow: 0 1px 4px rgba(220,38,38,0.3); }

.recv-value {
  font-size: 12px; font-weight: 800; color: var(--text);
  width: 80px; text-align: right; flex-shrink: 0; letter-spacing: -0.2px;
}
.recv-footer {
  margin-top: 20px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(220,38,38,0.04) 0%, rgba(220,38,38,0.02) 100%);
  border: 1px solid rgba(220,38,38,0.14);
  border-radius: var(--radius);
  display: flex; align-items: flex-start; gap: 12px;
}
.recv-footer-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(220,38,38,0.1);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--red); margin-top: 1px;
}
.recv-footer-text { font-size: 12px; color: var(--text2); line-height: 1.5; }
.recv-footer-text a { color: var(--blue); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════
   DONUT CHART
═══════════════════════════════════════════════════════════════════ */
.donut-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 0 16px;
}
.donut-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.donut-svg { transform: rotate(-90deg); overflow: visible; display: block; }
.donut-bg { fill: none; stroke: #f0f4f8; stroke-width: 14; }
.donut-fill {
  fill: none; stroke: var(--blue); stroke-width: 14;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.4s cubic-bezier(.4,0,.2,1);
  filter: drop-shadow(0 2px 6px rgba(37,99,235,0.35));
}
.donut-fill.critical {
  stroke: var(--red);
  filter: drop-shadow(0 2px 8px rgba(220,38,38,0.4));
}
.donut-text-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.donut-pct { font-size: 28px; font-weight: 900; color: var(--text); letter-spacing: -1px; line-height: 1; }
.donut-pct-sub { font-size: 11px; color: var(--text3); font-weight: 600; margin-top: 4px; letter-spacing: 0.02em; }

.meta-breakdown { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.meta-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color 0.15s;
}
.meta-row:hover { border-color: var(--border-solid); }
.meta-row-label {
  font-size: 12px; color: var(--text2); font-weight: 600;
  display: flex; align-items: center; gap: 9px;
}
.meta-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.meta-row-value { font-size: 13px; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }

/* ═══════════════════════════════════════════════════════════════════
   FUNIL
═══════════════════════════════════════════════════════════════════ */
.funil-list { display: flex; flex-direction: column; gap: 8px; }
.funil-step {
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--step-color, var(--blue));
  transition: all 0.15s;
  border: 1px solid transparent;
  border-left: 3px solid var(--step-color, var(--blue));
}
.funil-step:hover { background: var(--bg-card); border-color: var(--border-solid); border-left-color: var(--step-color, var(--blue)); box-shadow: var(--shadow-xs); }
.funil-step-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.funil-step-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.funil-step-nums { display: flex; align-items: baseline; gap: 8px; }
.funil-step-count {
  font-size: 22px; font-weight: 900; color: var(--step-color, var(--blue));
  letter-spacing: -0.5px; line-height: 1;
}
.funil-step-pct { font-size: 11px; font-weight: 700; color: var(--text3); }
.funil-bar-track {
  height: 5px; background: var(--border-solid);
  border-radius: 5px; overflow: hidden;
}
.funil-bar-fill { height: 100%; border-radius: 5px; background: var(--step-color, var(--blue)); opacity: 0.75; }

/* ═══════════════════════════════════════════════════════════════════
   ALERTAS
═══════════════════════════════════════════════════════════════════ */
.alerta-list { display: flex; flex-direction: column; gap: 12px; }
.alerta-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid;
  transition: all 0.15s;
}
.alerta-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.alerta-card.critical {
  background: linear-gradient(135deg, rgba(220,38,38,0.04) 0%, rgba(220,38,38,0.02) 100%);
  border-color: rgba(220,38,38,0.2);
}
.alerta-card.warning {
  background: linear-gradient(135deg, rgba(217,119,6,0.04) 0%, rgba(217,119,6,0.02) 100%);
  border-color: rgba(217,119,6,0.2);
}
.alerta-icon-wrap {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.critical .alerta-icon-wrap {
  background: linear-gradient(135deg, rgba(220,38,38,0.15), rgba(220,38,38,0.08));
  color: var(--red);
  box-shadow: 0 1px 4px rgba(220,38,38,0.2);
}
.warning .alerta-icon-wrap {
  background: linear-gradient(135deg, rgba(217,119,6,0.15), rgba(217,119,6,0.08));
  color: var(--orange);
  box-shadow: 0 1px 4px rgba(217,119,6,0.2);
}
.alerta-body { flex: 1; }
.alerta-title { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.alerta-desc { font-size: 12px; color: var(--text2); line-height: 1.5; }
.alerta-action {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 9px; font-size: 12px; font-weight: 700; color: var(--blue);
  padding: 5px 10px;
  background: var(--blue-light);
  border: 1px solid rgba(37,99,235,0.15);
  border-radius: 7px;
  transition: all 0.15s;
}
.alerta-action:hover { background: var(--blue-mid); }

/* ═══════════════════════════════════════════════════════════════════
   AGENTS QUICK GRID
═══════════════════════════════════════════════════════════════════ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 13px; font-weight: 800; color: var(--text); white-space: nowrap; letter-spacing: -0.1px; }
.section-divider { flex: 1; height: 1px; background: var(--border-solid); margin-left: 16px; }

.agents-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}
.agent-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid rgba(226,232,240,0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: all 0.2s;
  position: relative; overflow: hidden;
}
.agent-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--agent-color, var(--blue)), color-mix(in srgb, var(--agent-color, var(--blue)) 60%, transparent));
}
.agent-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-solid); }
.agent-icon-wrap {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--agent-bg, var(--blue-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.agent-info { flex: 1; min-width: 0; }
.agent-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.agent-desc { font-size: 11.5px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-arrow { color: var(--text4); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════════════════════ */
.login-page {
  display: flex; min-height: 100vh;
}
.login-left {
  flex: 1;
  background: linear-gradient(145deg, #0a0f1e 0%, #0f1f40 50%, #0d1a35 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.login-left::after {
  content: '';
  position: absolute; bottom: -100px; left: -50px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(124,58,237,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.login-left-content { max-width: 400px; position: relative; z-index: 1; }
.login-left-logo {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 16px; color: white;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(37,99,235,0.5);
}
.login-left h1 { font-size: 28px; font-weight: 900; color: white; line-height: 1.25; margin-bottom: 12px; letter-spacing: -0.5px; }
.login-left p { font-size: 15px; color: #7c8ba3; line-height: 1.7; margin-bottom: 36px; }
.login-feature { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.login-feature-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 16px;
}
.login-feature-text strong { display: block; color: rgba(255,255,255,0.9); font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.login-feature-text span { font-size: 12px; color: #64748b; line-height: 1.4; }

.login-right {
  width: 440px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
  background: var(--bg-card);
}
.login-form-wrap { width: 100%; }
.login-form-title { font-size: 22px; font-weight: 900; color: var(--text); margin-bottom: 6px; letter-spacing: -0.4px; }
.login-form-sub { font-size: 13px; color: var(--text3); margin-bottom: 32px; font-weight: 500; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 700; color: var(--text2); }
.form-input {
  border: 1.5px solid var(--border-solid);
  border-radius: var(--radius-sm);
  color: var(--text); padding: 12px 14px;
  font-size: 14px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg-subtle);
  width: 100%;
}
.form-input:focus { border-color: var(--blue); background: white; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.btn-login {
  width: 100%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white; border-radius: var(--radius-sm);
  padding: 13px; font-size: 14px; font-weight: 700;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 6px;
  box-shadow: 0 4px 14px rgba(37,99,235,0.4);
  letter-spacing: 0.01em;
}
.btn-login:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,0.45); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.error-msg { color: var(--red); font-size: 12.5px; text-align: center; margin-top: 10px; font-weight: 600; }

@media (max-width: 768px) {
  .login-left { display: none; }
  .login-right { width: 100%; padding: 40px 24px; }
}

/* ═══════════════════════════════════════════════════════════════════
   CHAT PAGE
═══════════════════════════════════════════════════════════════════ */
.chat-page { display: flex; height: 100vh; overflow: hidden; }

.chat-container {
  flex: 1; display: flex; flex-direction: column;
  margin-left: var(--sidebar-w); overflow: hidden;
}

.chat-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; height: var(--topbar-h);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-solid);
  flex-shrink: 0;
}
.chat-agent-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.chat-agent-name { font-size: 15px; font-weight: 800; color: var(--text); letter-spacing: -0.2px; }
.chat-agent-desc { font-size: 12px; color: var(--text3); margin-top: 1px; }
.chat-header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.btn-clear-chat {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--bg-subtle); border: 1px solid var(--border-solid);
  border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; color: var(--text2);
  transition: all 0.15s;
}
.btn-clear-chat:hover { border-color: var(--red); color: var(--red); background: rgba(220,38,38,0.04); }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 28px;
  display: flex; flex-direction: column; gap: 22px;
  background: var(--bg);
}

.chat-welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 48px 24px; flex: 1; min-height: 300px;
}
.welcome-agent-icon {
  width: 76px; height: 76px; border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin-bottom: 22px;
  box-shadow: var(--shadow-md);
}
.chat-welcome h3 { font-size: 22px; font-weight: 900; color: var(--text); margin-bottom: 10px; letter-spacing: -0.4px; }
.chat-welcome p { font-size: 14px; color: var(--text2); max-width: 440px; line-height: 1.7; margin-bottom: 28px; }
.suggestions {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; max-width: 640px;
}
.suggestion-chip {
  padding: 9px 18px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-solid);
  border-radius: 20px;
  font-size: 13px; font-weight: 500; color: var(--text2);
  transition: all 0.15s;
  box-shadow: var(--shadow-xs);
}
.suggestion-chip:hover {
  background: var(--blue); border-color: var(--blue); color: white;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
  transform: translateY(-1px);
}

.msg { display: flex; gap: 12px; max-width: 820px; }
.msg-user { flex-direction: row-reverse; align-self: flex-end; }
.msg-assistant { align-self: flex-start; }

.msg-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px; font-size: 13px; font-weight: 800;
}
.msg-user .msg-avatar {
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: white;
  box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}
.msg-assistant .msg-avatar {
  background: var(--bg-card); border: 1.5px solid var(--border-solid);
  font-size: 18px; box-shadow: var(--shadow-xs);
}

.msg-bubble { max-width: calc(100% - 48px); }
.msg-content {
  padding: 13px 18px; border-radius: 18px;
  font-size: 14px; line-height: 1.7;
}
.msg-user .msg-content {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white; border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(37,99,235,0.3);
}
.msg-assistant .msg-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.msg-content h2 { font-size: 15px; margin: 14px 0 6px; font-weight: 800; }
.msg-content h3 { font-size: 14px; margin: 12px 0 4px; font-weight: 700; }
.msg-content h4 { font-size: 13px; margin: 10px 0 4px; font-weight: 700; }
.msg-content ul, .msg-content ol { padding-left: 20px; margin: 8px 0; }
.msg-content li { margin-bottom: 5px; }
.msg-content p { margin-bottom: 8px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content strong { font-weight: 700; }
.msg-content code {
  background: rgba(37,99,235,0.1); padding: 2px 7px;
  border-radius: 5px; font-family: monospace; font-size: 12.5px;
}
.msg-user .msg-content code { background: rgba(255,255,255,0.2); }
.msg-content table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.msg-content th, .msg-content td { border: 1px solid var(--border-solid); padding: 8px 12px; }
.msg-content th { background: var(--bg); font-weight: 700; }

.typing-dot {
  display: inline-block; width: 6px; height: 6px;
  background: var(--text3); border-radius: 50%; margin: 0 2px;
  animation: bounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}
.msg-error { color: var(--red); font-size: 13px; }

.chat-input-area {
  padding: 18px 28px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-solid);
  flex-shrink: 0;
}
.chat-input-box {
  display: flex; align-items: flex-end; gap: 12px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-solid);
  border-radius: 16px; padding: 10px 10px 10px 18px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.chat-input-box:focus-within {
  border-color: var(--blue);
  background: white;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.08);
}
#chatInput {
  flex: 1; background: transparent; border: none;
  color: var(--text); font-size: 14px; resize: none;
  outline: none; max-height: 160px; line-height: 1.6; padding: 4px 0;
}
#chatInput::placeholder { color: var(--text3); }
.btn-send {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
  box-shadow: 0 3px 8px rgba(37,99,235,0.4);
}
.btn-send:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.45); }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════════════
   MOBILE
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .agents-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { left: -280px; transition: left 0.3s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .main-content { margin-left: 0; }
  .chat-container { margin-left: 0; }
  .topbar { left: 0; }
  .btn-menu { display: flex !important; }
  .grid-2, .grid-3-1 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .agents-grid { grid-template-columns: 1fr; }
  .chat-messages { padding: 16px; }
  .chat-input-area { padding: 12px 16px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
