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

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

/* Шрифт Manrope подключается локально (index.html → assets/fonts/manrope/fonts.css). */

/* ========================================
   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);
}

.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
   ======================================== */

/* Mobile-only elements - hidden on desktop */
.mobile-only {
  display: none !important;
}

.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);
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.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-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;
}

/* Дерево «Отделы → сотрудники» в меню — в okk-theme.css (components/sidebar-nav.js). */

/* 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);
}

/* ========================================
   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);
}

/* Reference Page */
.reference-page {
  max-width: 1180px;
}

.reference-section-heading h2 {
  font-size: var(--text-lg);
  color: var(--text-primary);
}

.reference-section-heading p {
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.reference-section {
  margin-bottom: var(--space-8);
}

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

.reference-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.reference-rule-card {
  min-height: 154px;
  padding: var(--space-5);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.reference-rule-title {
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.reference-rule-card p {
  margin: 0;
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.reference-rule-note {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
}

@media (max-width: 1100px) {
  .reference-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .reference-card-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   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-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

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

.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:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.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);
}

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

/* 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);
}

/* 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);
}

/* 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;
}

/* 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);
}

/* 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);
}

/* Table */
.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);
}

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

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

/* ----------------------------------------
   METRIC TOOLTIPS (Question mark icons)
   ---------------------------------------- */

.metric-tooltip {
  position: relative;
  display: inline-flex;
  cursor: help;
}

.metric-tooltip-icon {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--border-light);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.metric-tooltip:hover .metric-tooltip-icon {
  background: var(--color-primary);
  color: white;
}

.metric-tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 300px;
  padding: var(--space-3);
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  line-height: 1.5;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: var(--z-tooltip);
  pointer-events: none;
}

.metric-tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text-primary);
}

.metric-tooltip:hover .metric-tooltip-content {
  opacity: 1;
  visibility: visible;
}

.metric-tooltip-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
  color: white;
}

.metric-tooltip-formula {
  font-family: 'Consolas', 'Monaco', monospace;
  background: rgba(255, 255, 255, 0.1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  margin-top: var(--space-2);
  font-size: 11px;
}

/* ========================================
   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%;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

.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);
}

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

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

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

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

/* 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-y-auto {
  overflow-y: auto;
}

/* Transitions */
.transition-all {
  transition: all 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;
  }
}

/* Tablet + mobile: sidebar as burger overlay (<=1024px) — see line ~6112 */

@media (max-width: 1024px) {
  .main-content {
    margin-left: 0;
    padding: var(--space-4);
  }
}

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

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

  .md\:hidden {
    display: none;
  }

  .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);
  }
}

/* ========================================
   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);
}


/* Animations */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

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

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

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

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

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

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

/* Border utilities */
.border-light {
  border-color: var(--border-light);
}

/* =========================================
   GAUGE CARD — карточка числа в «Аналитике звонков»
   ======================================== */

.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);
}

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

.qa-widget {
  padding: 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);
}

/* Блок 11: нарушения за период — на всю ширину под зонами роста и сильными сторонами. */
.period-insights-violations {
  grid-column: 1 / -1;
}

.period-insights-link {
  color: var(--color-primary);
  text-decoration: underline;
}

/* Журнал с фильтром нарушения: фраза нарушения в строке звонка. */
.call-violation-phrase {
  margin-top: 4px;
  max-width: 320px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  white-space: normal;
}

.call-violation-phrase-link {
  color: var(--color-primary);
  white-space: nowrap;
}

/* Страница отдела: кто теряет на зоне роста больше всех. */
.period-insights-employees {
  display: block;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 600px) {
  .period-insights-widget .qa-insights {
    grid-template-columns: 1fr;
  }
}

.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-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);
}

/* 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);
}

/* Responsive */
@media (max-width: 640px) {
  .bitrix-status-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

@media (max-width: 900px) {
  .bitrix-status-simple {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

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

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

/* Legacy compact styles - hidden */
.bitrix-status-compact {
  flex: 1;
  display: flex;
  gap: 6px;
}

@media (max-width: 640px) {
  .bitrix-conv-compact,
  .bitrix-status-compact {
    width: 100%;
  }

  .bitrix-status-compact {
    display: 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);
}

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

.gauge-row.gauge-row-single {
  grid-template-columns: minmax(280px, 360px);
}

@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;
}

/* 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);
}

/* 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-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);
}

/* Day bars */
.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;
}

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

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

/* Старые вкладки и календарь периода удалены: период — общий календарь из okk-theme.css. */

.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 NAME (таблицы рейтинга)
   ======================================== */

.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;
}

