/*
 * PAOKA Dashboard - Design System CSS
 * Based on Codename.com reference
 * Version: 1.0.0
 */

/* ========================================
   IMPORTS
   ======================================== */

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

/* ========================================
   CSS VARIABLES
   ======================================== */

:root {
  /* ---- Colors: Primary ---- */
  --color-primary: #D94452;
  --color-primary-hover: #C23D49;
  --color-primary-light: #FCEDEF;
  --color-primary-muted: #E8A5AB;

  /* ---- Colors: Secondary ---- */
  --color-secondary: #F5E6D3;
  --color-secondary-dark: #E8D5C0;

  /* ---- Colors: Background ---- */
  --bg-app: #F8F6F3;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FAF8F5;
  --bg-nav-active: #FCEDEF;
  --bg-hover: #F5F3F0;
  --bg-input: #FFFFFF;
  --bg-input-focus: #FAFAFA;

  /* ---- Colors: Text ---- */
  --text-primary: #1A1A1A;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --text-inverse: #FFFFFF;
  --text-link: #D94452;

  /* ---- Colors: Semantic ---- */
  --color-success: #22C55E;
  --color-success-light: #DCFCE7;
  --color-success-dark: #16A34A;
  --color-error: #EF4444;
  --color-error-light: #FEE2E2;
  --color-warning: #F59E0B;
  --color-warning-light: #FEF3C7;
  --color-info: #3B82F6;
  --color-info-light: #DBEAFE;

  /* ---- Colors: Border ---- */
  --border-default: #E5E7EB;
  --border-light: #F3F4F6;
  --border-focus: #D94452;
  --border-card: rgba(0, 0, 0, 0.04);

  /* ---- Colors: Charts ---- */
  --chart-1: #D94452;
  --chart-2: #6B7280;
  --chart-3: #F59E0B;
  --chart-4: #3B82F6;
  --chart-5: #22C55E;
  --chart-6: #8B5CF6;
  --chart-bar-default: #E5E7EB;
  --chart-bar-hover: #D1D5DB;
  --chart-bar-active: #D94452;
  --chart-line-primary: #D94452;
  --chart-line-secondary: #9CA3AF;

  /* ---- Typography ---- */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  /* Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* ---- Spacing ---- */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Component Spacing */
  --card-padding: 1.25rem;
  --card-padding-sm: 1rem;
  --card-padding-lg: 1.5rem;
  --card-gap: 1rem;
  --sidebar-padding-x: 1rem;
  --sidebar-padding-y: 1.25rem;
  --sidebar-item-padding: 0.75rem;
  --content-padding: 1.5rem;
  --section-gap: 1.5rem;

  /* ---- Border Radius ---- */
  --radius-none: 0;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;

  /* Alias for compatibility */
  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;
  --border-radius-2xl: 1.25rem;
  --border-radius-full: 9999px;

  /* Card Border Radius */
  --card-border-radius: 16px;

  /* ---- Shadows ---- */
  --shadow-none: none;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 4px 12px 0 rgba(0, 0, 0, 0.08);

  /* ---- Transitions ---- */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* ---- Z-index ---- */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-tooltip: 400;

  /* ---- Layout ---- */
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 72px;
  --header-height: 64px;
}

/* ========================================
   BASE STYLES
   ======================================== */

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

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

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-app);
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
}

p {
  margin: 0 0 var(--space-4);
}

/* Metric Typography */
.metric-value-xl {
  font-size: var(--text-5xl);
  font-weight: var(--font-light);
  line-height: var(--leading-none);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.metric-value-xl .decimal {
  font-size: var(--text-3xl);
  color: var(--text-muted);
}

.metric-value-lg {
  font-size: var(--text-3xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

.metric-value-md {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

.metric-value-sm {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

.page-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-light);
  line-height: var(--leading-tight);
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

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

.section-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
}

.label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
  color: var(--text-muted);
}

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

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: var(--sidebar-padding-y) 0;
  position: fixed;
  left: 0;
  top: 0;
  z-index: var(--z-sticky);
}

.sidebar-header {
  padding: 0 var(--sidebar-padding-x);
  margin-bottom: var(--space-6);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-2);
}

.sidebar-section {
  margin-bottom: var(--space-4);
}

.sidebar-section-title {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin: var(--space-1) 0;
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--bg-nav-active);
  color: var(--color-primary);
}

.sidebar-item-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

.sidebar-item.active .sidebar-item-icon {
  opacity: 1;
}

.sidebar-item-badge {
  margin-left: auto;
}

/* Nested items */
.sidebar-nested {
  padding-left: var(--space-8);
}

.sidebar-nested-item {
  padding: var(--space-2) var(--space-3);
}

/* Sidebar Dropdown */
.sidebar-dropdown {
  position: relative;
}

.sidebar-dropdown-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
}

.sidebar-dropdown-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar-dropdown.open .sidebar-dropdown-arrow {
  transform: rotate(180deg);
}

.sidebar-dropdown.open .sidebar-dropdown-toggle {
  background: var(--bg-nav-active);
  color: var(--color-primary);
}

.sidebar-dropdown-content {
  display: none;
  padding-left: var(--space-3);
  max-height: 300px;
  overflow-y: auto;
}

.sidebar-dropdown.open .sidebar-dropdown-content {
  display: block;
}

.sidebar-dropdown-loading {
  display: flex;
  justify-content: center;
  padding: var(--space-3);
}

/* Department Dropdown Items */
.sidebar-dept-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: 0.813rem;
}

.sidebar-dept-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Department Item */
.sidebar-department {
  margin-top: var(--space-1);
}

.sidebar-department-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.sidebar-department-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.sidebar-department.open .sidebar-department-toggle {
  color: var(--text-primary);
}

.sidebar-department-arrow {
  width: 12px;
  height: 12px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar-department.open .sidebar-department-arrow {
  transform: rotate(90deg);
}

.sidebar-department-content {
  display: none;
  padding-left: var(--space-4);
}

.sidebar-department.open .sidebar-department-content {
  display: block;
}

/* Employee Item in Sidebar */
.sidebar-employee {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.sidebar-employee:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-employee-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: var(--font-medium);
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-employee-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.sidebar-nested-item:hover {
  color: var(--text-primary);
}

.sidebar-nested-item.active {
  color: var(--color-primary);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  flex: 1;
  padding: var(--space-4) var(--content-padding) var(--content-padding);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Page Container */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Grid System */
.dashboard-grid {
  display: grid;
  gap: var(--card-gap);
}

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

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

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.col-span-1 {
  grid-column: span 1;
}

.col-span-2 {
  grid-column: span 2;
}

.col-span-3 {
  grid-column: span 3;
}

.col-span-full {
  grid-column: 1 / -1;
}

/* ========================================
   COMPONENTS
   ======================================== */

/* Card */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--card-padding);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-card);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card-interactive {
  cursor: pointer;
}

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

.card-sm {
  padding: var(--card-padding-sm);
}

.card-lg {
  padding: var(--card-padding-lg);
}

.card-highlighted {
  border: 1px solid var(--color-primary-muted);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--color-primary-light) 100%);
}

/* =========================================
   UNIFIED WIDGET HEADER
   All widgets use .widget-header for consistency
   ======================================== */

.widget-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

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

.widget-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.widget-icon svg {
  width: 20px;
  height: 20px;
}

.widget-icon-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

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

.widget-icon-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

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

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

.widget-title-group {
  display: flex;
  flex-direction: column;
}

.widget-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

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

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn:focus {
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

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

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Success Button */
.btn-success {
  background: var(--color-success);
  color: #ffffff;
  border: 1px solid var(--color-success);
}

.btn-success:hover {
  background: #16a34a;
  border-color: #16a34a;
}

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

.btn-outline:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-outline-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid var(--color-primary-muted);
}

