/* ================================================================
   FlowAI — Premium Design System v2.0
   Dark Theme · Glassmorphism · Micro-Animations
   ================================================================ */

/* ================================================================
   1. CSS VARIABLES
   ================================================================ */
:root {
  /* ---- Color Palette — base theme: Монохром ---- */
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-elevated: #181818;
  --bg-card: #111111;
  --bg-card-hover: #171717;
  --bg-input: #0d0d0d;
  --bg-sidebar: #0c0c0c;

  --border: #242424;
  --border-light: #333333;
  --border-focus: #d4d4d4;

  --text-primary: #ededed;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --text-inverse: #0a0a0a;

  --accent: #d4d4d4;
  --accent-hover: #ededed;
  --accent-muted: #8a8a8a;
  --accent-glow: rgba(255, 255, 255, 0.14);
  --accent-glow-strong: rgba(255, 255, 255, 0.22);

  /* Chart primary series (theme-aware) */
  --chart-primary: #c8c8c8;
  --chart-primary-fill: rgba(255, 255, 255, 0.05);

  /* Semantic — desaturated to sit in a near-black palette */
  --success: #57a06e;
  --success-bg: rgba(87, 160, 110, 0.12);
  --success-border: rgba(87, 160, 110, 0.28);

  --warning: #c39a45;
  --warning-bg: rgba(195, 154, 69, 0.12);
  --warning-border: rgba(195, 154, 69, 0.28);

  --danger: #cf5b5b;
  --danger-bg: rgba(207, 91, 91, 0.12);
  --danger-border: rgba(207, 91, 91, 0.28);

  --info: #5f7fa8;
  --info-bg: rgba(95, 127, 168, 0.12);
  --info-border: rgba(95, 127, 168, 0.28);

  --orange: #bd7b45;
  --orange-bg: rgba(189, 123, 69, 0.12);
  --orange-border: rgba(189, 123, 69, 0.28);

  --purple: #8f86a8;
  --purple-bg: rgba(143, 134, 168, 0.12);
  --purple-border: rgba(143, 134, 168, 0.28);

  /* ---- Spacing Scale (4px increments) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ---- Border Radius ---- */
  --radius-xs: 2px;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-xl: 8px;
  --radius-full: 9999px;
  --radius: 4px;

  /* ---- Shadows ---- */
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
  --shadow-glow: none;
  --shadow-glow-strong: none;
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.02);

  /* ---- Typography ---- */
  --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Unbounded', 'Montserrat', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Cascadia Code', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* ---- Layout ---- */
  --sidebar-width: 280px;
  --sidebar-collapsed: 68px;
  --topbar-height: 64px;
  --content-max-width: 1600px;

  /* ---- Transitions ---- */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ---- Z-Index Scale ---- */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 3000;
  --z-tooltip: 4000;
}

/* ================================================================
   Theme: Dayrain — red on near-black (everydayrain)
   ================================================================ */
:root[data-theme="dayrain"] {
  --bg-primary: #080808;
  --bg-secondary: #0f0f0f;
  --bg-elevated: #161616;
  --bg-card: #0f0f0f;
  --bg-card-hover: #161616;
  --bg-input: #0b0b0b;
  --bg-sidebar: #0a0a0a;

  --border: #232323;
  --border-focus: #c91e1e;
  --text-inverse: #ffffff;

  --accent: #c91e1e;
  --accent-hover: #e23b3b;
  --accent-muted: #9a1616;
  --accent-glow: rgba(201, 30, 30, 0.20);
  --accent-glow-strong: rgba(201, 30, 30, 0.32);

  --chart-primary: #c91e1e;
  --chart-primary-fill: rgba(201, 30, 30, 0.09);
}


/* ================================================================
   2. BASE STYLES — Reset / Normalize
   ================================================================ */
*, *::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;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

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

ul, ol {
  list-style: none;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-5) 0;
}

::selection {
  background: var(--accent-glow-strong);
  color: var(--text-primary);
}


/* ================================================================
   2b. SCROLLBAR (Dark Thin)
   ================================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}


/* ================================================================
   3. LAYOUT
   ================================================================ */

/* --- App Shell (sidebar + main) --- */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: var(--z-sticky);
  transition: width var(--transition-slow), left var(--transition-slow);
}

/* Glassmorphism subtle top shimmer on sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
  pointer-events: none;
}

/* --- Sidebar Logo --- */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.05em;
  flex-shrink: 0;
  transition: border-color var(--transition-base);
}

.logo-icon:hover {
  border-color: var(--accent);
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* --- Sidebar Nav --- */
.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition-base);
  font-weight: 500;
  font-size: var(--text-base);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.nav-item svg {
  flex-shrink: 0;
  transition: stroke var(--transition-base);
}

/* Terminal-style mono marker (replaces generic line icons) */
.nav-marker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  min-width: 20px;
  flex-shrink: 0;
  transition: color var(--transition-base);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.nav-item:hover svg,
.nav-item:hover .nav-marker {
  stroke: var(--text-secondary);
  color: var(--text-secondary);
}

/* Active state — selected console row + solid left bar (flat, no glow) */
.nav-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item.active .nav-marker {
  color: var(--text-primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--text-primary);
}

.nav-item.active svg {
  stroke: var(--text-primary);
}

/* --- Sidebar Footer --- */
.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.offline {
  background: var(--text-muted);
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg-primary);
}

