/* ============================================================
   PROSPERIDAD AI AGENT DASHBOARD — Master Stylesheet
   Premium SaaS-grade design system
   ============================================================ */

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

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

:root {
  /* Primary palette */
  --gold-50: #fffbeb;
  --gold-100: #fef3c7;
  --gold-200: #fde68a;
  --gold-300: #fcd34d;
  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --gold-600: #d97706;
  --gold-700: #b45309;

  /* Dark navy */
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --navy-600: #475569;

  /* Neutral */
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;

  /* Semantic */
  --success: #10b981;
  --success-light: #d1fae5;
  --error: #ef4444;
  --error-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --info: #3b82f6;
  --info-light: #dbeafe;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--slate-100);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ============================================================
   LAYOUT SHELL
   ============================================================ */

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--navy-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-footer .system-status span:not(.status-indicator),
.sidebar.collapsed .system-status-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--transition-fast);
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar.collapsed .nav-item i,
.sidebar.collapsed .nav-item svg {
  margin-right: 0;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar.collapsed .sidebar-nav {
  padding: 0 8px;
}

.sidebar.collapsed .nav-section {
  padding: 0;
}

/* Sidebar header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 72px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: var(--navy-900);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: opacity var(--transition-base);
}

.sidebar-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--slate-400);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

/* Sidebar navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

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

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500);
  padding: 0 12px;
  margin-bottom: 6px;
  white-space: nowrap;
  transition: opacity var(--transition-base);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--slate-400);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
  margin-bottom: 2px;
}

.nav-item i,
.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: color var(--transition-fast);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--slate-200);
}

.nav-item.active {
  background: rgba(245, 158, 11, 0.12);
  color: var(--gold-400);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--gold-500);
  border-radius: 0 3px 3px 0;
}

.sidebar.collapsed .nav-item.active::before {
  left: -8px;
}

.nav-item.active i,
.nav-item.active svg {
  color: var(--gold-400);
}

.nav-badge {
  margin-left: auto;
  background: var(--navy-700);
  color: var(--slate-300);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
  transition: opacity var(--transition-base);
}

.nav-badge.pulse {
  background: var(--error);
  color: var(--white);
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.08); }
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--slate-400);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate-500);
  flex-shrink: 0;
}

.status-indicator.online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  animation: status-glow 2.5s ease-in-out infinite;
}

@keyframes status-glow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
  50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.1); }
}

.system-status-text {
  white-space: nowrap;
  transition: opacity var(--transition-base);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--slate-100);
  transition: margin-left var(--transition-slow);
  min-width: 0;
}

.sidebar.collapsed ~ .main-content,
.sidebar.collapsed + .main-content {
  margin-left: var(--sidebar-collapsed);
}

/* ---- Top Bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--slate-100);
  color: var(--text-primary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.breadcrumb span {
  color: var(--text-primary);
  font-weight: 600;
}

.breadcrumb i,
.breadcrumb svg {
  font-size: 12px;
  color: var(--slate-300);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 7px 14px;
  min-width: 220px;
  transition: all var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
  background: var(--white);
}

.search-box i,
.search-box svg {
  color: var(--slate-400);
  font-size: 14px;
  flex-shrink: 0;
}

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

.search-box input::placeholder {
  color: var(--slate-400);
}

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

.action-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: var(--slate-100);
  color: var(--text-primary);
}

.notif-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid var(--white);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--navy-900);
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
  margin-left: 8px;
  flex-shrink: 0;
}

.user-avatar:hover {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ---- Page Container ---- */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--slate-300) transparent;
}

.page-container::-webkit-scrollbar {
  width: 6px;
}

.page-container::-webkit-scrollbar-track {
  background: transparent;
}

.page-container::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 6px;
}

.page-container::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}

/* ============================================================
   PAGES
   ============================================================ */

.page {
  display: none;
  animation: page-enter 0.3s ease;
}

.page.active {
  display: block;
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.page-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================================
   KPI CARDS
   ============================================================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition-base);
}

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

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.kpi-icon.green {
  background: var(--success-light);
  color: var(--success);
}