/* Ranking Page Styles */
.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);
}

/* Background Color Utilities */
.bg-success {
  background-color: var(--color-success);
}

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

/* =========================================
   Department Section v2 - Collapsible
   ======================================== */

.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);
}

/* =========================================
   Full Ranking Table (Page)
   ======================================== */

.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.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;
}


/* Employee Info in Table */
.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;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (Ranking Page & Global)
   ========================================================================== */

/* Tablet + Mobile: burger menu overlay (<=920px, как в образце redesign.okk) */
@media (max-width: 920px) {
  .mobile-only {
    display: flex !important;
  }

  .sidebar {
    transform: translateX(-100%) !important;
    position: fixed !important;
    z-index: 1000 !important;
    width: var(--okk-sidebar-w, 244px) !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow-y: auto !important;
    transition: transform 0.3s ease !important;
    box-shadow: var(--shadow-lg) !important;
    left: 0 !important;
    top: 0 !important;
  }

  .sidebar.active {
    transform: translateX(0) !important;
  }

  /* Backdrop overlay when sidebar is open */
  .sidebar.active::before {
    content: '';
    position: fixed;
    top: 0;
    left: var(--okk-sidebar-w, 244px);
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }

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

/* Mobile-only styles (<768px) */
@media (max-width: 768px) {
  .header {
    margin-bottom: var(--space-4) !important;
  }

  .header-left {
    gap: var(--space-2) !important;
  }

  .main-content {
    padding: var(--space-4) !important;
  }

  /* Шапка страницы и карточек на телефоне — как в образце: строка с переносом
     (okk-theme.css), без столбца и уменьшенных подписей. */
  .page-header {
    margin-bottom: var(--space-4) !important;
    gap: 10px;
  }

  /* 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;
  }

  /* 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;
  }

  /* Размер чисел плиток и заголовков карточек на телефоне — в okk-theme.css (как у образца). */
}

@media (max-width: 640px) {
  /* We can leave the previous 640px styles or overwrite them */
}

/* Page Header with Controls */
.page-header-info {
  flex: 1;
  min-width: 200px;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ========================================
   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);
}

/* 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-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Блок 11: «Фокус на неделю» — главные зоны роста прошлой недели. */
.focus-list {
  margin: 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.focus-item-rule,
.focus-item-example {
  color: var(--text-secondary);
  margin-top: var(--space-1);
  line-height: 1.5;
}

.focus-item-link {
  white-space: nowrap;
  color: var(--color-primary);
  font-weight: 600;
  margin-left: var(--space-1);
}

/* ========================================
   Call details («Разбор звонка», страница звонка)
   ======================================== */

.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: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-5);
}

.call-expanded-content > * {
  min-width: 0;
}

@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;
}

.transcript-turn {
  display: block;
  padding: var(--space-2);
  border: 0;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-xs);
  line-height: 1.5;
}

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

.transcript-turn-text {
  overflow-wrap: anywhere;
}

.transcript-turn--manager,
.transcript-turn--speaker-a {
  background: var(--color-info-light);
}

.transcript-turn--client,
.transcript-turn--speaker-b {
  background: var(--color-primary-light);
}

.transcript-turn--ivr,
.transcript-turn--noise {
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-style: italic;
}

.transcript-turn--neutral {
  background: var(--bg-hover);
}

/* Реплика, к которой перешли из разбора оценки. */
.transcript-turn--highlight {
  outline: 2px solid var(--color-warning);
  outline-offset: 1px;
}

/* Время фразы-доказательства: переход к месту в записи и расшифровке. */
.evidence-jump {
  margin-right: var(--space-1);
  padding: 0 var(--space-1);
  border: 1px solid var(--color-info);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-info);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.evidence-jump:hover {
  background: var(--color-info);
  color: #fff;
}