/* --- Top Bar (Sticky Header) --- */
.top-bar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  border-bottom: 1px solid var(--border);
  background: rgba(22, 25, 34, 0.80);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-calls-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-full);
  color: var(--success);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--transition-base);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

/* --- Content Area --- */
.content-area {
  flex: 1;
  padding: var(--space-7) var(--space-8);
  overflow-y: auto;
  overflow-x: hidden;
}


/* ================================================================
   4. COMPONENTS
   ================================================================ */

/* ---------------------------------------------------------------
   4a. BUTTONS
   --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  position: relative;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Primary */
.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.btn-primary:hover {
  background: #ffffff;
  border-color: #ffffff;
}

.btn-primary:active {
  background: var(--text-secondary);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* Outline */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-glow);
}

/* Success */
.btn-success {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-success:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

/* Danger — monochrome (statuses keep colour, action buttons do not) */
.btn-danger {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-danger:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

/* Warning */
.btn-warning {
  background: var(--warning);
  color: var(--text-inverse);
  border-color: var(--warning);
}

.btn-warning:hover {
  background: #d97706;
}

/* Ghost */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* Sizes */
.btn-xs {
  padding: 4px 8px;
  font-size: var(--text-xs);
  border-radius: var(--radius-xs);
  gap: var(--space-1);
}

.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-sm);
  gap: 6px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--text-md);
  border-radius: var(--radius-md);
}

.btn-icon {
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
}

.btn-icon.btn-sm {
  padding: 6px;
  min-width: 30px;
  min-height: 30px;
}

/* Button Group */
.btn-group {
  display: flex;
  gap: var(--space-2);
}

/* Loading State */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 6px;
  flex-shrink: 0;
}

/* Disabled */
.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}


/* ---------------------------------------------------------------
   4b. CARDS
   --------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  border-color: var(--border-light);
}

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

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: 0;
}

.card-body.padded {
  padding: 22px;
}

.card-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}


/* ---------------------------------------------------------------
   4c. BADGES / STATUS
   --------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: capitalize;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-success,
.badge-completed {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.badge-warning,
.badge-dropped {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.badge-danger,
.badge-failed {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}

.badge-muted,
.badge-machine {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
  border-color: rgba(100, 116, 139, 0.20);
}

.badge-orange,
.badge-no_answer {
  background: var(--orange-bg);
  color: var(--orange);
  border-color: var(--orange-border);
}

.badge-accent {
  background: var(--accent-glow);
  color: var(--accent-hover);
  border-color: rgba(255, 255, 255, 0.25);
}

.badge-purple {
  background: var(--purple-bg);
  color: var(--purple);
  border-color: var(--purple-border);
}

/* Badge sizes */
.badge-sm {
  padding: 2px 6px;
  font-size: 0.65rem;
}

.badge-lg {
  padding: 5px 14px;
  font-size: var(--text-sm);
}

/* Dot badge (inline dot) */
.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}


/* ---------------------------------------------------------------
   4d. STAT CARDS (KPI)
   --------------------------------------------------------------- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

/* Accent left border indicator */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), #8a8a8a);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-icon.accent {
  background: var(--accent-glow);
  color: var(--accent-hover);
}

.stat-icon.success {
  background: var(--success-bg);
  color: var(--success);
}

.stat-icon.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-icon.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-icon.info {
  background: var(--info-bg);
  color: var(--info);
}

.stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-value.accent { color: var(--accent-hover); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  margin-top: 6px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

.stat-change .arrow {
  font-size: 0.85rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-7);
}


/* ---------------------------------------------------------------
   4e. DATA TABLES
   --------------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.data-table th {
  text-align: left;
  padding: 8px 16px;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.data-table th.sortable:hover {
  color: var(--text-secondary);
}

.data-table th.sortable::after {
  content: ' ↕';
  opacity: 0.3;
  font-size: 0.7rem;
}

.data-table th.sortable.asc::after {
  content: ' ↑';
  opacity: 1;
  color: var(--accent);
}

.data-table th.sortable.desc::after {
  content: ' ↓';
  opacity: 1;
  color: var(--accent);
}

.data-table td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
  line-height: 1.35;
  vertical-align: middle;
  transition: background var(--transition-fast);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

/* Striped rows */
.data-table.striped tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}

.data-table.striped tbody tr:nth-child(even):hover td {
  background: var(--bg-card-hover);
}


/* ---------------------------------------------------------------
   4f. PAGINATION
   --------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.pagination-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.pagination-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.25);
}

.pagination-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.pagination-per-page {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.pagination-per-page select {
  padding: 5px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  font-family: inherit;
}


/* ---------------------------------------------------------------
   4g. MODALS
   --------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.60);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity var(--transition-base);
}
.modal-overlay.open { opacity: 1; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(18px) scale(0.97);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}
.modal-overlay.open .modal { transform: none; opacity: 1; }

.modal.wide {
  max-width: 920px;
}

.modal.modal-sm {
  max-width: 440px;
}

.modal.modal-lg {
  max-width: 800px;
}

.modal.modal-xl {
  max-width: 1100px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  gap: var(--space-4);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}


/* ---------------------------------------------------------------
   4h. TOAST NOTIFICATIONS
   --------------------------------------------------------------- */
#toast-container,
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 420px;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  min-width: 280px;
  max-width: 420px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.hiding {
  transform: translateX(120%);
  opacity: 0;
}

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  padding: 2px;
  font-size: 1rem;
  transition: opacity var(--transition-fast);
}