.kpi-icon.blue {
  background: var(--info-light);
  color: var(--info);
}

.kpi-icon.gold {
  background: var(--gold-100);
  color: var(--gold-600);
}

.kpi-icon.red {
  background: var(--error-light);
  color: var(--error);
}

.kpi-info {
  flex: 1;
  min-width: 0;
}

.kpi-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  padding: 2px 6px;
  border-radius: 4px;
}

.kpi-trend.up {
  color: var(--success);
  background: var(--success-light);
}

.kpi-trend.down {
  color: var(--error);
  background: var(--error-light);
}

/* ============================================================
   GENERIC CARD
   ============================================================ */

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--slate-100);
}

.card-header h3 {
  font-size: 15px;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--gold-600);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.card-link:hover {
  color: var(--gold-700);
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.agent-status-card {
  grid-column: 1;
  grid-row: 1;
}

.chart-card {
  grid-column: 2;
  grid-row: 1;
}

.tasks-card {
  grid-column: 1;
  grid-row: 2;
}

.calendar-mini-card {
  grid-column: 2;
  grid-row: 2;
}

.quality-card {
  grid-column: 1;
}

.activity-card {
  grid-column: 2;
}

/* Full-width span */
.dashboard-grid .full-width {
  grid-column: 1 / -1;
}

/* ============================================================
   AGENT STATUS
   ============================================================ */

.agent-list {
  display: flex;
  flex-direction: column;
}

.agent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--slate-100);
  transition: background var(--transition-fast);
}

.agent-item:last-child {
  border-bottom: none;
}

.agent-item:hover {
  background: var(--slate-50);
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
}

.agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--slate-100);
  color: var(--text-secondary);
}

.agent-info {
  flex: 1;
  min-width: 0;
}

.agent-info .agent-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.agent-info .agent-task {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}

.agent-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-active,
.agent-status.status-active {
  background: var(--success-light);
  color: var(--success);
}

.status-active .status-dot {
  background: var(--success);
}

.status-idle,
.agent-status.status-idle {
  background: var(--warning-light);
  color: var(--gold-600);
}

.status-idle .status-dot {
  background: var(--gold-500);
}

.status-error,
.agent-status.status-error {
  background: var(--error-light);
  color: var(--error);
}

.status-error .status-dot {
  background: var(--error);
}

/* ============================================================
   CHARTS
   ============================================================ */

.chart-card .card-body {
  padding: 16px 20px;
}

.chart-card canvas {
  width: 100% !important;
  max-height: 280px;
}

.btn-group {
  display: inline-flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--slate-200);
}

.btn-group .btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--white);
  border: none;
  border-right: 1px solid var(--slate-200);
  transition: all var(--transition-fast);
}

.btn-group .btn-sm:last-child {
  border-right: none;
}

.btn-group .btn-sm:hover {
  background: var(--slate-50);
}

.btn-group .btn-sm.active {
  background: var(--gold-500);
  color: var(--navy-900);
  font-weight: 600;
}

.quality-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  flex-wrap: wrap;
}

.quality-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.quality-legend .legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ============================================================
   TASKS
   ============================================================ */

.tasks-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--slate-50);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.tasks-tabs .tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.tasks-tabs .tab:hover {
  color: var(--text-primary);
}