.btn-outline-primary:hover {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

/* Input */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

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

.input:hover {
  border-color: var(--text-muted);
}

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

.input-search {
  padding-left: var(--space-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: var(--space-3) center;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  line-height: 1;
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success-dark);
}

.badge-error {
  background: var(--color-error-light);
  color: var(--color-error);
}

.badge-warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-neutral {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.badge-count {
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  font-size: 10px;
  font-weight: var(--font-semibold);
  background: var(--color-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Avatar */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-xs {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--text-xs);
}

.avatar-md {
  width: 40px;
  height: 40px;
  font-size: var(--text-sm);
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: var(--text-base);
}

.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: var(--text-lg);
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-card);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.chip .avatar {
  margin-left: calc(var(--space-1) * -1);
}

.chip-active {
  background: var(--color-primary-light);
  border-color: var(--color-primary-muted);
}

/* Tabs */
.tabs {
  display: inline-flex;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  padding: var(--space-1);
  gap: var(--space-1);
}

.tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.tab.active {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(217, 68, 82, 0.25);
}

/* Change Indicator */
.change-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.change-positive {
  color: var(--color-success);
}

.change-negative {
  color: var(--color-error);
}

.change-pill {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
}

.change-pill.change-positive {
  background: var(--color-success-light);
}

.change-pill.change-negative {
  background: var(--color-error-light);
}

/* Table */
.table-container {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

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

.table th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  text-align: left;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-light);
}

.table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

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

.table-cell-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.table-cell-number {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.table-cell-kpi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.table-cell-kpi-high {
  background: var(--color-success-light);
  color: var(--color-success-dark);
}

.table-cell-kpi-medium {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.table-cell-kpi-low {
  background: var(--color-error-light);
  color: var(--color-error);
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 180px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.dropdown-item.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* ========================================
   DASHBOARD SPECIFIC
   ======================================== */

/* Metric Card Large */
.metric-card-large {
  padding: var(--space-6);
}

.metric-card-large .metric-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.metric-card-large .metric-change {
  margin-top: var(--space-2);
}

.metric-card-large .metric-comparison {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* Metric Card Small */
.metric-card-small {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.metric-card-small .metric-label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
}

.metric-card-small .metric-subtitle {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* Stats Row */
.stats-row {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  border-radius: var(--radius-xl);
}

.stats-row-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.stats-row-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
}

.stats-row-value {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.stats-row-percent {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-left: var(--space-2);
}

/* Leaderboard */
.leaderboard-row {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}

.leaderboard-row:hover {
  background: var(--bg-hover);
}

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

.leaderboard-stats {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.leaderboard-stat {
  text-align: right;
  min-width: 60px;
}

.leaderboard-stat-value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.leaderboard-stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Platform List */
.platform-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.platform-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

.platform-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
}

.platform-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  flex: 1;
}

.platform-value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.platform-percent {
  font-size: var(--text-xs);
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

/* ========================================
   CHART STYLES
   ======================================== */

.chart-container {
  width: 100%;
  height: 100%;
  min-height: 200px;
}

.chart-tooltip {
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  box-shadow: var(--shadow-lg);
}

.chart-tooltip-title {
  font-weight: var(--font-medium);
  margin-bottom: var(--space-1);
}

.chart-tooltip-value {
  font-weight: var(--font-semibold);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chart-legend-color {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.chart-legend-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* ========================================
   STATES
   ======================================== */

/* Loading / Skeleton */
.skeleton {
  background: linear-gradient(90deg,
      var(--bg-hover) 25%,
      var(--border-light) 50%,
      var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-metric {
  height: 48px;
  width: 120px;
}

.skeleton-text {
  height: 16px;
  width: 100%;
}

.skeleton-text-sm {
  height: 12px;
  width: 60%;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-4);
  color: var(--text-muted);
}

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

.empty-state-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 320px;
}

/* ========================================
   UTILITIES
   ======================================== */

/* Flexbox */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

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

.items-start {
  align-items: flex-start;
}

.items-center {
  align-items: center;
}

.items-end {
  align-items: flex-end;
}

.justify-start {
  justify-content: flex-start;
}

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

.justify-end {
  justify-content: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.flex-1 {
  flex: 1;
}

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

/* Gap */
.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-5 {
  gap: var(--space-5);
}

.gap-6 {
  gap: var(--space-6);
}

.gap-8 {
  gap: var(--space-8);
}

/* Padding */
.p-0 {
  padding: 0;
}

.p-1 {
  padding: var(--space-1);
}

.p-2 {
  padding: var(--space-2);
}

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

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

.p-5 {
  padding: var(--space-5);
}

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

.px-2 {
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.px-3 {
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.px-4 {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.py-2 {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.py-3 {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.py-4 {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

/* Margin */
.m-0 {
  margin: 0;
}

.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-1 {
  margin-bottom: var(--space-1);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.ml-auto {
  margin-left: auto;
}

/* Text */
.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

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

.text-success {
  color: var(--color-success);
}

.text-error {
  color: var(--color-error);
}

.font-light {
  font-weight: var(--font-light);
}

.font-normal {
  font-weight: var(--font-normal);
}

.font-medium {
  font-weight: var(--font-medium);
}

.font-semibold {
  font-weight: var(--font-semibold);
}

.font-bold {
  font-weight: var(--font-bold);
}

.text-xs {
  font-size: var(--text-xs);
}

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

.text-base {
  font-size: var(--text-base);
}

.text-lg {
  font-size: var(--text-lg);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Width/Height */
.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.min-h-screen {
  min-height: 100vh;
}

/* Width utilities (Tailwind-style) */
.w-3 {
  width: 0.75rem;
}

.w-4 {
  width: 1rem;
}

.w-5 {
  width: 1.25rem;
}

.w-6 {
  width: 1.5rem;
}

.w-8 {
  width: 2rem;
}

.w-10 {
  width: 2.5rem;
}

.w-12 {
  width: 3rem;
}

.w-16 {
  width: 4rem;
}

.w-20 {
  width: 5rem;
}

/* Height utilities (Tailwind-style) */
.h-3 {
  height: 0.75rem;
}

.h-4 {
  height: 1rem;
}

.h-5 {
  height: 1.25rem;
}

.h-6 {
  height: 1.5rem;
}

.h-8 {
  height: 2rem;
}

.h-10 {
  height: 2.5rem;
}

.h-12 {
  height: 3rem;
}

.h-16 {
  height: 4rem;
}

.h-20 {
  height: 5rem;
}

/* Margin utilities */
.mr-2 {
  margin-right: 0.5rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

.mr-4 {
  margin-right: 1rem;
}

.ml-4 {
  margin-left: 1rem;
}


/* Visibility */
.hidden {
  display: none;
}

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

/* Overflow */
.overflow-hidden {
  overflow: hidden;
}

.overflow-auto {
  overflow: auto;
}

.overflow-y-auto {
  overflow-y: auto;
}

/* Cursor */
.cursor-pointer {
  cursor: pointer;
}

/* Transitions */
.transition-all {
  transition: all var(--transition-fast);
}

.transition-colors {
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1280px) {
  .xl\:grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .xl\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }

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

/* Large screens (lg:) - Tailwind mobile-first approach */
@media (min-width: 1024px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .lg\:col-span-2 {
    grid-column: span 2 / span 2;
  }

  .lg\:hidden {
    display: none;
  }
}

/* Collapsed sidebar on smaller screens */
@media (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-width-collapsed);
    padding: var(--space-4) var(--space-2);
  }

  .sidebar-item span,
  .sidebar-section-title,
  .sidebar-nested,
  .sidebar-logo span {
    display: none;
  }

  .sidebar-item {
    justify-content: center;
    padding: var(--space-3);
  }

  .main-content {
    margin-left: var(--sidebar-width-collapsed);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-4);
  }

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

  .md\:grid-cols-1 {
    grid-template-columns: 1fr;
  }

  .md\:hidden {
    display: none;
  }

  .metric-value-xl {
    font-size: var(--text-4xl);
  }

  .page-title {
    font-size: var(--text-2xl);
  }
}

@media (max-width: 640px) {
  .sm\:grid-cols-1 {
    grid-template-columns: 1fr;
  }

  .sm\:hidden {
    display: none;
  }

  .card {
    padding: var(--card-padding-sm);
  }

  .stats-row {
    flex-wrap: wrap;
  }
}

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

/* Semantic text colors */
.text-success {
  color: var(--color-success);
}

.text-error {
  color: var(--color-error);
}

.text-warning {
  color: var(--color-warning);
}

.text-info {
  color: var(--color-info);
}

/* Score colors (for KPIs) */
.score-excellent {
  color: var(--color-success);
}

.score-good {
  color: #84cc16;
}

.score-warning {
  color: var(--color-warning);
}

.score-poor {
  color: var(--color-error);
}

.bg-score-excellent {
  background-color: var(--color-success-light);
}

.bg-score-good {
  background-color: rgba(132, 204, 22, 0.15);
}

.bg-score-warning {
  background-color: var(--color-warning-light);
}

.bg-score-poor {
  background-color: var(--color-error-light);
}

/* Animations */
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* Space utilities */
.space-y-2>*+* {
  margin-top: var(--space-2);
}

.space-y-3>*+* {
  margin-top: var(--space-3);
}

.space-y-4>*+* {
  margin-top: var(--space-4);
}

.space-y-6>*+* {
  margin-top: var(--space-6);
}

/* Additional display utilities */
.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.inline-flex {
  display: inline-flex;
}

/* Position utilities */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

/* Additional sizing */
.min-w-0 {
  min-width: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Transform utilities */
.translate-x-full {
  transform: translateX(100%);
}

.-translate-y-0\.5 {
  transform: translateY(-2px);
}

.-rotate-90 {
  transform: rotate(-90deg);
}

.rotate-0 {
  transform: rotate(0deg);
}

/* Border utilities */
.border-t {
  border-top: 1px solid var(--border-default);
}

.border-b {
  border-bottom: 1px solid var(--border-default);
}

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

/* =========================================
   EFFICIENCY INDEX WIDGET - 4 Equal Cards
   ======================================== */

.idx-widget {
  /* Uses .card padding by default */
}

.idx-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.idx-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  padding: var(--space-3);
  background: var(--bg-hover);
  border-radius: 12px;
  transition: all 0.2s ease;
  min-height: 110px;
}

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

/* All cards same style - no special highlighting */

/* Circular index */
.idx-circle {
  position: relative;
  margin-bottom: 4px;
}

.idx-circle svg {
  display: block;
}

.idx-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: var(--font-bold);
}

/* Gauge for calls */
.idx-gauge {
  position: relative;
  margin-bottom: 4px;
}

.idx-gauge svg {
  display: block;
}

.idx-gauge-val {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: var(--font-bold);
}

/* Gauge values: fact / plan under speedometer */
.idx-gauge-values {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
}

.idx-gauge-fact {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.idx-gauge-plan {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Visual content wrapper */
.idx-visual {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Label */
.idx-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  font-weight: var(--font-semibold);
  margin-top: auto;
  padding-top: 6px;
}

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

/* =========================================
   GAUGE CHART (SPEEDOMETER) COMPONENT
   ======================================== */

.gauge-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-chart svg {
  overflow: visible;
}

.gauge-needle {
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-value {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-fact {
  font-family: var(--font-family);
  transition: color 0.3s ease;
}

.gauge-label {
  font-family: var(--font-family);
}

.gauge-plan {
  font-family: var(--font-family);
}

/* Gauge card wrapper */
.gauge-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s ease;
}

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

.gauge-card-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

/* Gauge grid for multiple gauges */
.gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-5);
}

/* =========================================
   QUALITY ANALYSIS WIDGET
   ======================================== */

.qa-widget {
  padding: var(--space-4);
}

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

.qa-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.qa-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qa-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.qa-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Index in header */
.qa-index-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.qa-index-circle {
  position: relative;
  width: 48px;
  height: 48px;
}

.qa-index-circle svg {
  display: block;
}

.qa-index-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: var(--font-bold);
}

.qa-index-info {
  text-align: right;
}

.qa-index-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.qa-index-trend {
  font-size: 12px;
  font-weight: var(--font-medium);
}

/* Content */
.qa-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.qa-chart {
  height: 160px;
}

.qa-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Insights columns */
.qa-insights {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.qa-column {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}

.qa-column-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.qa-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.qa-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--text-secondary);
  padding: var(--space-1) 0;
}

.qa-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

/* =========================================
   BITRIX EFFICIENCY WIDGET
   ======================================== */

.bitrix-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: var(--space-3);
}

.bitrix-widget-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.bitrix-widget-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-info-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bitrix-widget-icon svg {
  width: 20px;
  height: 20px;
}

.bitrix-widget-title h3 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
}

.bitrix-widget-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.bitrix-widget-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Left Section - компактная горизонтальная структура */
.bitrix-left-section {
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* CRM Index Circle */
.bitrix-crm-index {
  border-radius: 12px;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.bitrix-crm-circle {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-1);
}

.bitrix-crm-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: var(--font-weight-bold);
}

.bitrix-crm-label {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.bitrix-crm-status {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

/* Work Time */
.bitrix-work-time {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bitrix-work-circle {
  position: relative;
  width: 60px;
  height: 60px;
  margin-bottom: 4px;
}

.bitrix-work-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.bitrix-work-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-2);
}

.bitrix-work-label {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
}

.bitrix-work-unit {
  font-size: 10px;
  color: var(--text-muted);
}

.bitrix-work-breakdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.work-breakdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-secondary);
}

.work-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.work-breakdown-item span:nth-child(2) {
  flex: 1;
}

.work-hours {
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

/* Right Section */
.bitrix-right-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Funnel */
.bitrix-funnel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: var(--space-3);
}

.funnel-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.funnel-stage-circle {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.funnel-stage-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.funnel-stage-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.funnel-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.funnel-conversion {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

/* Total Conversion */
.bitrix-total-conversion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 6px var(--space-2);
}

.total-conv-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.total-conv-value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
}

/* Status Grid */
.bitrix-status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.bitrix-status-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.bitrix-status-item:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.status-mini-circle {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-mini-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.status-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-align: center;
}

/* Responsive */
@media (max-width: 900px) {
  .bitrix-widget-content {
    flex-direction: column;
  }

  .bitrix-left-section {
    width: 100%;
    flex-direction: row;
    justify-content: center;
  }

  .bitrix-crm-index {
    flex: 1;
    max-width: 200px;
  }

  .bitrix-work-time {
    flex: 1;
    max-width: 200px;
  }
}

@media (max-width: 640px) {
  .bitrix-left-section {
    flex-direction: column;
    align-items: center;
  }

  .bitrix-funnel {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
  }

  .funnel-arrow {
    transform: rotate(90deg);
  }

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

/* ---- Simple Funnel (no circles, just numbers) ---- */
.bitrix-funnel-simple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}

.funnel-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.funnel-number {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.funnel-number.funnel-leads {
  color: var(--color-info);
}

.funnel-number.funnel-deals {
  color: var(--color-primary);
}

.funnel-number.funnel-payments {
  color: var(--color-success);
}

.funnel-label {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.funnel-arrow-simple {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
}

.funnel-rate {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

/* ---- Simple Status Cards (no circles) ---- */
.bitrix-status-simple {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.status-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  transition: all 0.2s ease;
}

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

.status-number {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.status-text {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

.status-card.status-in-progress {
  border-color: var(--color-success);
}

.status-card.status-in-progress .status-number {
  color: var(--color-success);
}

.status-card.status-stalled {
  border-color: var(--color-warning);
}

.status-card.status-stalled .status-number {
  color: var(--color-warning);
}

.status-card.status-no-tasks {
  border-color: var(--color-info);
}

.status-card.status-no-tasks .status-number {
  color: var(--color-info);
}

.status-card.status-overdue {
  border-color: var(--color-success);
}

.status-card.status-overdue .status-number {
  color: var(--color-success);
}

.status-card.status-overdue.has-overdue {
  border-color: var(--color-error);
  background: var(--color-error-light);
}

.status-card.status-overdue.has-overdue .status-number {
  color: var(--color-error);
}

@media (max-width: 900px) {
  .bitrix-funnel-simple {
    flex-wrap: wrap;
  }

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

@media (max-width: 640px) {
  .bitrix-funnel-simple {
    gap: var(--space-2);
    padding: var(--space-3);
  }

  .funnel-number {
    font-size: 24px;
  }

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

/* =========================================
   BITRIX WIDGET - COMPACT VERSION
   ======================================== */

/* =========================================
   BITRIX WIDGET - NEW LAYOUT
   ======================================== */

.bitrix-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  padding: 0 var(--space-4) var(--space-4);
}

.bitrix-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.bitrix-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* CRM Card */
.bitrix-crm-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
}

.crm-circle-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.crm-circle-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 700;
}

.crm-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crm-card-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.crm-card-status {
  font-size: 13px;
  font-weight: 600;
}

/* Work Time Card */
.bitrix-work-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}

.work-circle-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.work-circle-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.work-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.work-card-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.work-card-sublabel {
  font-size: 9px;
  color: var(--text-muted);
}

.work-card-stats {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.work-card-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.work-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

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

.work-dot-idle {
  background: var(--text-muted);
}

/* Funnel Visualization */
.bitrix-funnel-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}

.funnel-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: 8px;
  min-width: 60px;
}

.funnel-bar-leads {
  background: rgba(59, 130, 246, 0.1);
}

.funnel-bar-deals {
  background: rgba(217, 68, 82, 0.1);
}

.funnel-bar-payments {
  background: rgba(34, 197, 94, 0.1);
}

.funnel-bar-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.funnel-bar-leads .funnel-bar-value {
  color: var(--color-info);
}

.funnel-bar-deals .funnel-bar-value {
  color: var(--color-primary);
}

.funnel-bar-payments .funnel-bar-value {
  color: var(--color-success);
}

.funnel-bar-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.funnel-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
}

.funnel-connector::after {
  content: '›';
  font-size: 18px;
  color: var(--text-muted);
}

.funnel-conv-rate {
  font-size: 11px;
  font-weight: 600;
}

.conv-good {
  color: var(--color-success);
}

.conv-warn {
  color: var(--color-warning);
}

.conv-bad {
  color: var(--color-error);
}

.funnel-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  margin-left: 8px;
  border-left: 1px solid var(--border-light);
}

.funnel-total-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.funnel-total-value {
  font-size: 16px;
  font-weight: 700;
}

/* Status Grid 2x2 */
.bitrix-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.status-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.status-cell:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.status-cell-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.status-cell-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-cell-success {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-cell-success .status-cell-num {
  color: var(--color-success);
}

.status-cell-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-cell-warning .status-cell-num {
  color: var(--color-warning);
}

.status-cell-info {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.status-cell-info .status-cell-num {
  color: var(--color-info);
}

.status-cell-error {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-cell-error .status-cell-num {
  color: var(--color-success);
}

.status-cell-error.has-issues {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-cell-error.has-issues .status-cell-num {
  color: var(--color-error);
}

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

  .bitrix-left {
    flex-direction: row;
    min-width: auto;
  }

  .bitrix-crm-card,
  .bitrix-work-card {
    flex: 1;
  }
}

/* Legacy compact styles - hidden */
.bitrix-compact-content {
  display: none;
}

.bitrix-top-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 6px;
  align-items: stretch;
}

/* CRM Compact */
.bitrix-crm-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  flex-shrink: 0;
}

.crm-circle-mini {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.crm-value-mini {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: 700;
}

.crm-info-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crm-label-mini {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.crm-status-mini {
  font-size: 11px;
  font-weight: 500;
}

/* Work Time Compact */
.bitrix-work-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  flex-shrink: 0;
}

.work-circle-mini {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.work-value-mini {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.work-info-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.work-label-mini {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
}

.work-stats-mini {
  display: flex;
  gap: 8px;
  font-size: 10px;
  color: var(--text-secondary);
}

.work-stats-mini span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.dot-mini {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

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

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

/* Funnel Compact */
.bitrix-funnel-compact {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.funnel-stage-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.funnel-num-mini {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.funnel-num-mini.funnel-leads {
  color: var(--color-info);
}

.funnel-num-mini.funnel-deals {
  color: var(--color-primary);
}

.funnel-num-mini.funnel-payments {
  color: var(--color-success);
}

.funnel-lbl-mini {
  font-size: 8px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.funnel-arrow-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--text-muted);
}

.funnel-pct-mini {
  font-size: 10px;
  font-weight: 600;
}

/* Bottom Row */
.bitrix-bottom-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
  align-items: center;
}

.bitrix-conv-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-hover);
  border-radius: 8px;
}

.conv-label-mini {
  font-size: 11px;
  color: var(--text-secondary);
}

.conv-value-mini {
  font-size: 14px;
  font-weight: 700;
}

.bitrix-status-compact {
  flex: 1;
  display: flex;
  gap: 6px;
}

.status-mini {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.status-mini:hover {
  box-shadow: var(--shadow-sm);
}

.status-num-mini {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.status-lbl-mini {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-mini.status-in-progress {
  border-color: var(--color-success);
}

.status-mini.status-in-progress .status-num-mini {
  color: var(--color-success);
}

.status-mini.status-stalled {
  border-color: var(--color-warning);
}

.status-mini.status-stalled .status-num-mini {
  color: var(--color-warning);
}

.status-mini.status-no-tasks {
  border-color: var(--color-info);
}

.status-mini.status-no-tasks .status-num-mini {
  color: var(--color-info);
}

.status-mini.status-overdue {
  border-color: var(--color-success);
}

.status-mini.status-overdue .status-num-mini {
  color: var(--color-success);
}

.status-mini.status-overdue.has-overdue {
  border-color: var(--color-error);
  background: var(--color-error-light);
}

.status-mini.status-overdue.has-overdue .status-num-mini {
  color: var(--color-error);
}

@media (max-width: 900px) {
  .bitrix-top-row {
    flex-wrap: wrap;
  }

  .bitrix-funnel-compact {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .bitrix-bottom-row {
    flex-direction: column;
  }

  .bitrix-conv-compact,
  .bitrix-status-compact {
    width: 100%;
  }

  .bitrix-status-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================================
   BITRIX WIDGET - FINAL LAYOUT (bx-*)
   ======================================== */

/* Main Layout: CRM Left + Data Right */
.bitrix-main {
  display: flex;
  gap: 12px;
}

/* CRM Side (Left) */
.bitrix-crm-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 12px;
  min-width: 100px;
}

.crm-circle-lg {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 6px;
}

.crm-val-lg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 700;
}

.crm-lbl-lg {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.crm-stat-lg {
  font-size: 11px;
  font-weight: 600;
}

/* Data Side (Right) */
.bitrix-data-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Funnel Row */
.bx-funnel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.bx-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.bx-num {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.bx-num.bx-leads {
  color: var(--color-info);
}

.bx-num.bx-deals {
  color: var(--color-primary);
}

.bx-num.bx-pay {
  color: var(--color-success);
}

.bx-lbl {
  font-size: 8px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.bx-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  color: var(--text-muted);
}

.bx-pct {
  font-size: 10px;
  font-weight: 600;
}

.bx-gt {
  font-size: 14px;
  line-height: 1;
}

.bx-conv {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.bx-conv-lbl {
  font-size: 8px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.bx-conv-val {
  font-size: 20px;
  font-weight: 700;
}

/* Activity Bar */
.bx-activity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-hover);
  border-radius: 8px;
}

.bx-activity-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.bx-bar-active {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), #34d399);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.bx-activity-legend {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.bx-leg-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-secondary);
}

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

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

.bx-dot-idle {
  background: var(--text-muted);
}

/* Activity Timeline */
.bx-timeline {
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.timeline-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.timeline-legend {
  display: flex;
  gap: 10px;
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

.leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

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

.leg-dot.idle {
  background: #D1D5DB;
}

.timeline-bar {
  display: flex;
  gap: 2px;
  height: 20px;
  margin-bottom: 4px;
}

.timeline-segment {
  flex: 1;
  border-radius: 3px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.timeline-segment.active {
  background: linear-gradient(180deg, #22C55E 0%, #16A34A 100%);
}

.timeline-segment.idle {
  background: #E5E7EB;
}

.timeline-segment:hover {
  transform: scaleY(1.2);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-muted);
}

/* Status Grid 2x2 */
.bx-status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.bx-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  transition: all 0.15s ease;
}

.bx-stat:hover {
  box-shadow: var(--shadow-sm);
}

.bx-stat-num {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.bx-stat-lbl {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.bx-stat-success {
  border-color: var(--color-success);
}

.bx-stat-success .bx-stat-num {
  color: var(--color-success);
}

.bx-stat-warning {
  border-color: var(--color-warning);
}

.bx-stat-warning .bx-stat-num {
  color: var(--color-warning);
}

.bx-stat-info {
  border-color: var(--color-info);
}

.bx-stat-info .bx-stat-num {
  color: var(--color-info);
}

.bx-stat-error {
  border-color: var(--color-success);
}

.bx-stat-error .bx-stat-num {
  color: var(--color-success);
}

.bx-stat-error.has-issues {
  border-color: var(--color-error);
  background: var(--color-error-light);
}

.bx-stat-error.has-issues .bx-stat-num {
  color: var(--color-error);
}

@media (max-width: 768px) {
  .bitrix-main {
    flex-direction: column;
  }

  .bitrix-crm-side {
    flex-direction: row;
    min-width: auto;
    gap: 12px;
  }

  .crm-circle-lg {
    margin-bottom: 0;
  }

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

/* =========================================
   CALLS ANALYTICS WIDGET
   ======================================== */

.calls-analytics-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

.calls-analytics-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.calls-analytics-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-success-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.calls-analytics-title h3 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
}

.calls-analytics-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* Gauge row */
.gauge-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

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

@media (max-width: 640px) {
  .gauge-row {
    grid-template-columns: 1fr;
  }
}

.gauge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gauge-extra {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-2);
}

/* Incoming stats (for calls without gauge) */
.incoming-stats {
  padding: var(--space-4) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.incoming-main {
  text-align: center;
}

.incoming-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.incoming-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.incoming-details {
  display: flex;
  gap: var(--space-6);
}

.incoming-stat {
  text-align: center;
}

.incoming-stat-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

.incoming-stat-label {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.incoming-percent {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

/* Metrics compact (for small cards) */
.metrics-compact {
  padding: var(--space-3) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.metric-compact-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.metric-compact-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-compact-value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.metric-compact-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Peak chart */
.peak-chart {
  margin-top: var(--space-3);
}

.peak-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 40px;
}

.peak-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  transition: all 0.3s ease;
}

/* Peak hours chart - столбчатая диаграмма */
.peak-hours-chart {
  padding: var(--space-3) 0;
}

.peak-chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 3px;
  height: 50px;
  padding: 0 4px;
}

.peak-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.peak-bar-fill {
  width: 100%;
  min-width: 10px;
  max-width: 20px;
  background: #FCA5A5;
  border-radius: 2px 2px 0 0;
  margin-top: auto;
}

.peak-bar-fill.is-peak {
  background: var(--color-primary);
}

.peak-hour-label {
  font-size: 8px;
  color: var(--text-muted);
  margin-top: 2px;
}

.peak-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-light);
}

.peak-value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.peak-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Incoming compact */
.incoming-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) 0;
}

.incoming-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.incoming-breakdown {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-2);
}

.incoming-rate {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  margin-top: var(--space-1);
}

/* Day bars compact */
.day-bars-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-bar-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.day-label {
  width: 24px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.day-bar-bg {
  flex: 1;
  height: 14px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}

.day-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.day-value {
  width: 24px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

/* Days grid */
.calls-days-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
}

@media (max-width: 900px) {
  .calls-days-grid {
    grid-template-columns: 1fr;
  }
}

.calls-days-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-xl);
  padding: var(--space-5);
}

.calls-days-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.calls-days-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.calls-days-badge {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-hover);
  border-radius: var(--border-radius-md);
}

.calls-days-summary {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.calls-days-total {
  font-weight: var(--font-weight-semibold);
}

/* Day bars */
.day-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.day-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.day-bar-label {
  width: 28px;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

.day-bar-track {
  flex: 1;
  height: 28px;
  background: var(--bg-hover);
  border-radius: var(--border-radius-lg);
  position: relative;
  overflow: hidden;
}

.day-bar-fill {
  height: 100%;
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: var(--space-2);
  transition: width 0.5s ease;
}

.day-bar-value-inside {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: white;
}

.day-bar-value-outside {
  position: absolute;
  left: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

.day-bar-target {
  width: 28px;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-align: right;
}

/* =========================================
   PERIOD SELECTOR COMPONENT
   ======================================== */

.period-selector {
  margin-bottom: var(--space-6);
}

.period-selector-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Tabs Group */
.period-tabs-group {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

/* Individual Tab */
.period-tab {
  padding: 10px 16px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border-radius: var(--border-radius-lg);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.period-tab:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.period-tab.active {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(217, 68, 82, 0.25);
}

.period-tab.custom {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tabs Divider */
.period-tabs-divider {
  width: 1px;
  height: 24px;
  background: var(--border-default);
  margin: 0 4px;
}

/* Calendar Dropdown */
.period-calendar-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--card-border-radius);
  box-shadow: var(--shadow-dropdown);
  z-index: 9999;
}

.period-calendar-dropdown .calendar-header {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-elevated);
}

.period-calendar-dropdown .calendar-step {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.period-calendar-dropdown .calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
}

.period-calendar-dropdown .calendar-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-lg);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.period-calendar-dropdown .calendar-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.period-calendar-dropdown .calendar-month-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.period-calendar-dropdown .calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.period-calendar-dropdown .calendar-weekday {
  text-align: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  padding: var(--space-1);
}

.period-calendar-dropdown .calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: var(--space-2) var(--space-3);
  gap: 2px;
}

.period-calendar-dropdown .calendar-day {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-md);
  border: none;
  background: transparent;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.period-calendar-dropdown .calendar-day:hover:not(:disabled) {
  background: var(--bg-hover);
}

.period-calendar-dropdown .calendar-day.selected {
  background: var(--color-primary);
  color: white;
  font-weight: var(--font-weight-medium);
}

.period-calendar-dropdown .calendar-day.in-range {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.period-calendar-dropdown .calendar-day.today {
  background: var(--bg-hover);
  color: var(--color-primary);
  font-weight: var(--font-weight-medium);
}

.period-calendar-dropdown .calendar-day:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.period-calendar-dropdown .calendar-presets {
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border-light);
  background: var(--bg-elevated);
}

.period-calendar-dropdown .calendar-presets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.period-calendar-dropdown .calendar-preset-btn {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.period-calendar-dropdown .calendar-preset-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.period-calendar-dropdown .calendar-preset-btn.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.period-calendar-dropdown .calendar-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  border-top: 1px solid var(--border-light);
}

.period-calendar-dropdown .calendar-action-btn {
  flex: 1;
  padding: 10px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border-radius: var(--border-radius-lg);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.period-calendar-dropdown .calendar-action-btn.reset {
  background: transparent;
  color: var(--text-muted);
}

.period-calendar-dropdown .calendar-action-btn.reset:hover {
  color: var(--text-primary);
}

.period-calendar-dropdown .calendar-action-btn.apply {
  background: var(--color-primary);
  color: white;
}

.period-calendar-dropdown .calendar-action-btn.apply:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.period-calendar-dropdown .calendar-action-btn.apply:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Period Info (right side) */
.period-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
}

.period-info-label {
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.period-info-separator {
  color: var(--text-muted);
}

.period-info-dates {
  color: var(--text-secondary);
}

.period-export-btn {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-export-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* ========================================
   EMPLOYEE PAGE COMPONENTS
   ======================================== */

/* Summary Stats Grid */
.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.summary-stat-card {
  flex: 1;
  min-width: 140px;
  background: var(--bg-card);
  border-radius: var(--border-radius-xl);
  padding: var(--space-4) var(--space-5);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.summary-stat-value {
  font-size: 32px;
  font-weight: var(--font-bold);
  line-height: 1.1;
  margin-bottom: var(--space-1);
}

.summary-stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .summary-stats {
    flex-wrap: wrap;
  }

  .summary-stat-card {
    min-width: calc(50% - var(--space-2));
  }
}

/* =========================================
   Employee Card v2 - Circular Visualizations
   ======================================== */

.emp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-xl);
  padding: var(--space-4);
  cursor: pointer;
  transition: all var(--transition-normal);
}

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

.emp-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

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

.emp-name {
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.emp-position {
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.emp-index {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.emp-index-circle {
  position: relative;
  width: 48px;
  height: 48px;
}

.emp-index-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: var(--font-bold);
}

.emp-index-label {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Metrics Row - 3 columns */
.emp-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.emp-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-2);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
}

.emp-metric-circle {
  position: relative;
  width: 36px;
  height: 36px;
  margin-bottom: 4px;
}

.emp-metric-val {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: var(--font-bold);
}

.emp-metric-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.emp-metric-trend {
  font-size: 9px;
  font-weight: var(--font-medium);
  margin-top: 2px;
}

/* Gauge metric (speedometer) */
.emp-metric-gauge {
  padding: var(--space-2) var(--space-1);
}

.emp-metric-gauge svg {
  display: block;
  margin: 0 auto;
}

.emp-metric-gauge-value {
  font-size: 11px;
  margin-top: 2px;
  margin-bottom: 2px;
}

/* ===== Department Calls Summary Widget ===== */
.dept-calls-summary {
  padding: var(--space-5);
}

.dept-gauges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-4);
}

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

.dept-gauge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4);
  background: var(--bg-subtle);
  border-radius: var(--border-radius-lg);
  transition: all var(--transition-fast);
}

.dept-gauge-item:hover {
  background: var(--bg-nav-active);
  transform: translateY(-2px);
}

.dept-gauge-circle {
  position: relative;
  width: 120px;
  height: 75px;
}

.dept-gauge-svg {
  width: 100%;
  height: 100%;
}

.dept-gauge-fill {
  transition: stroke-dashoffset 0.8s ease-out;
}

.dept-gauge-value {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  line-height: 1;
}

.dept-gauge-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dept-gauge-plan {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.dept-gauge-label {
  margin-top: var(--space-3);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.dept-gauge-percent {
  margin-top: var(--space-1);
  font-size: 0.813rem;
  font-weight: 600;
}

/* Department Indicator Dot */
.dept-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dept-indicator-lg {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 15%, transparent);
}

/* Department Employees Grid */
.dept-employees-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
  padding: var(--space-4);
}

/* Mini Employee Card */
.emp-card-mini {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-subtle);
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.emp-card-mini:hover {
  background: var(--bg-nav-active);
  transform: translateX(4px);
}

.emp-mini-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
}

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

.emp-mini-name {
  font-weight: 600;
  font-size: 0.938rem;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.emp-mini-metrics {
  display: flex;
  gap: var(--space-4);
}

.emp-mini-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.emp-mini-label {
  font-size: 0.688rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.emp-mini-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Ranking Page Styles */
.ranking-list {
  display: flex;
  flex-direction: column;
}

.ranking-row {
  display: table-row !important;
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.ranking-row:hover {
  background: var(--bg-subtle);
}

.ranking-position {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

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

.ranking-name {
  font-weight: 500;
  font-size: 0.938rem;
  color: var(--text-primary);
}

.ranking-stats {
  display: flex;
  gap: var(--space-3);
  font-size: 0.813rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.ranking-trend {
  font-weight: 500;
}

.ranking-score {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ===== Employee Card V2 - Redesigned ===== */
.emp-card-v2 {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-xl);
  padding: 0;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.emp-card-v2:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

/* Accent stripe at top */
.emp-card-stripe {
  height: 4px;
  width: 100%;
}

/* Header v2 */
.emp-card-header-v2 {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
}

/* Avatar */
.emp-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.emp-avatar-initials {
  font-size: 14px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Info v2 */
.emp-info-v2 {
  flex: 1;
  min-width: 0;
}

/* Index v2 - larger and more prominent */
.emp-index-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.emp-index-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emp-index-value-v2 {
  position: absolute;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.emp-index-label-v2 {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* Metrics v2 with dividers */
.emp-metrics-v2 {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4) var(--space-4);
  gap: var(--space-2);
}

.emp-metric-v2 {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.emp-metric-v2.emp-metric-gauge-v2 {
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.emp-metric-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emp-metric-num {
  position: absolute;
  font-size: 13px;
  font-weight: 700;
}

.emp-metric-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.emp-metric-label-v2 {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}

.emp-metric-trend-v2 {
  font-size: 9px;
  font-weight: 600;
}

.emp-calls-value {
  display: flex;
  align-items: baseline;
  gap: 1px;
}

/* Divider between metrics */
.emp-metric-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border-light);
  margin: 0 var(--space-1);
}

/* Employees Grid */
.emp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 640px) {
  .emp-grid {
    grid-template-columns: 1fr;
  }

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

/* Progress Bar */
.progress-bar {
  height: 4px;
  border-radius: var(--radius-sm);
  background: var(--border-light);
  margin-top: var(--space-2);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width var(--transition-slow);
}

/* Avatar Variants */
.avatar-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: var(--font-semibold);
}

/* Background Color Utilities */
.bg-success {
  background-color: var(--color-success);
}

.bg-error {
  background-color: var(--color-error);
}

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

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

.bg-primary {
  background-color: var(--color-primary);
}

/* =========================================
   Department Section v2 - Collapsible
   ======================================== */

.dept-section {
  margin-bottom: var(--space-5);
}

.dept-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-xl);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.dept-header:hover {
  border-color: var(--border-medium);
  background: var(--bg-hover);
}

.dept-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.dept-toggle.collapsed {
  transform: rotate(-90deg);
}

.dept-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dept-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.dept-name {
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  color: var(--text-primary);
}

.dept-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.dept-stats {
  display: flex;
  gap: var(--space-5);
}

.dept-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 60px;
}

.dept-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: 1.2;
}

.dept-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dept-content {
  margin-top: var(--space-4);
  padding-left: var(--space-6);
}

.dept-content.hidden {
  display: none;
}

@media (max-width: 768px) {
  .dept-stats {
    display: none;
  }

  .dept-content {
    padding-left: 0;
  }
}

/* =========================================
   Department Ranking Table
   ======================================== */

.ranking-table-container {
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  overflow: hidden;
}

.ranking-table-header {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--border-light);
  padding: var(--space-3) var(--space-4);
  font-size: 11px;
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ranking-table-body {
  background: var(--bg-card);
}

.ranking-table-row {
  display: flex;
  align-items: center;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.ranking-table-row:last-child {
  border-bottom: none;
}

.ranking-table-row:hover {
  background: var(--bg-hover);
}

.ranking-col {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranking-col-rank {
  width: 48px;
  flex-shrink: 0;
}

.ranking-rank-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.ranking-col-name {
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 var(--space-3);
}

.ranking-employee-name {
  font-weight: var(--font-medium);
  font-size: var(--text-base);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-employee-position {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-col-metric {
  width: 70px;
  flex-shrink: 0;
  justify-content: center;
}

.ranking-metric-value {
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
}

.ranking-col-trend {
  width: 70px;
  flex-shrink: 0;
}

.ranking-trend {
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

.ranking-col-action {
  width: 32px;
  flex-shrink: 0;
}

.ranking-arrow {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

/* =========================================
   Full Ranking Table (Page)
   ======================================== */

/* Moved styles to RANKING TABLE section below */


.ranking-table-wrapper {
  overflow-x: auto;
  border-top: 1px solid var(--border-light);
}

/* ===================================
   RANKING TABLE - Таблица рейтинга
   =================================== */

/* Period Selector wrapper for spacing */
#ranking-period-selector {
  margin-bottom: var(--space-6);
}

/* Department ranking card with background and border */
.ranking-dept-table {
  background: var(--bg-white) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-lg) !important;
  overflow: hidden !important;
  margin-bottom: var(--space-6) !important;
}

.ranking-table-wrapper {
  overflow-x: auto;
  background: var(--bg-white) !important;
}

.ranking-full-table {
  width: 100% !important;
  border-collapse: collapse !important;
  table-layout: fixed !important;
}

.ranking-full-table thead {
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 1;
}

.ranking-full-table th {
  /* Padding задан индивидуально для каждой колонки ниже */
  text-align: left !important;
  font-size: 11px;
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0 !important;
  border-bottom: 2px solid var(--border-light);
  white-space: normal !important;
  /* Разрешаем перенос для длинных названий */
  line-height: 1.2 !important;
  vertical-align: bottom !important;
  user-select: none;
}

.ranking-full-table th.sortable {
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.ranking-full-table th.sortable:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.ranking-full-table th.sort-active {
  color: var(--color-primary);
  background: var(--bg-subtle);
}

.ranking-full-table th .sort-icon {
  margin-left: var(--space-1);
  font-size: 10px;
  opacity: 0.5;
}

.ranking-full-table th.sort-active .sort-icon {
  opacity: 1;
  color: var(--color-primary);
}

.ranking-full-table th.col-rank {
  width: 40px !important;
  text-align: left !important;
  padding-top: var(--space-3) !important;
  padding-bottom: var(--space-3) !important;
  padding-left: 16px !important;
  padding-right: 4px !important;
}

.ranking-full-table th.col-name {
  width: 240px !important;
  text-align: left !important;
  padding-top: var(--space-3) !important;
  padding-bottom: var(--space-3) !important;
  padding-left: 12px !important;
  padding-right: 8px !important;
}

.ranking-full-table th.col-metric {
  width: 130px !important;
  text-align: left !important;
  padding-top: var(--space-3) !important;
  padding-bottom: var(--space-3) !important;
  padding-left: 12px !important;
  padding-right: 8px !important;
}

.ranking-full-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.ranking-full-table tbody tr:hover {
  background: var(--bg-subtle);
}

.ranking-full-table tbody tr:last-child {
  border-bottom: none;
}

.ranking-full-table td {
  /* Padding задан индивидуально для каждой колонки ниже */
  vertical-align: middle;
  text-align: left !important;
}

.ranking-full-table td.col-rank {
  width: 40px !important;
  text-align: left !important;
  padding-top: var(--space-4) !important;
  padding-bottom: var(--space-4) !important;
  padding-left: 16px !important;
  padding-right: 4px !important;
}

.ranking-full-table td.col-name {
  width: 240px !important;
  text-align: left !important;
  padding-top: var(--space-4) !important;
  padding-bottom: var(--space-4) !important;
  padding-left: 12px !important;
  padding-right: 8px !important;
}

.ranking-full-table td.col-metric {
  width: 130px !important;
  text-align: left !important;
  padding-top: var(--space-4) !important;
  padding-bottom: var(--space-4) !important;
  padding-left: 12px !important;
  padding-right: 8px !important;
}


/* Rank Badge */
.rank-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 50% !important;
  font-weight: var(--font-bold) !important;
  font-size: 12px !important;
  background: var(--bg-subtle) !important;
  color: var(--text-secondary) !important;
}

.rank-badge.rank-1 {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #5D4000;
  box-shadow: 0 2px 6px rgba(255, 193, 7, 0.4);
}

.rank-badge.rank-2 {
  background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
  color: #404040;
  box-shadow: 0 2px 6px rgba(192, 192, 192, 0.4);
}

.rank-badge.rank-3 {
  background: linear-gradient(135deg, #CD7F32, #B8860B);
  color: #3D2600;
  box-shadow: 0 2px 6px rgba(205, 127, 50, 0.4);
}

/* Employee Info in Table */
.ranking-full-table .emp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
}

.ranking-full-table .emp-name {
  font-weight: var(--font-medium);
  font-size: var(--text-base);
  color: var(--text-primary);
}

.ranking-full-table .emp-position {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Metric Value */
.ranking-full-table .metric-value {
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  display: block !important;
  text-align: left !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Trend Badge */
.trend-badge {
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.ranking-table-row:hover .ranking-arrow {
  color: var(--color-primary);
  transform: translateX(2px);
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (Ranking Page & Global)
   ========================================================================== */

@media (max-width: 768px) {
  .mobile-only {
    display: flex !important;
  }

  .sidebar {
    transform: translateX(-100%);
    position: fixed !important;
    z-index: 1000 !important;
    width: 280px !important;
    height: 100vh !important;
    transition: transform var(--transition-normal) !important;
    box-shadow: var(--shadow-lg) !important;
    left: 0 !important;
    top: 0 !important;
  }

  .sidebar.active {
    transform: translateX(0) !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: var(--space-4) !important;
    width: 100% !important;
  }

  /* Page Header adjustments */
  .header {
    margin-bottom: var(--space-4) !important;
  }

  .page-header {
    margin-bottom: var(--space-4) !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: var(--space-3) !important;
  }

  .page-title {
    font-size: 22px !important;
  }

  .page-subtitle {
    font-size: 12px !important;
  }

  /* Period Selector on mobile - stack buttons */
  .period-selector-container {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: var(--space-3) !important;
  }

  .period-buttons {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
    background: var(--bg-elevated) !important;
    padding: 4px !important;
    border-radius: var(--radius-lg) !important;
  }

  .period-btn {
    padding: 8px 4px !important;
    font-size: 11px !important;
    justify-content: center !important;
    border-radius: var(--radius-md) !important;
  }

  .datepicker-trigger {
    width: 100% !important;
    justify-content: center !important;
    padding: 10px !important;
  }

  /* Ranking Table on mobile */
  .ranking-dept-table {
    border-radius: var(--radius-md) !important;
    margin-bottom: var(--space-4) !important;
    border: 1px solid var(--border-light) !important;
  }

  .widget-header {
    padding: var(--space-3) 16px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: var(--space-2) !important;
  }

  .widget-title {
    font-size: 13px !important;
    width: 100% !important;
  }

  .widget-header .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 8px !important;
    font-size: 11px !important;
  }

  /* Table Horizontal Scroll UX */
  .ranking-table-wrapper {
    margin: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 !important;
  }

  .ranking-full-table {
    min-width: 650px !important;
    /* Force minimal width to allow scrolling instead of squashing */
    table-layout: fixed !important;
  }

  .ranking-full-table th,
  .ranking-full-table td {
    padding: var(--space-3) var(--space-2) !important;
  }

  .ranking-full-table th.col-rank,
  .ranking-full-table td.col-rank {
    padding-left: 16px !important;
    width: 35px !important;
  }

  .ranking-full-table th.col-name,
  .ranking-full-table td.col-name {
    width: 150px !important;
  }

  .ranking-full-table th.col-metric,
  .ranking-full-table td.col-metric {
    width: 90px !important;
  }

  .emp-name {
    font-size: 13px !important;
  }

  .emp-position {
    font-size: 10px !important;
  }

  .metric-value {
    font-size: 13px !important;
  }

  .rank-badge {
    width: 24px !important;
    height: 24px !important;
    font-size: 11px !important;
  }
}

@media (max-width: 640px) {
  /* We can leave the previous 640px styles or overwrite them */
}

/* Page Header with Controls */
.page-header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.page-header-info {
  flex: 1;
  min-width: 200px;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* Search Input with Icon */
.search-wrapper {
  position: relative;
}

.search-input {
  padding-left: var(--space-10);
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Filter Select */
.filter-select {
  padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  min-width: 180px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 18px;
  transition: border-color var(--transition-fast);
}

.filter-select:hover {
  border-color: var(--text-muted);
}

/* ========================================
   Growth & Focus Widget
   ======================================== */

.growth-focus-widget {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  border: 1px solid var(--border-light);
}

.growth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.growth-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.growth-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary-muted));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.growth-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.growth-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}

.growth-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

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

/* Focus Section */
.growth-focus-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.focus-card {
  background: linear-gradient(135deg, var(--color-primary-light), #FFF5F5);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: var(--space-4);
}

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

.focus-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.focus-edit-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
}

.focus-card:hover .focus-edit-btn {
  opacity: 1;
}

.focus-edit-btn:hover {
  background: var(--color-primary-muted);
  color: var(--color-primary);
}

.focus-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.focus-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* AI Recommendation */
.ai-recommendation {
  background: var(--color-info-light);
  border: 1px solid var(--color-info);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.ai-recommendation-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-info);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
}

.ai-recommendation-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Tasks Section */
.growth-tasks-section {
  display: flex;
  flex-direction: column;
}

.tasks-card {
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  height: 100%;
}

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

.tasks-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.tasks-count {
  background: var(--color-primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Add Task Form */
.add-task-form {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}

.add-task-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.add-task-row .input {
  flex: 1;
}

/* Tasks List */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.task-item:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.task-item.completed {
  opacity: 0.6;
}

.task-item.overdue {
  border-left: 3px solid var(--color-error);
}

.task-checkbox-wrapper {
  cursor: pointer;
  flex-shrink: 0;
}

.task-checkbox-visual {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  color: transparent;
}

.task-checkbox-visual:hover {
  border-color: var(--color-primary);
}

.task-checkbox-visual.checked {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

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

.task-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  display: block;
}

.task-text.completed {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

.task-due.overdue {
  color: var(--color-error);
}

.delete-task-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
}

.task-item:hover .delete-task-btn {
  opacity: 1;
}

.delete-task-btn:hover {
  background: var(--color-error-light);
  color: var(--color-error);
}

/* Tasks Empty State */
.tasks-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* History Panel */
.history-panel {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-light);
}

.history-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

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

@media (max-width: 640px) {
  .history-grid {
    grid-template-columns: 1fr;
  }
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.history-check {
  color: var(--color-success);
  flex-shrink: 0;
  margin-top: 2px;
}

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

.history-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: line-through;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.history-more {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-3);
}

.history-empty {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: var(--space-4);
}

/* ========================================
   Call Expanded Details
   ======================================== */

.call-expanded-wrapper {
  padding: var(--space-5);
  background: linear-gradient(to bottom, var(--bg-hover), var(--bg-card));
  border-top: 1px solid var(--border-light);
}

.call-expanded-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  position: relative;
}

.call-close-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.call-close-btn:hover {
  background: var(--color-error-light);
  border-color: var(--color-error);
  color: var(--color-error);
}

.call-meta-grid {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.call-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.call-meta-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.call-meta-item.call-score {
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.call-meta-item.call-score.text-success {
  background: var(--color-success-light);
}

.call-meta-item.call-score.text-info {
  background: var(--color-info-light);
}

.call-meta-item.call-score.text-warning {
  background: var(--color-warning-light);
}

.call-meta-item.call-score.text-error {
  background: var(--color-error-light);
}

.call-audio-section {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.call-audio-player {
  height: 36px;
  border-radius: var(--radius-md);
}

.call-expanded-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

@media (max-width: 900px) {
  .call-expanded-content {
    grid-template-columns: 1fr;
  }
}

.call-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-3);
}

.call-section-header svg {
  color: var(--color-primary);
}

/* Transcript Section */
.call-transcript-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.call-transcript-content {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.call-transcript-content>div {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Evaluation Section */
.call-evaluation-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.call-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.call-summary-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Feedback Cards */
.call-feedback-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

@media (max-width: 600px) {
  .call-feedback-grid {
    grid-template-columns: 1fr;
  }
}

.call-feedback-card {
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  border-left: 3px solid;
}

.call-feedback-card.success {
  background: var(--color-success-light);
  border-color: var(--color-success);
}

.call-feedback-card.warning {
  background: var(--color-warning-light);
  border-color: var(--color-warning);
}

.call-feedback-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.call-feedback-card.success .call-feedback-header {
  color: var(--color-success);
}

.call-feedback-card.warning .call-feedback-header {
  color: var(--color-warning);
}

.call-feedback-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.call-feedback-list li {
  padding: 2px 0;
  padding-left: 12px;
  position: relative;
}

.call-feedback-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: inherit;
}

/* Scores Card */
.call-scores-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.call-scores-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.call-score-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.call-score-name {
  flex: 1;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-score-bar {
  width: 80px;
  height: 6px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.call-score-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-fast);
}

.call-score-value {
  width: 36px;
  text-align: right;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

/* No Evaluation */
.call-no-evaluation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-6);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Actions */
.call-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding-top: var(--space-2);
}

/* ========================================
   Quality Analysis Widget v2
   ======================================== */

.quality-widget {
  padding: var(--space-5);
}

.quality-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.quality-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--color-info-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-info);
}

.quality-title h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.quality-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.quality-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

.quality-chart-section {
  position: relative;
}

.quality-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
}

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

.quality-legend .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
}

/* Two Columns for Insights */
.quality-insights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 600px) {
  .quality-insights {
    grid-template-columns: 1fr;
  }
}

.quality-column {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.quality-column.quality-improvements {
  border-left: 3px solid var(--color-error);
}

.quality-column.quality-strengths {
  border-left: 3px solid var(--color-success);
}

.quality-column-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.quality-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.quality-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

.quality-list .list-bullet {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  margin-top: 6px;
  flex-shrink: 0;
}

/* Quality Index Section */
.quality-index-section {
  display: flex;
  justify-content: center;
}

.quality-index-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-hover);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
}

.quality-index-card.level-success {
  background: var(--color-success-light);
}

.quality-index-card.level-info {
  background: var(--color-info-light);
}

.quality-index-card.level-warning {
  background: var(--color-warning-light);
}

.quality-index-card.level-error {
  background: var(--color-error-light);
}

.quality-index-circle {
  position: relative;
  width: 80px;
  height: 80px;
}

.quality-index-svg {
  width: 100%;
  height: 100%;
}

.quality-index-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.quality-index-value .value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

.quality-index-value .unit {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.quality-index-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quality-index-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.quality-index-level {
  font-size: var(--text-lg);
  font-weight: 600;
}

.quality-index-trend {
  font-size: var(--text-xs);
}

.filter-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* =========================================
   SETTINGS PAGE - REDESIGN
   ======================================== */

.settings-page {
  padding: var(--space-6);
  max-width: 1400px;
  margin: 0 auto;
}

.settings-header {
  margin-bottom: var(--space-6);
}

.settings-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.settings-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elevated);
  border-radius: 12px;
  margin-bottom: var(--space-6);
  width: fit-content;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.settings-tab.active {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(217, 68, 82, 0.25);
}

.settings-tab svg {
  width: 18px;
  height: 18px;
}

.settings-tab.active svg {
  color: white;
}

/* Settings Content */
.settings-content {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  min-height: 500px;
  overflow: visible;
}

/* ===== SCENARIOS TAB ===== */
.scenarios-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 600px;
}

.scenarios-sidebar {
  border-right: 1px solid var(--border-light);
  background: var(--bg-elevated);
}

.scenarios-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.scenarios-sidebar-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.scenarios-list {
  padding: 12px;
}

.scenario-group {
  margin-bottom: 16px;
}

.scenario-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 4px;
}

.scenario-group-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.scenario-group-count {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--border-light);
  border-radius: 10px;
  color: var(--text-secondary);
}

.scenario-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 4px;
  border: none;
  background: var(--bg-card);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

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

.scenario-item.active {
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-muted);
}

.scenario-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scenario-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.scenario-item-code {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.scenario-item-status {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.scenario-item-status.active {
  background: var(--color-success-light);
  color: var(--color-success);
}

/* Scenario Editor */
.scenario-editor {
  padding: 28px 32px;
  overflow-y: auto;
  max-height: 800px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state-icon {
  margin-bottom: 16px;
  opacity: 0.3;
}

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

.empty-state p {
  font-size: 14px;
}

/* Editor Container */
.editor-container {
  max-width: 900px;
}

.editor-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.editor-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.editor-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.editor-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.editor-meta {
  display: flex;
  gap: 24px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-muted);
}

.meta-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

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

/* Checklist Editor */
.checklist-editor {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 20px;
}

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

.checklist-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.checklist-category {
  background: var(--bg-card);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-light);
}

.category-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.category-weight {
  font-size: 12px;
  color: var(--text-muted);
}

.category-items {
  padding: 8px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

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

.item-drag {
  color: var(--text-muted);
  cursor: grab;
  font-size: 12px;
  opacity: 0.5;
}

.item-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-text {
  font-size: 14px;
  color: var(--text-primary);
}

.item-required {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--color-error-light);
  color: var(--color-error);
  border-radius: 4px;
}

.item-weight {
  display: flex;
  align-items: center;
  gap: 4px;
}

.weight-input {
  width: 48px;
  padding: 6px 8px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  background: var(--bg-card);
  color: var(--text-primary);
}

.weight-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

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

.item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.checklist-item:hover .item-actions {
  opacity: 1;
}

.add-item-btn {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 1px dashed var(--border-default);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-item-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.add-item-btn svg {
  width: 16px;
  height: 16px;
}

.add-item-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.empty-checklist {
  text-align: center;
  padding: 60px 40px;
  color: var(--text-muted);
}

.empty-checklist-icon {
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-checklist-icon svg {
  width: 48px;
  height: 48px;
}

.empty-checklist p {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-checklist span {
  font-size: 13px;
}

/* Category Header Enhanced */
.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-light);
}

.category-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-drag {
  color: var(--text-muted);
  font-size: 12px;
  opacity: 0.4;
  cursor: grab;
}

.category-count {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-elevated);
  border-radius: 10px;
}

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

/* ===== CHECKLIST ITEM - EXPANDABLE ===== */
.checklist-item {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  margin-bottom: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
  overflow: hidden;
}

.checklist-item:hover {
  border-color: var(--border-default);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.checklist-item.expanded {
  border-color: var(--color-primary-muted);
  box-shadow: 0 4px 12px rgba(217, 68, 82, 0.08);
}

.item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.item-expand-icon {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.item-expand-icon svg {
  width: 14px;
  height: 14px;
}

.checklist-item.expanded .item-expand-icon {
  color: var(--color-primary);
}

.item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.item-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 5px;
}

.badge-error {
  background: var(--color-error-light);
  color: var(--color-error);
}

.badge-muted {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

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

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.item-weight-display {
  display: flex;
  align-items: baseline;
  gap: 2px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-radius: 6px;
}

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

.weight-unit {
  font-size: 11px;
  color: var(--text-muted);
}

/* Item Details - Expanded Section */
.item-details {
  display: none;
  padding: 0 16px 16px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-light);
}

.item-details.visible {
  display: block;
}

.item-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  padding-top: 16px;
}

.detail-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-group-full {
  grid-column: 1 / -1;
}

.detail-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.detail-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.detail-select,
.detail-input {
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.detail-select:focus,
.detail-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.detail-textarea {
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  background: var(--bg-card);
  color: var(--text-primary);
  resize: vertical;
  min-height: 80px;
  transition: all 0.15s ease;
}

.detail-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.detail-textarea::placeholder {
  color: var(--text-muted);
}

/* Button Improvements */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-md {
  padding: 10px 18px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
}

.btn-lg svg {
  width: 20px;
  height: 20px;
}

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

.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 68, 82, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon-ghost {
  opacity: 0.6;
}

.btn-icon-ghost:hover {
  opacity: 1;
}

.btn-icon-danger:hover {
  background: var(--color-error-light);
  color: var(--color-error);
}

/* ===== PLANS TAB ===== */
.plans-container {
  padding: 24px;
}

.plans-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.plans-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.plans-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Department Sections */
.plans-departments {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.plans-dept-section {
  background: var(--bg-elevated);
  border-radius: 12px;
  overflow: hidden;
}

.plans-dept-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.plans-dept-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.plans-dept-badge {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
}

.plans-dept-title h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.plans-dept-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* Quick Set Controls */
.plans-dept-quick {
  display: flex;
  gap: 16px;
  flex: 1;
  justify-content: center;
}

.quick-set-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-set-group label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.quick-set-group .plan-input {
  width: 60px;
}

.quick-set-group .btn {
  padding: 6px 10px;
  font-size: 11px;
}

/* Department Totals */
.plans-dept-totals {
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.dept-total {
  text-align: center;
  padding: 6px 12px;
  background: var(--bg-card);
  border-radius: 8px;
  min-width: 60px;
}

.dept-total-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.dept-total-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.dept-total-all {
  background: var(--color-primary-light);
}

.dept-total-all .dept-total-value {
  color: var(--color-primary);
}

/* Employees Table */
.plans-employees-table {
  padding: 0;
}

.plans-table-header {
  display: grid;
  grid-template-columns: 1fr 160px 90px 90px 80px;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.plans-table-header>div {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.plans-col-new,
.plans-col-regular,
.plans-col-total {
  text-align: center;
}

.plans-table-row {
  display: grid;
  grid-template-columns: 1fr 160px 90px 90px 80px;
  gap: 12px;
  padding: 12px 20px;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
}

.plans-table-row:last-child {
  border-bottom: none;
}

.plans-table-row:hover {
  background: var(--bg-hover);
}

.plans-col-name .emp-name {
  font-weight: 500;
  color: var(--text-primary);
}

.plans-col-position {
  font-size: 13px;
  color: var(--text-secondary);
}

.plan-input {
  width: 100%;
  max-width: 70px;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-primary);
  margin: 0 auto;
  display: block;
}

.plan-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.plan-input:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: not-allowed;
}

.total-value {
  font-weight: 600;
  color: var(--color-primary);
  font-size: 15px;
  text-align: center;
  display: block;
}

/* Responsive */
@media (max-width: 900px) {
  .plans-dept-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .plans-dept-quick {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .plans-dept-totals {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .plans-table-header,
  .plans-table-row {
    grid-template-columns: 1fr 80px 80px 60px;
  }

  .plans-col-position {
    display: none;
  }
}

/* ===== PROMPTS TAB - Editor Layout ===== */
.prompts-editor-layout {
  display: grid !important;
  grid-template-columns: 280px 1fr !important;
  min-height: calc(100vh - 280px);
  gap: 0;
}

/* Prompts Navigation Sidebar */
.prompts-nav {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
}

.prompts-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.prompts-nav-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.prompts-nav-count {
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
}

.prompts-nav-list {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 4px;
  flex-grow: 1;
}

.prompt-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

.prompt-nav-item:hover {
  background: var(--bg-hover);
}

.prompt-nav-item.active {
  background: var(--color-primary-light);
}

.prompt-nav-item.active .prompt-nav-name {
  color: var(--color-primary);
}

.prompt-nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prompt-nav-icon svg {
  width: 16px;
  height: 16px;
}

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

.prompt-nav-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-nav-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-nav-version {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 6px;
  background: var(--bg-hover);
  border-radius: 4px;
}

/* Prompt Editor */
.prompt-editor {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}

.prompt-editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.prompt-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-elevated);
}

.prompt-editor-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.prompt-editor-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prompt-editor-icon svg {
  width: 22px;
  height: 22px;
}

.prompt-editor-title h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.prompt-editor-title p {
  font-size: 13px;
  color: var(--text-secondary);
}

.prompt-editor-actions {
  display: flex;
  gap: 10px;
}

.prompt-editor-actions .btn {
  display: flex;
  align-items: center;
  gap: 6px;
}

.prompt-editor-actions .btn svg {
  width: 16px;
  height: 16px;
}

/* Editor Body - Main + Versions Sidebar */
.prompt-editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 260px;
}

.prompt-editor-main {
  padding: 24px;
  overflow-y: auto;
}

/* Textarea Wrapper */
.prompt-textarea-wrapper {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.prompt-textarea-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-light);
}

.prompt-textarea-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.prompt-textarea-info {
  display: flex;
  gap: 16px;
}

.prompt-char-count,
.prompt-line-count {
  font-size: 12px;
  color: var(--text-muted);
}

.prompt-textarea {
  width: 100%;
  min-height: 300px;
  padding: 16px;
  border: none;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

.prompt-textarea:focus {
  outline: none;
}

.prompt-textarea::placeholder {
  color: var(--text-muted);
}

.prompt-textarea-footer {
  padding: 12px 16px;
  background: var(--bg-hover);
  border-top: 1px solid var(--border-light);
}

.prompt-variables {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.var-tag {
  display: inline-block;
  padding: 4px 8px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 4px;
  font-size: 11px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  cursor: pointer;
  transition: all 0.15s ease;
}

.var-tag:hover {
  background: var(--color-primary);
  color: white;
}

/* Versions Sidebar */
.prompt-versions-sidebar {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}

.versions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
}

.versions-header svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.versions-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.version-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
}

.version-item.current .version-label {
  color: var(--color-success);
  font-weight: 600;
}

.version-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 12px;
  padding-top: 6px;
}

.version-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-light);
  flex-shrink: 0;
}

.version-dot.active {
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-light);
}

.version-line {
  width: 2px;
  flex: 1;
  background: var(--border-light);
  margin-top: 4px;
}

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

.version-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.version-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.version-id {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
}

.version-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.version-date svg {
  width: 12px;
  height: 12px;
}

.version-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.version-author {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.version-restore {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.version-restore svg {
  width: 12px;
  height: 12px;
}

/* Empty State */
.prompt-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 48px;
}

.prompt-empty-state .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text-muted);
}

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

.prompt-empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.prompt-empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .prompts-editor-layout {
    grid-template-columns: 1fr;
  }

  .prompts-nav {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }

  .prompts-nav-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
  }

  .prompt-nav-item {
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .prompt-editor-body {
    grid-template-columns: 1fr;
  }

  .prompt-versions-sidebar {
    border-left: none;
    border-top: 1px solid var(--border-light);
    max-height: 300px;
  }
}

/* ===== DEPARTMENTS TAB ===== */
.departments-container {
  padding: 24px;
}

.departments-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.departments-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.departments-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.departments-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.department-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border-radius: 12px;
  transition: box-shadow 0.15s ease;
}

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

.department-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.department-info {
  flex: 1;
}

.department-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.department-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.department-stats {
  display: flex;
  gap: 24px;
}

.department-stats .stat {
  text-align: center;
}

.department-stats .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.department-stats .stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

.department-actions {
  display: flex;
  gap: 8px;
}

/* ===== GENERAL TAB ===== */
.general-container {
  padding: 24px;
  max-width: 600px;
}

.general-header {
  margin-bottom: 24px;
}

.general-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.general-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.settings-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px;
  background: var(--bg-elevated);
  border-radius: 12px;
}

.section-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.section-header p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 280px;
}

.input-with-suffix {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-input {
  width: 80px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  background: var(--bg-card);
  color: var(--text-primary);
}

.settings-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.input-suffix {
  font-size: 14px;
  color: var(--text-muted);
}

.settings-select {
  min-width: 260px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
}

.settings-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-default);
  border-radius: 26px;
  transition: 0.2s;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle input:checked+.toggle-slider {
  background: var(--color-primary);
}

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

.settings-section-actions {
  justify-content: flex-end;
  background: transparent;
  padding: 0;
}

/* Button Icon */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-primary {
  background: var(--color-primary);
  color: white;
}

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

.btn-icon-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-icon-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon-danger:hover {
  color: var(--color-error);
}

/* Button styles */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

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

/* Responsive */
@media (max-width: 900px) {
  .scenarios-layout {
    grid-template-columns: 1fr;
  }

  .scenarios-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    max-height: 300px;
    overflow-y: auto;
  }
}

/* ========================================
   SORTABLE JS STYLES
   ======================================== */

.sortable-ghost {
  opacity: 0.4;
  background: var(--color-primary-light) !important;
  border: 2px dashed var(--color-primary) !important;
  border-radius: var(--radius-lg);
}

.sortable-chosen {
  opacity: 0.9;
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
}

.category-drag,
.item-drag {
  cursor: grab;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.category-drag:hover,
.item-drag:hover {
  color: var(--text-primary);
}

.category-drag:active,
.item-drag:active {
  cursor: grabbing;
}