.toast-close:hover {
  opacity: 1;
}

.toast-success {
  background: rgba(13, 40, 24, 0.92);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.toast-success .toast-icon {
  background: rgba(34, 197, 94, 0.2);
}

.toast-error {
  background: rgba(45, 13, 13, 0.92);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.2);
}

.toast-info {
  background: rgba(13, 26, 45, 0.92);
  border: 1px solid var(--info-border);
  color: var(--info);
}

.toast-info .toast-icon {
  background: rgba(59, 130, 246, 0.2);
}

.toast-warning {
  background: rgba(45, 31, 13, 0.92);
  border: 1px solid var(--warning-border);
  color: var(--warning);
}

.toast-warning .toast-icon {
  background: rgba(245, 158, 11, 0.2);
}


/* ---------------------------------------------------------------
   4i. SEARCH INPUT
   --------------------------------------------------------------- */
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1rem;
}

.search-input-wrap .search-icon svg {
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  padding: 9px 36px 9px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input-wrap .search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  transition: color var(--transition-fast);
  display: none;
}

.search-input-wrap .search-clear.visible {
  display: flex;
}

.search-input-wrap .search-clear:hover {
  color: var(--text-primary);
}


/* ---------------------------------------------------------------
   4j. FILTER BAR
   --------------------------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-3) 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.filter-chip:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.filter-chip.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent-hover);
}

.filter-chip .chip-count {
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  font-weight: 600;
}

.filter-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
}


/* ---------------------------------------------------------------
   4k. EMPTY STATE
   --------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
  line-height: 1;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: var(--text-base);
  margin-bottom: var(--space-5);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.empty-state .btn {
  margin-top: var(--space-2);
}


/* ---------------------------------------------------------------
   4l. SKELETON LOADERS
   --------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-heading {
  height: 24px;
  width: 40%;
  margin-bottom: var(--space-3);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 140px;
  border-radius: var(--radius);
}

.skeleton-row {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.skeleton-cell {
  height: 14px;
  flex: 1;
}


/* ---------------------------------------------------------------
   4m. AUDIO PLAYER (Fixed Bottom)
   --------------------------------------------------------------- */
.audio-player {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 64px;
  background: rgba(22, 25, 34, 0.92);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-5);
  z-index: var(--z-overlay);
  transition: left var(--transition-slow);
}

.player-info {
  min-width: 160px;
}

.player-phone {
  font-weight: 600;
  font-size: var(--text-base);
  display: block;
  color: var(--text-primary);
}

.player-campaign {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
}

.btn-player {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-player:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-glow);
}

.player-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.progress-bar:hover {
  height: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
  position: relative;
}

.player-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}


/* ---------------------------------------------------------------
   4n. SLIDE PANEL (Right Side)
   --------------------------------------------------------------- */
.slide-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: var(--z-overlay);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
}

.slide-panel-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 90vw;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: calc(var(--z-overlay) + 1);
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.slide-panel.active {
  transform: translateX(0);
}

.slide-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.slide-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.slide-panel-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Call Detail Panel (alias) */
.call-detail-panel {
  /* Uses .slide-panel styles */
}


/* ---------------------------------------------------------------
   4o. CONFIRM DIALOG
   --------------------------------------------------------------- */
.confirm-dialog {
  text-align: center;
  padding: var(--space-6);
}

.confirm-dialog-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  line-height: 1;
}

.confirm-dialog-title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.confirm-dialog-text {
  color: var(--text-muted);
  font-size: var(--text-base);
  margin-bottom: var(--space-6);
  line-height: 1.5;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
}


/* ---------------------------------------------------------------
   4p. FORMS
   --------------------------------------------------------------- */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1.5;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

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

.form-textarea.tall {
  min-height: 200px;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.form-hint code {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--accent-hover);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-5) 0;
}

/* Checkbox */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-base);
  color: var(--text-secondary);
  user-select: none;
}

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

/* Radio */
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-base);
  color: var(--text-secondary);
  user-select: none;
}

.form-radio input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Toggle switch */
.form-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

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

.form-toggle-track {
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}

.form-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition-fast);
}

.form-toggle input:checked + .form-toggle-track {
  background: var(--accent);
}

.form-toggle input:checked + .form-toggle-track::after {
  left: 20px;
  background: white;
}


/* ---------------------------------------------------------------
   4q. TAGS / CHIPS
   --------------------------------------------------------------- */
.tag,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.tag .tag-remove,
.chip .chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  cursor: pointer;
  margin-left: 2px;
  transition: all var(--transition-fast);
  padding: 0;
  line-height: 1;
}

.tag .tag-remove:hover,
.chip .chip-remove:hover {
  background: var(--danger-bg);
  color: var(--danger);
}


/* ---------------------------------------------------------------
   4r. PROGRESS BAR (with label)
   --------------------------------------------------------------- */
.progress-bar-wrap {
  width: 100%;
}

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

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

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.5s ease;
}