.tasks-tabs .tab.active {
  background: var(--white);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

.tab-count {
  font-size: 11px;
  font-weight: 600;
  background: var(--slate-200);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 8px;
}

.tasks-tabs .tab.active .tab-count {
  background: var(--gold-100);
  color: var(--gold-700);
}

.tasks-content {
  min-height: 100px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--slate-50);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.task-item:hover {
  border-color: var(--slate-200);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

.task-priority {
  width: 4px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 4px 0 0 4px;
}

.task-priority.high {
  background: var(--error);
}

.task-priority.medium {
  background: var(--warning);
}

.task-priority.low {
  background: var(--success);
}

.task-info {
  flex: 1;
  min-width: 0;
  padding-left: 6px;
}

.task-info .task-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.task-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-progress {
  width: 80px;
  flex-shrink: 0;
}

.progress-bar {
  height: 6px;
  background: var(--slate-200);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
  transition: width 0.6s ease;
}

.progress-fill.complete {
  background: linear-gradient(90deg, var(--success), #34d399);
}

/* ============================================================
   CALENDAR
   ============================================================ */

.calendar-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
}

.calendar-main {
  min-width: 0;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-nav h3 {
  font-size: 16px;
  font-weight: 700;
}

.calendar-nav .nav-btns {
  display: flex;
  gap: 4px;
}

.calendar-nav button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.calendar-nav button:hover {
  background: var(--slate-100);
  color: var(--text-primary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-grid .day-header {
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  gap: 4px;
}

.calendar-day:hover {
  background: var(--slate-100);
}

.calendar-day.today {
  background: var(--gold-500);
  color: var(--navy-900);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.calendar-day.today:hover {
  background: var(--gold-600);
}

.calendar-day.other-month {
  color: var(--slate-300);
}

.calendar-day.has-events::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold-500);
}

.calendar-day.today.has-events::after {
  background: var(--navy-900);
}

.calendar-sidebar {
  border-left: 1px solid var(--slate-200);
  padding-left: 20px;
}

.calendar-sidebar h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-event {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--slate-50);
  border-left: 3px solid var(--gold-500);
  transition: all var(--transition-fast);
}

.cal-event:hover {
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

.cal-event.blue {
  border-left-color: var(--info);
}

.cal-event.green {
  border-left-color: var(--success);
}

.cal-event.red {
  border-left-color: var(--error);
}

.cal-event .event-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.cal-event .event-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.cal-event .event-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================================
   UPCOMING LIST
   ============================================================ */

.upcoming-list {
  display: flex;
  flex-direction: column;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--slate-100);
}

.upcoming-item:last-child {
  border-bottom: none;
}

.upcoming-item .upcoming-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 50px;
  flex-shrink: 0;
}

.upcoming-item .upcoming-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.upcoming-item .agent-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--slate-100);
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ============================================================
   ACTIVITY FEED
   ============================================================ */

.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--slate-100);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--slate-100);
  color: var(--text-secondary);
}

.activity-icon.green {
  background: var(--success-light);
  color: var(--success);
}

.activity-icon.blue {
  background: var(--info-light);
  color: var(--info);
}

.activity-icon.gold {
  background: var(--gold-100);
  color: var(--gold-600);
}

.activity-icon.red {
  background: var(--error-light);
  color: var(--error);
}

.activity-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.activity-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.activity-time {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================
   AGENTS PAGE
   ============================================================ */

.agents-hierarchy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px 20px;
  position: relative;
}

.agents-hierarchy::before {
  content: '';
  position: absolute;
  top: 80px;
  left: 50%;
  width: 2px;
  height: calc(100% - 120px);
  background: var(--slate-200);
  transform: translateX(-50%);
}

.hierarchy-level {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.hierarchy-node {
  background: var(--white);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  text-align: center;
  transition: all var(--transition-base);
  min-width: 160px;
}

.hierarchy-node:hover {
  border-color: var(--gold-400);
  box-shadow: var(--shadow-md);
}

.hierarchy-node.founder {
  border-color: var(--gold-500);
  background: linear-gradient(135deg, var(--gold-50), var(--white));
}

.hierarchy-node.supervisor {
  border-color: var(--info);
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.agent-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  padding: 24px;
  transition: all var(--transition-base);
}

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

.agent-card .agent-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.agent-card .agent-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--slate-100);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.agent-card .agent-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.agent-card .agent-card-role {
  font-size: 13px;
  color: var(--text-muted);
}

.agent-card .agent-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
  padding: 16px 0;
  border-top: 1px solid var(--slate-100);
  border-bottom: 1px solid var(--slate-100);
}

.agent-card .stat-item {
  text-align: center;
}

.agent-card .stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.agent-card .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.agent-card .agent-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ============================================================
   REPORTS PAGE
   ============================================================ */

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

.report-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  padding: 20px;
  transition: all var(--transition-base);
}

.report-card:hover {
  box-shadow: var(--shadow-md);
}