/* Evaluation Section */
.call-evaluation-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Почему звонок не оценивается по фактам (повторный звонок): строки пояснения. */
.call-evaluation-note {
  display: block;
  max-width: 560px;
  margin: 0 auto;
  white-space: pre-line;
  text-align: left;
  line-height: 1.5;
  color: var(--text-secondary);
}

.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-card.error {
  background: var(--color-error-light);
  border-color: var(--color-error);
}

.call-feedback-card.error .call-feedback-header {
  color: var(--color-error);
}

.call-feedback-card.muted {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.call-feedback-card.muted .call-feedback-header {
  color: var(--text-secondary);
}

.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;
}

/* 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);
}

/* Failed Call Error */
.call-no-evaluation.failed {
  background: color-mix(in srgb, var(--color-error) 5%, var(--bg-card));
  border-color: color-mix(in srgb, var(--color-error) 30%, var(--border-light));
}

.call-no-evaluation .error-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  text-align: center;
}

.call-no-evaluation .error-title {
  color: var(--color-error);
  font-weight: 600;
}

.call-no-evaluation .error-message {
  font-size: var(--text-xs);
  color: var(--text-muted);
  max-width: 250px;
  word-break: break-word;
}

/* Analyzing animation */
.call-no-evaluation .animate-spin {
  animation: spin 1s linear infinite;
}

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

/* Actions */
.call-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding-top: var(--space-2);
}

/* Meta Items */
.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);
}

/* Badges */
.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-info {
  background: var(--color-info-light);
  color: var(--color-info);
}

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

/* 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-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);
}

/* Period Selector */
.period-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 4px;
}

.period-selector .btn {
  padding: 8px 12px;
  font-size: 12px;
  min-width: 36px;
}

.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);
}

/* Button styles */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.modal-container {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

.modal-close {
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

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

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

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

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

/* ========================================
   PLAN CELL IN RANKING TABLE
   ======================================== */

.col-metric[title] {
  cursor: help;
  position: relative;
}

.col-metric[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-inverse);
  color: var(--text-inverse);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: pre-line;
  z-index: 100;
  min-width: 150px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   BITRIX EMPLOYEE METRICS
   ============================================ */
.bitrix-widget {
  padding: 20px;
  border-radius: 8px;
}

.bitrix-widget-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

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

.bitrix-widget-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.bitrix-widget-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bitrix-refresh-btn {
  white-space: nowrap;
}

.bitrix-updated-at {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
  white-space: nowrap;
}

.bitrix-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.bitrix-status-success {
  color: #166534;
  background: #dcfce7;
}

.bitrix-status-warning {
  color: #92400e;
  background: #fef3c7;
}

.bitrix-status-danger {
  color: #991b1b;
  background: #fee2e2;
}

.bitrix-status-muted {
  color: var(--text-secondary);
  background: var(--bg-secondary);
}

.bitrix-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.bitrix-metric-tile {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.bitrix-metric-value {
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  color: var(--text-primary);
}

.bitrix-metric-label {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.25;
  color: var(--text-secondary);
}

.bitrix-metric-primary {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.bitrix-metric-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.bitrix-metric-warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.bitrix-metric-danger {
  border-color: #fecaca;
  background: #fef2f2;
}

.bitrix-stage-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.bitrix-stage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-primary);
}

.bitrix-stage-label {
  min-width: 0;
  font-size: 12px;
  line-height: 1.25;
  color: var(--text-secondary);
}

.bitrix-stage-value {
  flex: 0 0 auto;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  color: var(--text-primary);
}

.bitrix-empty-state {
  padding: 18px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.bitrix-empty-warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.bitrix-empty-danger {
  border-color: #fecaca;
  background: #fef2f2;
}

.bitrix-empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.bitrix-empty-text {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.bitrix-widget-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .bitrix-metrics-grid,
  .bitrix-stage-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .bitrix-widget-header,
  .bitrix-widget-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .bitrix-widget-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .bitrix-refresh-btn {
    width: 100%;
    justify-content: center;
  }

  .bitrix-metrics-grid,
  .bitrix-stage-strip {
    grid-template-columns: 1fr;
  }
}