.progress-bar-fill.success {
  background: linear-gradient(90deg, var(--success), #16a34a);
}

.progress-bar-fill.danger {
  background: linear-gradient(90deg, var(--danger), #dc2626);
}

.progress-bar-fill.warning {
  background: linear-gradient(90deg, var(--warning), #d97706);
}


/* ---------------------------------------------------------------
   4s. DROPDOWN
   --------------------------------------------------------------- */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  padding: var(--space-1) 0;
  max-height: 320px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  pointer-events: none;
  transition: all var(--transition-fast);
}

.dropdown-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.dropdown-item.active {
  color: var(--accent-hover);
  background: var(--accent-glow);
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger:hover {
  background: var(--danger-bg);
}

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-1) 0;
}


/* ---------------------------------------------------------------
   4t. FORM TABS
   --------------------------------------------------------------- */
.form-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-6);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border);
}

.form-tab {
  flex: 1;
  padding: 9px var(--space-4);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.form-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.form-tab.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.form-tab-content {
  display: none;
}

.form-tab-content.active {
  display: block;
  animation: fade-in 0.2s ease;
}


/* ================================================================
   5. PAGE-SPECIFIC STYLES
   ================================================================ */

/* ---------------------------------------------------------------
   5a. DASHBOARD GRID
   --------------------------------------------------------------- */
.dashboard-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
  gap: var(--space-4);
}

.dashboard-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.dashboard-update-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dash-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  display: inline-block;
  transition: background var(--transition-slow), box-shadow var(--transition-slow);
}

.dash-status-dot.active {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

/* KPI row */
.dashboard-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: var(--space-6);
}

.dashboard-kpi-card {
  padding: var(--space-5) 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}

/* Charts row */
.dashboard-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Glassmorphism chart card */
.dashboard-chart-card {
  background: rgba(22, 25, 34, 0.65);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.dashboard-chart-card:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.dashboard-chart-title {
  font-weight: 700;
  font-size: var(--text-base);
  margin-bottom: 14px;
  color: var(--text-primary);
}

.dashboard-chart-wrap {
  position: relative;
  height: 240px;
}


/* ---------------------------------------------------------------
   5b. CHART CONTAINER (Canvas)
   --------------------------------------------------------------- */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
  padding: var(--space-4);
}

.chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding-top: var(--space-5);
}

.chart-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  max-width: 32px;
  background: linear-gradient(180deg, var(--accent), rgba(255, 255, 255, 0.4));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.5s ease;
  position: relative;
}

.chart-bar:hover {
  background: linear-gradient(180deg, var(--accent-hover), rgba(255, 255, 255, 0.5));
}

.chart-bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}


/* ---------------------------------------------------------------
   5c. LIVE FEED
   --------------------------------------------------------------- */
.live-feed-container {
  margin-bottom: var(--space-6);
}

.live-feed-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-feed-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-base);
}

.live-feed-event {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(22, 25, 34, 0.4);
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.live-feed-event:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

.live-feed-event.feed-started {
  border-left: 3px solid var(--success);
}

.live-feed-event.feed-ended {
  border-left: 3px solid var(--border-light);
}

.feed-dot-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: pulse-dot 1.5s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.feed-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.feed-result-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.feed-event-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feed-phone {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-campaign {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-disposition {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.feed-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}


/* ---------------------------------------------------------------
   5d. CAMPAIGN CARDS
   --------------------------------------------------------------- */
.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-5);
}

.campaign-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.campaign-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-muted), var(--accent));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.campaign-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.campaign-card:hover::after {
  opacity: 1;
}

.campaign-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.campaign-name {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

.campaign-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.campaign-stat-item {
  text-align: center;
}

.campaign-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.campaign-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.campaign-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: var(--space-4);
}

.campaign-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-muted), var(--accent));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.campaign-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.campaign-agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--purple-bg);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: #ededed;
  margin-bottom: var(--space-2);
}


/* ---------------------------------------------------------------
   5e. AGENT CARDS
   --------------------------------------------------------------- */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-5);
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #8a8a8a, var(--accent));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.agent-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.agent-card:hover::before {
  opacity: 1;
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: var(--space-4);
}

.agent-avatar {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #8a8a8a, var(--accent));
  border-radius: var(--radius-md);
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

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

.agent-name {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.agent-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.agent-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

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

.agent-detail-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.agent-detail-value {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 600;
}

.agent-card-footer {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: 14px;
  border-top: 1px solid var(--border);
}


/* ---------------------------------------------------------------
   5f. CALL LIST
   --------------------------------------------------------------- */
.call-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
  cursor: pointer;
}

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

.call-item:hover {
  background: var(--bg-card-hover);
}

.call-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
  flex-shrink: 0;
}

.call-icon.answered { background: var(--success-bg); color: var(--success); }
.call-icon.missed { background: var(--danger-bg); color: var(--danger); }
.call-icon.machine { background: var(--warning-bg); color: var(--warning); }

.call-info { flex: 1; min-width: 0; }
.call-phone { font-weight: 600; font-size: var(--text-md); }
.call-meta { font-size: 0.78rem; color: var(--text-muted); }
.call-duration { font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.call-actions { display: flex; gap: 6px; }


/* ---------------------------------------------------------------
   5g. TRANSCRIPT VIEW
   --------------------------------------------------------------- */
.transcript {
  padding: var(--space-4);
  font-size: var(--text-base);
  line-height: 1.7;
}

.transcript-line {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: background var(--transition-fast);
}

.transcript-line.ai {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
}

.transcript-line.caller {
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--text-muted);
}