.report-card canvas {
  width: 100% !important;
  max-height: 200px;
  margin: 12px 0;
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--slate-100);
}

/* ============================================================
   METRICS PAGE
   ============================================================ */

.metrics-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
}

.metric-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  padding: 20px;
}

.metric-panel h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.metric-panel canvas {
  width: 100% !important;
  max-height: 240px;
}

/* ============================================================
   LOGS PAGE
   ============================================================ */

.logs-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  overflow: hidden;
}

.log-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
  flex-wrap: wrap;
}

.log-filters .filter-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.log-filters .filter-btn:hover {
  border-color: var(--slate-300);
}

.log-filters .filter-btn.active {
  background: var(--navy-900);
  color: var(--white);
  border-color: var(--navy-900);
}

.log-entries {
  max-height: 600px;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12.5px;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--slate-50);
  transition: background var(--transition-fast);
  line-height: 1.6;
}

.log-entry:hover {
  background: var(--slate-50);
}

.log-entry .log-time {
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 80px;
}

.log-entry .log-level {
  font-weight: 600;
  flex-shrink: 0;
  min-width: 65px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 3px;
  text-align: center;
}

.log-entry .level-info {
  color: var(--info);
  background: var(--info-light);
}

.log-entry .level-success {
  color: var(--success);
  background: var(--success-light);
}

.log-entry .level-warning {
  color: var(--gold-600);
  background: var(--warning-light);
}

.log-entry .level-error {
  color: var(--error);
  background: var(--error-light);
}

.log-entry .log-message {
  color: var(--text-primary);
  word-break: break-word;
  flex: 1;
}

.log-entry .log-source {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 11px;
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */

.settings-content {
  max-width: 720px;
}

.settings-group {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  margin-bottom: 20px;
  overflow: hidden;
}

.settings-group-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--slate-100);
}

.settings-group-header h3 {
  font-size: 15px;
  font-weight: 650;
}

.settings-group-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-50);
  gap: 16px;
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-label {
  flex: 1;
}

.setting-label h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.setting-label p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--slate-300);
  border-radius: 24px;
  transition: all var(--transition-base);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-xs);
}

.toggle input:checked + .toggle-slider {
  background: var(--gold-500);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* ============================================================
   NOTIFICATION PANEL
   ============================================================ */

.notif-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 380px;
  height: 100vh;
  background: var(--white);
  box-shadow: var(--shadow-xl);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  transition: right var(--transition-slow);
}

.notif-panel.open {
  right: 0;
}

.notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  z-index: 1099;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.notif-panel.open ~ .notif-overlay,
.notif-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--slate-200);
  flex-shrink: 0;
}

.notif-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.notif-item:hover {
  background: var(--slate-50);
}

.notif-item.unread {
  background: var(--gold-50);
}

.notif-item .notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--slate-100);
}

.notif-item .notif-content {
  flex: 1;
  min-width: 0;
}

.notif-item .notif-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.notif-item .notif-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.notif-item .notif-time-stamp {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-slow);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--slate-200);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.modal-header .modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-header .modal-close:hover {
  background: var(--slate-100);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--slate-200);
  flex-shrink: 0;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 18px;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 9px 13px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--slate-400);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.select-styled {
  position: relative;
}

.select-styled select {
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  accent-color: var(--gold-500);
  cursor: pointer;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-900);
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.2);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
}

.btn-secondary:active {
  background: var(--slate-100);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-text:hover {
  color: var(--text-primary);
  background: var(--slate-100);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--slate-200);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--slate-50);
  border-color: var(--slate-300);
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.mini-select {
  padding: 5px 28px 5px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--white);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mini-select:hover {
  border-color: var(--slate-300);
}

.mini-select:focus {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
  outline: none;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--navy-900);
  color: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  animation: toast-in 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

.toast.removing {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
}

.toast .toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast .toast-message {
  flex: 1;
}