.transcript-speaker {
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.transcript-speaker.ai { color: var(--accent-hover); }
.transcript-speaker.caller { color: var(--text-muted); }


/* ---------------------------------------------------------------
   5h. CALL ANALYSIS
   --------------------------------------------------------------- */
.analysis-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.analysis-scores {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.analysis-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 56px;
}

.analysis-metric-ring {
  position: relative;
  width: 56px;
  height: 56px;
}

.ring-svg {
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
}

.ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.analysis-metric-icon {
  font-size: 2rem;
  line-height: 1;
  height: 56px;
  display: flex;
  align-items: center;
}

.analysis-metric-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
  text-align: center;
}

.analysis-section {
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
}

.analysis-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: var(--space-2);
}

.analysis-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.analysis-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
}

.tag-handled {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--success);
}

.tag-missed {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.20);
  color: var(--danger);
}

.analysis-point {
  font-size: var(--text-sm);
  line-height: 1.5;
  padding: 2px 0;
  color: var(--text-secondary);
}

.analysis-point.covered { color: var(--success); }
.analysis-point.missed { color: var(--danger); }

.analysis-score-mini {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}


/* ================================================================
   5i. FILE UPLOAD
   ================================================================ */
.file-upload {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.file-upload:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.file-upload.dragging {
  border-color: var(--accent-hover);
  background: var(--accent-glow-strong);
}

.file-upload-icon {
  font-size: 2rem;
  margin-bottom: var(--space-3);
}

.file-upload-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
}


/* ================================================================
   5j. CODE PREVIEW
   ================================================================ */
.code-preview {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  margin-top: var(--space-2);
  max-height: 200px;
  overflow-y: auto;
}

.knowledge-stats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: var(--space-2);
}


/* ================================================================
   5k. LOGIN PAGE
   ================================================================ */
.login-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 2000;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  animation: slide-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo .logo-icon {
  margin: 0 auto var(--space-4);
  border-radius: var(--radius);
}

.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-hover), #ededed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-2);
}

.login-subtitle {
  font-size: var(--text-base);
  color: var(--text-muted);
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger-border);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}


/* ================================================================
   5l. TEST CALL MODAL
   ================================================================ */
.test-call-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.test-call-avatar {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition-slow);
  flex-shrink: 0;
}

.test-call-avatar.active {
  border-color: var(--success);
  color: var(--success);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.3);
  animation: avatar-pulse 2s ease-in-out infinite;
}

@keyframes avatar-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 24px rgba(34, 197, 94, 0.5); }
}

.test-call-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.test-call-status {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.test-call-duration {
  margin-left: auto;
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

/* Visualizer */
.test-call-visualizer {
  display: flex;
  justify-content: center;
  padding: var(--space-4) 0;
}

.visualizer-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 48px;
}

.v-bar {
  width: 4px;
  height: 3px;
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  border-radius: 2px;
  transition: height 0.08s ease;
}

/* Transcript */
.test-call-transcript {
  max-height: 280px;
  overflow-y: auto;
  padding: var(--space-3) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tc-message {
  display: flex;
}

.tc-message.user {
  justify-content: flex-end;
}

.tc-message.ai {
  justify-content: flex-start;
}

.tc-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: var(--text-base);
  line-height: 1.5;
}

.tc-bubble.ai {
  background: var(--accent-glow);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom-left-radius: 4px;
}

.tc-bubble.user {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-right-radius: 4px;
}

.tc-bubble.live {
  opacity: 0.6;
  border-style: dashed;
}

.tc-speaker {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
  color: var(--text-muted);
}

/* End button */
.test-call-controls {
  display: flex;
  justify-content: center;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  margin-top: var(--space-4);
}

.test-call-end-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--danger);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.test-call-end-btn:hover {
  background: #dc2626;
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.5);
}


/* ================================================================
   5m. AGENT BUILDER — Prompt Constructor
   ================================================================ */

/* Mode toggle */
.prompt-mode-toggle {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border);
}

.prompt-mode-btn {
  flex: 1;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}

.prompt-mode-btn:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.prompt-mode-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

/* Template grid */
.prompt-template-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.prompt-template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: inherit;
  color: var(--text-secondary);
}

.prompt-template-card:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.prompt-template-card.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent-hover);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.prompt-template-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.prompt-template-name {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

/* Builder container */
.prompt-builder-container {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.prompt-builder-sections {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Section card */
.prompt-section {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-left: 3px solid var(--section-color, var(--accent));
  border-radius: var(--radius-sm);
  padding: 14px var(--space-4);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.prompt-section:focus-within {
  border-color: var(--section-color, var(--accent));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.prompt-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: var(--space-2);
}

.prompt-section .form-textarea {
  min-height: 60px;
  background: rgba(15, 17, 23, 0.4);
  border-color: transparent;
  font-size: var(--text-sm);
}

.prompt-section .form-textarea:focus {
  border-color: var(--section-color, var(--accent));
  box-shadow: none;
}

/* Preview panel */
.prompt-preview {
  width: 320px;
  flex-shrink: 0;
  background: rgba(22, 25, 34, 0.65);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 0;
  max-height: 480px;
  display: flex;
  flex-direction: column;
}

.prompt-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 23, 0.5);
}

.prompt-preview-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
}

.prompt-preview-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.prompt-token-counter {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 3px 8px;
  background: var(--bg-input);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.prompt-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.prompt-preview-empty {
  text-align: center;
  padding: var(--space-8) var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-style: italic;
}

.prompt-preview-section {
  border-left: 3px solid var(--preview-color, var(--accent));
  padding: 10px 12px;
  background: rgba(15, 17, 23, 0.35);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  transition: background var(--transition-fast);
}

.prompt-preview-section:hover {
  background: rgba(15, 17, 23, 0.55);
}

.prompt-preview-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.prompt-preview-section-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.pb-mode-panel {
  animation: fade-in 0.2s ease;
}


/* ================================================================
   5n. LOADING / SPINNER
   ================================================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}


/* ================================================================
   6. ANIMATIONS / KEYFRAMES
   ================================================================ */
@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-out-right {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

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

/* Legacy alias */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes feedSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes feedDotPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.4);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.7);
  }
}