.toast .toast-close {
  color: var(--slate-400);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.toast .toast-close:hover {
  color: var(--white);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  padding: 4px 10px;
  background: var(--success-light);
  border-radius: 20px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: live-pulse 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

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

.empty-state-text i,
.empty-state-text svg {
  font-size: 40px;
  color: var(--slate-300);
  margin-bottom: 12px;
  display: block;
}

/* Text truncation */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* Spacing */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* ============================================================
   RESPONSIVE — TABLET
   ============================================================ */

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid .agent-status-card,
  .dashboard-grid .chart-card,
  .dashboard-grid .tasks-card,
  .dashboard-grid .calendar-mini-card,
  .dashboard-grid .quality-card,
  .dashboard-grid .activity-card {
    grid-column: 1;
    grid-row: auto;
  }

  .calendar-container {
    grid-template-columns: 1fr;
  }

  .calendar-sidebar {
    border-left: none;
    border-top: 1px solid var(--slate-200);
    padding-left: 0;
    padding-top: 20px;
  }

  .agents-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .reports-grid {
    grid-template-columns: 1fr;
  }

  .metrics-content {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: var(--shadow-xl);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: var(--sidebar-width);
    transform: translateX(-100%);
  }

  .sidebar.collapsed.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar.collapsed ~ .main-content,
  .sidebar.collapsed + .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .topbar {
    padding: 0 16px;
  }

  .search-box {
    display: none;
  }

  .page-container {
    padding: 16px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .notif-panel {
    width: 100%;
    right: -100%;
  }

  .modal {
    width: 95%;
    max-height: 90vh;
    margin: 0 auto;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }

  .agents-hierarchy {
    padding: 20px 10px;
  }

  .calendar-grid {
    font-size: 12px;
  }

  .breadcrumb {
    display: none;
  }
}

/* ============================================================
   DARK OVERLAY FOR MOBILE SIDEBAR
   ============================================================ */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 999;
}

@media (max-width: 768px) {
  .sidebar.mobile-open ~ .sidebar-overlay,
  .sidebar-overlay.active {
    display: block;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
  .sidebar,
  .topbar,
  .toast-container,
  .notif-panel,
  .modal-overlay {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .page-container {
    overflow: visible;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ============================================================
   FOCUS & ACCESSIBILITY
   ============================================================ */

:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

.nav-item:focus-visible {
  outline-offset: -2px;
}

/* Reduce motion for a11y */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   SELECTION
   ============================================================ */

::selection {
  background: rgba(245, 158, 11, 0.2);
  color: var(--text-primary);
}

/* ============================================================
   CHAT IA
   ============================================================ */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  max-height: calc(100vh - 80px);
  background: #1a1a2e;
  border-radius: 16px;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #12121a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.chat-header h2 {
  color: #f0f0f0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.chat-agent-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-agent-selector label {
  color: #a0a0b0;
  font-size: 0.85rem;
}

.chat-agent-selector select {
  background: #2a2a3e;
  color: #e0e0e0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
}

.selected-agent-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  color: #a0a0b0;
}

.chat-welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #0f172a;
  margin-bottom: 16px;
}

.chat-welcome h3 {
  color: #e0e0e0;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.chat-msg {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: chatFadeIn 0.3s ease;
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.chat-msg.user .chat-msg-avatar {
  background: #3b82f6;
  color: #fff;
}

.chat-msg.agent .chat-msg-avatar {
  background: #f59e0b;
  color: #0f172a;
}

.chat-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg.user .chat-msg-bubble {
  background: #3b82f6;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.agent .chat-msg-bubble {
  background: #2a2a3e;
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
}

.chat-msg-bubble pre {
  background: #12121a;
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 0.85rem;
}

.chat-msg-time {
  font-size: 0.7rem;
  color: #666;
  margin-top: 4px;
}

.chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: #a0a0b0;
  font-size: 0.85rem;
}

.chat-typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  animation: typingDot 1.4s infinite;
}
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 24px;
  background: #12121a;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.chat-input-area textarea {
  flex: 1;
  background: #2a2a3e;
  color: #e0e0e0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
}

.chat-input-area textarea:focus {
  outline: none;
  border-color: #f59e0b;
}

.chat-input-area button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #f59e0b;
  color: #0f172a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.chat-input-area button:hover {
  background: #d97706;
}

.chat-input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