@keyframes avatarPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 24px rgba(34, 197, 94, 0.5); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 8px var(--accent-glow); }
  50% { box-shadow: 0 0 20px var(--accent-glow-strong); }
}


/* ================================================================
   7. ACCESSIBILITY
   ================================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:focus-visible,
.nav-item:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-glow);
}


/* ================================================================
   7b. HAMBURGER MENU (mobile only)
   ================================================================ */
.hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  margin-right: var(--space-3);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.hamburger:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
}

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 899;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar-overlay.active {
  display: block;
}


/* ================================================================
   8. RESPONSIVE BREAKPOINTS
   ================================================================ */

/* Tablet (≤ 1024px) */
@media (max-width: 1024px) {
  .dashboard-charts-row {
    grid-template-columns: 1fr 1fr;
  }

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

  .prompt-builder-container {
    flex-direction: column;
  }

  .prompt-preview {
    width: 100%;
    max-height: 300px;
    position: static;
  }

  .slide-panel {
    width: 420px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive charts adjustment */
@media (max-width: 1100px) {
  .dashboard-charts-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 900;
    transition: left var(--transition-slow);
    box-shadow: var(--shadow-xl);
  }

  .sidebar.open {
    left: 0;
  }

  .main-content {
    width: 100%;
  }

  .top-bar {
    padding: 0 var(--space-4);
  }

  .content-area {
    padding: var(--space-4);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

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

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

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

  .modal {
    width: 95%;
    max-height: 90vh;
    border-radius: var(--radius);
  }

  .modal.wide {
    max-width: 95%;
  }

  .audio-player {
    left: 0;
  }

  .page-title {
    font-size: 1.15rem;
  }

  .data-table {
    font-size: var(--text-sm);
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }

  .top-bar-right {
    gap: var(--space-2) !important;
  }

  #test-call-btn span {
    display: none;
  }

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

  .dashboard-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-chart-wrap {
    height: 200px;
  }

  .dashboard-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

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

  .slide-panel {
    width: 100%;
    max-width: 100vw;
  }

  .prompt-template-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #logout-btn {
    display: none;
  }

  .pagination {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .pagination-controls {
    justify-content: center;
  }

  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-2);
  }

  .filter-chip {
    flex-shrink: 0;
  }
}

/* Small Mobile (≤ 480px) */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

  .campaign-stats {
    grid-template-columns: 1fr 1fr;
  }

  .content-area {
    padding: var(--space-3);
  }

  .card-header {
    padding: 14px 16px;
    flex-wrap: wrap;
  }

  .card-body.padded {
    padding: 16px;
  }

  .modal-body {
    padding: var(--space-4);
  }

  .modal-header {
    padding: var(--space-4);
  }

  .stat-card {
    padding: var(--space-4);
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .btn-group {
    flex-wrap: wrap;
  }

  .top-bar-right {
    gap: var(--space-1) !important;
  }
}


/* ================================================================
   9. UTILITIES
   ================================================================ */

/* ---- Text Colors ---- */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent-hover) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

/* ---- Text Sizing ---- */
.text-xs { font-size: var(--text-xs) !important; }
.text-sm { font-size: var(--text-sm) !important; }
.text-base { font-size: var(--text-base) !important; }
.text-lg { font-size: var(--text-lg) !important; }
.text-xl { font-size: var(--text-xl) !important; }
.text-2xl { font-size: var(--text-2xl) !important; }

/* ---- Font Weight ---- */
.font-normal { font-weight: 400 !important; }
.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }
.font-extrabold { font-weight: 800 !important; }

/* ---- Flexbox ---- */
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.flex-col { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-1 { flex: 1 !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.items-start { align-items: flex-start !important; }
.items-center { align-items: center !important; }
.items-end { align-items: flex-end !important; }
.items-stretch { align-items: stretch !important; }
.justify-start { justify-content: flex-start !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-around { justify-content: space-around !important; }

/* ---- Gap ---- */
.gap-1 { gap: var(--space-1) !important; }
.gap-2 { gap: var(--space-2) !important; }
.gap-3 { gap: var(--space-3) !important; }
.gap-4 { gap: var(--space-4) !important; }
.gap-5 { gap: var(--space-5) !important; }
.gap-6 { gap: var(--space-6) !important; }
.gap-8 { gap: var(--space-8) !important; }

/* ---- Margin ---- */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-1) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-5 { margin-top: var(--space-5) !important; }
.mt-6 { margin-top: var(--space-6) !important; }
.mt-8 { margin-top: var(--space-8) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-1) !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-5 { margin-bottom: var(--space-5) !important; }
.mb-6 { margin-bottom: var(--space-6) !important; }
.mb-8 { margin-bottom: var(--space-8) !important; }
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

/* ---- Padding ---- */
.p-0 { padding: 0 !important; }
.p-1 { padding: var(--space-1) !important; }
.p-2 { padding: var(--space-2) !important; }
.p-3 { padding: var(--space-3) !important; }
.p-4 { padding: var(--space-4) !important; }
.p-5 { padding: var(--space-5) !important; }
.p-6 { padding: var(--space-6) !important; }
.p-8 { padding: var(--space-8) !important; }
.px-4 { padding-left: var(--space-4) !important; padding-right: var(--space-4) !important; }
.py-4 { padding-top: var(--space-4) !important; padding-bottom: var(--space-4) !important; }
.pt-0 { padding-top: 0 !important; }
.pb-0 { padding-bottom: 0 !important; }

/* ---- Width / Height ---- */
.w-full { width: 100% !important; }
.h-full { height: 100% !important; }
.min-w-0 { min-width: 0 !important; }

/* ---- Display ---- */
.block { display: block !important; }
.inline-block { display: inline-block !important; }
.hidden { display: none !important; }
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

/* ---- Overflow ---- */
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }
.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }

/* ---- Truncate ---- */
.truncate {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.line-clamp-2 {
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
}

.line-clamp-3 {
  display: -webkit-box !important;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
}

/* ---- Text Alignment ---- */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* ---- Border ---- */
.border { border: 1px solid var(--border) !important; }
.border-0 { border: none !important; }
.border-top { border-top: 1px solid var(--border) !important; }
.border-bottom { border-bottom: 1px solid var(--border) !important; }
.rounded { border-radius: var(--radius) !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* ---- Position ---- */
.relative { position: relative !important; }
.absolute { position: absolute !important; }
.sticky { position: sticky !important; }

/* ---- Cursor ---- */
.cursor-pointer { cursor: pointer !important; }
.cursor-default { cursor: default !important; }

/* ---- Opacity ---- */
.opacity-50 { opacity: 0.5 !important; }
.opacity-75 { opacity: 0.75 !important; }

/* ---- User Select ---- */
.select-none { user-select: none !important; }
.select-all { user-select: all !important; }

/* ---- Screen Reader Only ---- */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border-width: 0 !important;
}

/* ---- Transition ---- */
.transition { transition: all var(--transition-base) !important; }
.transition-fast { transition: all var(--transition-fast) !important; }
.transition-slow { transition: all var(--transition-slow) !important; }

/* ---- Tabular Nums ---- */
.tabular-nums { font-variant-numeric: tabular-nums !important; }

/* ---- Whitespace ---- */
.whitespace-nowrap { white-space: nowrap !important; }
.whitespace-pre-wrap { white-space: pre-wrap !important; }

/* ---- Background ---- */
.bg-primary { background: var(--bg-primary) !important; }
.bg-secondary { background: var(--bg-secondary) !important; }
.bg-elevated { background: var(--bg-elevated) !important; }
.bg-card { background: var(--bg-card) !important; }

/* ================================================================
   Stats Charts Grid (responsive)
   ================================================================ */
.stats-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .stats-charts-grid {
    grid-template-columns: 1fr;
  }

  /* Campaign detail — prevent horizontal overflow on mobile */
  .campaign-detail-grid {
    grid-template-columns: 1fr !important;
  }

  /* Dashboard bottom row — stack on mobile */
  #dash-bottom {
    grid-template-columns: 1fr !important;
  }
}

/* ================================================================
   Personal cabinet — sidebar account badge + modal
   ================================================================ */
.sidebar-account {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-base);
}
.sidebar-account:hover { border-color: var(--border-light); }

.account-avatar {
  flex-shrink: 0;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}
.account-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-role { font-family: var(--font-mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.account-caret { color: var(--text-muted); font-size: 1rem; }

.account-head { display: flex; align-items: center; gap: var(--space-3); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); margin-bottom: var(--space-2); }
.account-avatar-lg {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); font-family: var(--font-mono); font-weight: 700; font-size: 1.3rem; color: var(--text-primary);
}
.account-head-name { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.account-head-role { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-top: 2px; }
.account-section { margin-top: var(--space-5); }
.account-section-title { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: var(--space-3); }

.theme-switch { display: flex; gap: var(--space-2); }
.theme-opt {
  flex: 1;
  padding: 9px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-base), color var(--transition-base);
}
.theme-opt:hover { border-color: var(--border-light); color: var(--text-primary); }
:root[data-theme="dayrain"] .theme-opt[data-theme-name="dayrain"],
:root[data-theme="mono"] .theme-opt[data-theme-name="mono"] {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ================================================================
   Metric detail modal (clickable KPI cards)
   ================================================================ */
.stat-card--clickable { cursor: pointer; position: relative; }
.stat-card--clickable:hover { border-color: var(--accent); }
.stat-card-more {
  position: absolute; top: 12px; right: 14px;
  font-size: 0.85rem; color: var(--text-muted);
  opacity: 0; transition: opacity var(--transition-base), color var(--transition-base);
}
.stat-card--clickable:hover .stat-card-more { opacity: 1; color: var(--accent); }

.metric-hero { text-align: center; padding: 4px 0 18px; border-bottom: 1px solid var(--border); }
.metric-hero-value { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--text-primary); }
:root[data-theme="dayrain"] .metric-hero-value { font-family: var(--font-display); }
.metric-hero-sub { margin-top: 8px; font-size: var(--text-sm); color: var(--text-muted); }

.metric-section { margin-top: var(--space-5); }
.metric-section-title { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: var(--space-3); }

.metric-breakdown { display: flex; flex-direction: column; gap: 10px; }
.metric-row { display: grid; grid-template-columns: 128px 1fr auto; align-items: center; gap: 12px; }
.metric-row-label { font-size: var(--text-sm); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-row-bar { height: 6px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
.metric-row-fill { display: block; height: 100%; }
.metric-row-val { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.metric-row-pct { color: var(--text-muted); font-size: 0.68rem; margin-left: 7px; }

.metric-kv { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-secondary); }
.metric-kv:last-child { border-bottom: none; }
.metric-kv b { color: var(--text-primary); font-family: var(--font-mono); font-weight: 600; }

/* ================================================================
   Soft re-login overlay (session expired → modal over current page)
   ================================================================ */
.relogin-overlay {
  position: fixed;
  inset: 0;
  z-index: 3500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  animation: contentFadeIn 0.2s ease;
}

/* ================================================================
   Formal-Black Typography — uppercase headings, mono labels
   ================================================================ */
.page-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.card-title {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
}

/* Small labels → mono, uppercase, wide tracking (eyebrow style) */
.stat-label,
.data-table thead th {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--text-xs);
  font-weight: 500;
}

/* Big metric numbers → mono, tabular for a data-terminal feel */
.stat-value {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.02em;
}

/* ================================================================
   Polish Pass — page transition, button lift, keyboard focus
   ================================================================ */

/* Content fades up on real navigation (not on silent auto-refresh) */
@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.content-area.page-enter {
  animation: contentFadeIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Buttons: subtle hover lift (declared "Micro-Animations" in header, was missing),
   press keeps the scale-down feedback. */
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn:not(:disabled):active { transform: translateY(0) scale(0.97); }

/* Keyboard-focusable clickable cards reuse the global :focus-visible ring;
   round the ring to match the card radius. */
.campaign-card:focus-visible,
.agent-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* ================================================================
   Dayrain theme overrides — Unbounded display + red accent
   (only applied when data-theme="dayrain"; base = Монохром)
   ================================================================ */
:root[data-theme="dayrain"] .page-title,
:root[data-theme="dayrain"] .logo-text,
:root[data-theme="dayrain"] .card-title,
:root[data-theme="dayrain"] .login-title,
:root[data-theme="dayrain"] .modal-title,
:root[data-theme="dayrain"] .account-head-name {
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}

/* Logo mark in signature red */
:root[data-theme="dayrain"] .logo-icon {
  color: var(--accent);
  border-color: var(--accent);
}

/* Primary buttons — red CTA */
:root[data-theme="dayrain"] .btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
:root[data-theme="dayrain"] .btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
:root[data-theme="dayrain"] .btn-primary:active {
  background: var(--accent-muted);
}

/* Active nav — red indicator bar + marker */
:root[data-theme="dayrain"] .nav-item.active::before { background: var(--accent); }
:root[data-theme="dayrain"] .nav-item.active .nav-marker { color: var(--accent); }

/* ================================================================
   Motion — staggered entrance for content (re-runs on every render)
   ================================================================ */
@keyframes itemIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.stat-card,
.campaign-card,
.agent-card,
.dashboard-chart-card,
.data-table tbody tr,
tr.hover-row {
  animation: itemIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Stagger the first several items so lists cascade in */
.stats-grid > *:nth-child(1), .campaigns-grid > *:nth-child(1), .agents-grid > *:nth-child(1), .data-table tbody tr:nth-child(1), tr.hover-row:nth-child(1) { animation-delay: 0.03s; }
.stats-grid > *:nth-child(2), .campaigns-grid > *:nth-child(2), .agents-grid > *:nth-child(2), .data-table tbody tr:nth-child(2), tr.hover-row:nth-child(2) { animation-delay: 0.07s; }
.stats-grid > *:nth-child(3), .campaigns-grid > *:nth-child(3), .agents-grid > *:nth-child(3), .data-table tbody tr:nth-child(3), tr.hover-row:nth-child(3) { animation-delay: 0.11s; }
.stats-grid > *:nth-child(4), .campaigns-grid > *:nth-child(4), .agents-grid > *:nth-child(4), .data-table tbody tr:nth-child(4), tr.hover-row:nth-child(4) { animation-delay: 0.15s; }
.stats-grid > *:nth-child(5), .campaigns-grid > *:nth-child(5), .agents-grid > *:nth-child(5), .data-table tbody tr:nth-child(5), tr.hover-row:nth-child(5) { animation-delay: 0.19s; }
.stats-grid > *:nth-child(6), .campaigns-grid > *:nth-child(6), .agents-grid > *:nth-child(6), .data-table tbody tr:nth-child(6), tr.hover-row:nth-child(6) { animation-delay: 0.23s; }
.data-table tbody tr:nth-child(7), tr.hover-row:nth-child(7) { animation-delay: 0.27s; }
.data-table tbody tr:nth-child(8), tr.hover-row:nth-child(8) { animation-delay: 0.31s; }
.data-table tbody tr:nth-child(n+9), tr.hover-row:nth-child(n+9) { animation-delay: 0.31s; }

/* Smooth state changes on interactive chrome */
.filter-chip,
.pagination-btn {
  transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

/* ================================================================
   Accessibility: Reduced Motion
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .skeleton {
    animation: none !important;
  }

  .pulse-dot {
    animation: none !important;
  }
}
