/* Грузокат — CSS для прототипов */
:root {
  --bg: #ffffff;
  --card: #f4f8f6;
  --accent: #2f8f63;
  --accent-2: #3fb77b;
  --text: #0c3c3a;
  --muted: #5d756f;
  --border: #d9e4df;
  --danger: #e15252;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius: 12px;
  --shadow: 0 12px 30px rgba(12, 60, 58, 0.08);
  --font-xxs: 0.65rem;
  --font-xs: 0.7rem;
  --font-xs-plus: 0.75rem;
  --font-sm: 0.8rem;
  --font-sm-plus: 0.85rem;
  --font-md: 0.95rem;
  --font-md-plus: 1rem;
  --font-lg: 1.1rem;
  --font-lg-plus: 1.2rem;
  --font-xl: 1.25rem;
  --font-2xl: 1.5rem;
  --font-3xl: 1.75rem;
  --font-4xl: 2rem;
  --font-hero: 3rem;
}

* { box-sizing: border-box; }

html { overflow-y: scroll; }

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

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

h2 {
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.container { width: min(1200px, 92vw); margin: 0 auto; }

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 1000;
}


.pill-link {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  background: #fff;
}

.pill-link.active {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(120deg, var(--accent), #188f7a);
}


/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: 24px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-md);
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
}

.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { border-color: var(--border); color: var(--text); background: transparent; }
.btn.small { padding: 6px 12px; font-size: var(--font-sm-plus); }

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:disabled,
.btn.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Main */
main {
  padding: 20px 0 80px;
  min-height: calc(100vh - 140px); /* предотвращаем прыжки при загрузке */
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.9rem;
  min-height: 24px;
}

.crumb { color: var(--muted); }
.crumb::after { content: "›"; margin-left: 8px; }
.crumb.current { color: var(--text); font-weight: 600; }
.crumb.current::after { display: none; }

/* Cards & Panels */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm-plus);
}

.data-table th, .data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--card);
  font-weight: 600;
  font-size: var(--font-xs-plus);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr:hover { background: var(--theme-table-hover, rgba(47, 143, 99, 0.04)); cursor: pointer; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--font-sm);
  font-weight: 600;
}

/* Статусы используют CSS-переменные из themes.css для синхронизации с pipeline arrows */
.badge.draft { background: color-mix(in srgb, var(--status-draft, #6b7280) 15%, transparent); color: var(--status-draft, #6b7280); }
.badge.new { background: color-mix(in srgb, var(--status-new, #3b82f6) 15%, transparent); color: var(--status-new, #3b82f6); }
.badge.auction { background: color-mix(in srgb, var(--status-auction, #3b82f6) 15%, transparent); color: var(--status-auction, #3b82f6); }
.badge.selecting,
.badge.carrier_selected { background: color-mix(in srgb, var(--status-carrier-selected, #ef4444) 15%, transparent); color: var(--status-carrier-selected, #ef4444); }
.badge.vehicle,
.badge.assigned { background: color-mix(in srgb, var(--status-assigned, #3b82f6) 15%, transparent); color: var(--status-assigned, #3b82f6); }
.badge.loading,
.badge.en_route_loading { background: color-mix(in srgb, var(--status-loading, #f59e0b) 15%, transparent); color: var(--status-loading, #f59e0b); }
.badge.in_transit,
.badge.en_route_unloading { background: color-mix(in srgb, var(--status-in-transit, #8b5cf6) 15%, transparent); color: var(--status-in-transit, #8b5cf6); }
.badge.unloading { background: color-mix(in srgb, var(--status-unloading, #f59e0b) 15%, transparent); color: var(--status-unloading, #f59e0b); }
.badge.completed,
.badge.delivered { background: color-mix(in srgb, var(--status-delivered, #10b981) 15%, transparent); color: var(--status-delivered, #10b981); }
.badge.canceled,
.badge.cancelled { background: color-mix(in srgb, var(--status-cancelled, #6b7280) 15%, transparent); color: var(--status-cancelled, #6b7280); }
.badge.failed { background: color-mix(in srgb, var(--status-issue, #dc2626) 15%, transparent); color: var(--status-issue, #dc2626); }
.badge.pending { background: color-mix(in srgb, var(--status-pending, #6b7280) 15%, transparent); color: var(--status-pending, #6b7280); }
.badge.active { background: color-mix(in srgb, var(--status-active, #fbbf24) 15%, transparent); color: var(--status-active, #fbbf24); }

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: var(--font-sm-plus);
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 143, 99, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.choice-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.choice-card {
  flex: 1;
  min-width: 200px;
  padding: 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.choice-card:hover {
  transform: translateY(-1px);
}

.choice-card input {
  display: none;
}

.choice-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(47, 143, 99, 0.12);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-card__label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.stat-card__change {
  font-size: 0.85rem;
  margin-top: 8px;
}

.stat-card__change.up { color: var(--accent); }
.stat-card__change.down { color: var(--danger); }

/* Flow-oriented Stat Cards */
.stat-cards-flow {
  display: flex;
  gap: 4px;
  align-items: center;
  overflow-x: auto;
  padding: 12px 0;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.stat-cards-flow::-webkit-scrollbar {
  height: 4px;
}

.stat-cards-flow::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.stat-cards-flow .stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  min-width: 80px;
  transition: all 0.15s ease;
  text-decoration: none;
  flex-shrink: 0;
}

.stat-cards-flow .stat-card:hover:not(.active) {
  border-color: var(--accent);
  background: #fff;
}

.stat-cards-flow .stat-card.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(47, 143, 99, 0.25);
}

.stat-cards-flow .stat-card__count {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.stat-cards-flow .stat-card.active .stat-card__count {
  color: #fff;
}

.stat-cards-flow .stat-card__label {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-cards-flow .stat-card.active .stat-card__label {
  color: rgba(255, 255, 255, 0.85);
}

.stat-cards-flow .flow-arrow {
  color: var(--border);
  font-size: 14px;
  flex-shrink: 0;
  padding: 0 2px;
}

/* Mobile: центрирование активной карточки */
@media (max-width: 768px) {
  .stat-cards-flow {
    gap: 2px;
    padding: 8px 0;
  }

  .stat-cards-flow .stat-card {
    padding: 10px 12px;
    min-width: 70px;
  }

  .stat-cards-flow .stat-card__count {
    font-size: 1.25rem;
  }

  .stat-cards-flow .stat-card__label {
    font-size: 0.65rem;
  }
}

/* Pipeline Stepper - компактная альтернатива stat-cards без горизонтального скролла */
.pipeline-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 8px 0;
  margin-bottom: 12px;
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
  min-width: 42px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.pipeline-stage:hover {
  color: var(--accent);
}

.pipeline-stage.active {
  color: var(--accent);
}

.pipeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  transition: all 0.15s ease;
}

.pipeline-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

/* Цвета точек по статусам */
.pipeline-dot.filled.dot-gray { background: #6b7280; border-color: #6b7280; }
.pipeline-dot.filled.dot-green { background: #10b981; border-color: #10b981; }
.pipeline-dot.filled.dot-blue { background: #3b82f6; border-color: #3b82f6; }
.pipeline-dot.filled.dot-orange { background: #f59e0b; border-color: #f59e0b; }
.pipeline-dot.filled.dot-red { background: #ef4444; border-color: #ef4444; }
.pipeline-dot.filled.dot-purple { background: #8b5cf6; border-color: #8b5cf6; }

/* Hover и active с учётом цветов */
.pipeline-stage:hover .pipeline-dot.dot-gray { border-color: #4b5563; }
.pipeline-stage:hover .pipeline-dot.dot-green { border-color: #059669; }
.pipeline-stage:hover .pipeline-dot.dot-blue { border-color: #2563eb; }
.pipeline-stage:hover .pipeline-dot.dot-orange { border-color: #d97706; }
.pipeline-stage:hover .pipeline-dot.dot-red { border-color: #dc2626; }
.pipeline-stage:hover .pipeline-dot.dot-purple { border-color: #7c3aed; }

.pipeline-stage.active .pipeline-dot {
  box-shadow: 0 0 0 3px rgba(47, 143, 99, 0.2);
}
.pipeline-stage.active .pipeline-dot.dot-gray { box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.2); }
.pipeline-stage.active .pipeline-dot.dot-green { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.pipeline-stage.active .pipeline-dot.dot-blue { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
.pipeline-stage.active .pipeline-dot.dot-orange { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.pipeline-stage.active .pipeline-dot.dot-red { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
.pipeline-stage.active .pipeline-dot.dot-purple { box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2); }

/* Размеры точек для bottleneck visualization */
.pipeline-dot--sm { width: 12px; height: 12px; }
.pipeline-dot--md { width: 14px; height: 14px; }
.pipeline-dot--lg { width: 18px; height: 18px; }

.pipeline-count {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1;
}

.pipeline-label {
  font-size: 0.6rem;
  white-space: nowrap;
  margin-top: 1px;
  text-transform: none;
  letter-spacing: 0;
}

.pipeline-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-top: 4px;
  min-width: 12px;
}

.pipeline-sep {
  color: var(--border);
  font-weight: 300;
  margin: 0 4px;
  align-self: flex-start;
  margin-top: 2px;
}

/* Pipeline Stepper: Адаптивность */
@media (max-width: 768px) {
  .pipeline-stepper {
    justify-content: space-between;
    padding: 6px 0;
    margin-bottom: 8px;
  }
  .pipeline-stage {
    min-width: 36px;
  }
  .pipeline-label {
    font-size: 0.55rem;
  }
  .pipeline-line {
    min-width: 8px;
  }
  .pipeline-dot--sm { width: 10px; height: 10px; }
  .pipeline-dot--md { width: 12px; height: 12px; }
  .pipeline-dot--lg { width: 16px; height: 16px; }
}

@media (max-width: 480px) {
  .pipeline-stage {
    min-width: 28px;
  }
  .pipeline-label {
    font-size: 0.5rem;
  }
  .pipeline-line {
    min-width: 4px;
  }
  .pipeline-count {
    font-size: 0.65rem;
  }
}

/* ==========================================================================
   Pipeline Arrows - стрелки-шевроны для визуализации потока статусов
   ========================================================================== */

.pipeline-arrows {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 8px 0;
  margin-bottom: 12px;
  width: 100%;
}

.pipeline-arrow {
  --arrow-color: var(--accent);
  --arrow-bg: color-mix(in srgb, var(--arrow-color) 12%, transparent);
  --arrow-bg-hover: color-mix(in srgb, var(--arrow-color) 18%, transparent);
  --arrow-bg-active: color-mix(in srgb, var(--arrow-color) 25%, transparent);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 20px 6px 16px;
  flex: 1;
  min-width: 0;
  height: 44px;
  background: var(--arrow-bg);
  color: var(--arrow-color);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  margin-left: -10px;
  position: relative;
}

/* Первый элемент без левого угла */
.pipeline-arrow:first-child {
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
  margin-left: 0;
  padding-left: 12px;
  border-radius: 6px 0 0 6px;
}

/* Последний элемент с закруглением справа */
.pipeline-arrow:last-child {
  clip-path: polygon(0 0, calc(100% - 4px) 0, 100% 0, 100% 100%, calc(100% - 4px) 100%, 0 100%, 10px 50%);
  border-radius: 0 6px 6px 0;
  padding-right: 12px;
}

/* Если первый и последний одновременно */
.pipeline-arrow:first-child:last-child {
  clip-path: none;
  border-radius: 6px;
  padding: 6px 12px;
}

.pipeline-arrow:hover {
  background: var(--arrow-bg-hover);
}

.pipeline-arrow.active {
  background: var(--arrow-bg-active);
  font-weight: 600;
}

.pipeline-arrow.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--arrow-color);
  border-radius: 2px 2px 0 0;
}

.pipeline-arrow:first-child.active::after {
  left: 4px;
}

.pipeline-arrow__count {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.pipeline-arrow__label {
  font-size: 0.6rem;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Сепаратор между основным потоком и исключениями */
.pipeline-arrows .pipeline-sep {
  display: flex;
  align-items: center;
  padding: 0 4px;
  color: var(--border);
  font-size: 1.2rem;
  font-weight: 300;
  flex: 0 0 auto;
  margin-left: 0;
}

/* Элемент после сепаратора */
.pipeline-arrows .pipeline-sep + .pipeline-arrow {
  margin-left: 0;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
  border-radius: 6px 0 0 6px;
}

/* Цвета статусов через CSS-переменные */
.pipeline-arrow[data-status="all"] { --arrow-color: var(--status-all, var(--accent)); }
.pipeline-arrow[data-status="new"] { --arrow-color: var(--status-new, #3b82f6); }
.pipeline-arrow[data-status="draft"] { --arrow-color: var(--status-draft, #6b7280); }
.pipeline-arrow[data-status="auction"] { --arrow-color: var(--status-auction, #3b82f6); }
.pipeline-arrow[data-status="carrier_selected"] { --arrow-color: var(--status-carrier-selected, #ef4444); }
.pipeline-arrow[data-status="loading"] { --arrow-color: var(--status-loading, #f59e0b); }
.pipeline-arrow[data-status="in_transit"],
.pipeline-arrow[data-status="en_route_unloading"] { --arrow-color: var(--status-in-transit, #8b5cf6); }
.pipeline-arrow[data-status="unloading"] { --arrow-color: var(--status-unloading, #f59e0b); }
.pipeline-arrow[data-status="delivered"],
.pipeline-arrow[data-status="completed"] { --arrow-color: var(--status-delivered, #10b981); }
.pipeline-arrow[data-status="cancelled"] { --arrow-color: var(--status-cancelled, #6b7280); }
.pipeline-arrow[data-status="active"] { --arrow-color: var(--status-active, #fbbf24); }
.pipeline-arrow[data-status="with_offers"] { --arrow-color: var(--status-with-offers, var(--accent)); }
.pipeline-arrow[data-status="sent"] { --arrow-color: var(--status-sent, #3b82f6); }

/* Pipeline Arrows: Адаптивность */
@media (max-width: 768px) {
  .pipeline-arrows {
    padding: 6px 0;
    margin-bottom: 8px;
  }
  .pipeline-arrow {
    height: 40px;
    padding: 4px 12px 4px 10px;
  }
  .pipeline-arrow__count {
    font-size: 0.85rem;
  }
  .pipeline-arrow__label {
    font-size: 0.5rem;
  }
}

@media (max-width: 480px) {
  .pipeline-arrows {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .pipeline-arrow {
    height: 36px;
    padding: 3px 10px 3px 8px;
    flex: 0 0 auto;
    min-width: 60px;
  }
  .pipeline-arrow__count {
    font-size: 0.75rem;
  }
  .pipeline-arrow__label {
    font-size: 0.45rem;
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state__icon { font-size: 4rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state__title { font-size: 1.2rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state__text { margin-bottom: 20px; }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline-item__time { color: var(--muted); font-size: 0.85rem; }
.timeline-item__title { font-weight: 600; }
.timeline-item__desc { color: var(--muted); font-size: 0.9rem; }

/* Production schedule */
.schedule-axis {
  position: relative;
  height: 28px;
  margin-bottom: 16px;
}

.schedule-axis-marker {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.schedule-chart { display: flex; flex-direction: column; gap: 10px; }

.schedule-row {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 14px;
  align-items: center;
}

.schedule-label-title { font-weight: 600; }
.schedule-label-meta { color: var(--muted); font-size: 0.85rem; }

.schedule-track {
  position: relative;
  height: 18px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  overflow: hidden;
}

.schedule-bar {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 10px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.plan-actions { align-items: center; gap: 12px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  background: none;
  border: none;
  padding: 12px 20px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
  font: inherit;
  appearance: none;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* List */
.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: none; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

/* Auth page */
body.auth-page { min-height: 100vh; }

body.auth-page .site-header,
body.auth-page .mobile-nav { display: none; }

body.auth-page main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
}

body.auth-page main > .container { display: none; }

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
  width: min(420px, 92vw);
}

.auth-card__header { text-align: center; margin-bottom: 24px; }
.auth-card__header h1 { margin: 8px 0; font-size: 1.6rem; }

/* Notifications */
.notification-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.notification-item:hover { background: var(--theme-table-hover, rgba(47, 143, 99, 0.04)); }
.notification-item.unread {
  background: var(--theme-primary-light, rgba(47, 143, 99, 0.08));
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.notification-item__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.notification-item__icon.info { background: #e0f2fe; }
.notification-item__icon.success { background: #d1fae5; }
.notification-item__icon.warning { background: #fef3c7; }
.notification-item__icon.danger { background: #fee2e2; }
/* Module type colors */
.notification-item__icon.application { background: #dbeafe; }
.notification-item__icon.quote { background: #e0e7ff; }
.notification-item__icon.auction { background: #fef3c7; }
.notification-item__icon.trip { background: #d1fae5; }
.notification-item__icon.system { background: #f3f4f6; }

.notification-item__content { display: block; }
.notification-mark-read {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  align-self: center;
  flex-shrink: 0;
}
.notification-mark-read:hover {
  background: var(--accent);
  color: #fff;
}

/* Chart placeholder */
.chart-placeholder {
  height: 300px;
  background: var(--card);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--muted);
}

/* Muted text */
.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--accent); }

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

/* Margin/Padding utilities */
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* Section title */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 24px 0 16px;
  color: var(--text);
}

/* Status indicator */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.active { background: var(--accent); }
.status-dot.inactive { background: var(--muted); }
.status-dot.warning { background: var(--warning); }
.status-dot.danger { background: var(--danger); }

/* Mobile nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 8px 0;
  z-index: 100;
}

@media (max-width: 768px) {
  .mobile-nav { display: block; }
  main { padding-bottom: 100px; }
}

.mobile-nav__inner {
  display: flex;
  justify-content: space-around;
}

.mobile-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.mobile-link .icon { width: 24px; height: 24px; }
.mobile-link.active { color: var(--accent); }

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

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--bg);
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

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

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

.toggle input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(47, 143, 99, 0.2);
}

.toggle input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Extra status fallback */
.badge.warning { background: #fef3c7; color: #b45309; }

/* Wizard */
.wizard-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 32px;
  position: relative;
}

.wizard-steps::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  cursor: pointer;
}

.wizard-step__number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.3s ease;
}

.wizard-step.active .wizard-step__number,
.wizard-step.completed .wizard-step__number {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.wizard-step__label {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.wizard-step.active .wizard-step__label {
  color: var(--text);
  font-weight: 600;
}

.wizard-step.completed .wizard-step__label {
  color: var(--accent);
}

.step-content {
  display: none;
}

.step-content.active {
  display: block;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Overlays and menus */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-width: 180px;
  padding: 8px 0;
  display: none;
  z-index: 20;
}

.dropdown-menu a {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  font-weight: 600;
}

.dropdown-menu a:hover {
  background: var(--theme-table-hover, rgba(47, 143, 99, 0.08));
  color: var(--accent);
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu,
.dropdown.open .dropdown-menu {
  display: block;
}

.search-toggle { font-size: 1rem; }

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 12px;
}

.search-overlay.open { display: flex; }

.search-box {
  background: var(--card);
  border-radius: 16px;
  width: min(600px, 90vw);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: spotlightIn 0.2s ease;
}

@keyframes spotlightIn {
  from { transform: translateY(-20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.search-box input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
  outline: none;
}

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

#search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

#search-results:empty {
  padding: 0;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}

.search-result:hover,
.search-result.selected {
  background: var(--card);
}

.search-result.selected {
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid var(--accent);
}

.search-result__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: var(--card);
  border-radius: 10px;
  flex-shrink: 0;
}

.search-result__content {
  flex: 1;
  min-width: 0;
}

.search-result__title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result__subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result__type {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--card);
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.search-empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
}

.search-loading {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 70px; /* Ниже хедера (60px + 10px отступ) */
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast.success { border-left: 4px solid var(--accent); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid #3b82f6; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

@keyframes slideOut {
  to { transform: translateX(100%); opacity: 0; }
}

/* Generic Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 60, 58, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s ease;
}

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

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

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s ease;
}

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

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

.modal-body p {
  margin: 0 0 16px;
  color: var(--muted);
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

@media (max-width: 540px) {
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }
  .modal {
    max-width: none;
    max-height: 85vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

/* Confirm modal */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.confirm-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.confirm-modal {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

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

.confirm-modal__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.confirm-modal__message {
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-modal__actions .btn { min-width: 100px; }

/* Form validation */
input.invalid,
select.invalid,
textarea.invalid {
  border-color: var(--danger);
  background-color: rgba(231, 76, 60, 0.05);
}

@media (max-width: 768px) {
  .toast-container {
    top: auto;
    bottom: 100px;
    right: 10px;
    left: 10px;
  }
  .toast { max-width: 100%; }
}

/* ========================================
   Smart Filters with Counters
   ======================================== */
.smart-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tab {
  --tab-color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.filter-tab:hover {
  border-color: var(--tab-color);
  background: var(--theme-primary-light, rgba(47, 143, 99, 0.05));
  color: var(--text);
}

.filter-tab.active {
  background: var(--tab-color);
  border-color: var(--tab-color);
  color: #fff;
}

.filter-tab__label {
  font-weight: 500;
}

.filter-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.filter-tab:not(.active) .filter-tab__count {
  background: var(--card);
  color: var(--tab-color);
}

/* ========================================
   Global Spotlight Search
   ======================================== */
.search-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
}

.search-trigger:hover {
  background: var(--card);
  color: var(--accent);
}

.search-trigger svg {
  width: 20px;
  height: 20px;
}

.spotlight-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  animation: fadeIn 0.15s ease;
}

.spotlight-overlay.open {
  display: flex;
}

.spotlight-container {
  width: min(600px, 90vw);
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.spotlight-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.spotlight-input-wrap svg {
  width: 24px;
  height: 24px;
  color: var(--muted);
  flex-shrink: 0;
}

.spotlight-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.1rem;
  background: transparent;
  color: var(--text);
}

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

.spotlight-kbd {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.spotlight-kbd kbd {
  padding: 2px 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.75rem;
}

.spotlight-results {
  max-height: 400px;
  overflow-y: auto;
}

.spotlight-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.spotlight-section {
  padding: 8px 0;
}

.spotlight-section__title {
  padding: 8px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.spotlight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.spotlight-item:hover,
.spotlight-item.selected {
  background: var(--card);
}

.spotlight-item__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 1rem;
  flex-shrink: 0;
}

.spotlight-item__icon.trip { background: #f59e0b; }
.spotlight-item__icon.company { background: #3b82f6; }
.spotlight-item__icon.driver { background: #8b5cf6; }
.spotlight-item__icon.vehicle { background: #ec4899; }
.spotlight-item__icon.quote { background: #10b981; }

.spotlight-item__content {
  flex: 1;
  min-width: 0;
}

.spotlight-item__title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotlight-item__subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotlight-item__badge {
  padding: 2px 8px;
  background: var(--card);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.spotlight-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--card);
  font-size: 0.8rem;
  color: var(--muted);
}

.spotlight-footer kbd {
  padding: 2px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  margin: 0 2px;
}

@media (max-width: 640px) {
  .spotlight-overlay {
    padding-top: 0;
    align-items: stretch;
  }
  .spotlight-container {
    width: 100%;
    border-radius: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .spotlight-results {
    flex: 1;
    max-height: none;
  }
}

/* =============================================================================
   COMMAND MENU (Grid Modal - No Scroll)
   ============================================================================= */

.command-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.command-menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

.command-menu {
  width: 100%;
  max-width: 480px;
  background: var(--bg);
  border-radius: 20px;
  box-shadow: 0 25px 80px -12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.command-menu-overlay.open .command-menu {
  transform: scale(1);
}

/* Search input - ACCENTED */
.command-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2, var(--accent)));
  border-bottom: none;
}

.command-search svg {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.8);
}

.command-search input {
  flex: 1;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  font-size: 1rem;
  font-family: inherit;
  color: #fff;
  outline: none;
  padding: 12px 16px;
  border-radius: 12px;
  transition: background 0.15s ease;
}

.command-search input:focus {
  background: rgba(255, 255, 255, 0.3);
}

.command-search input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.command-hint {
  padding: 6px 10px;
  font-size: 0.75rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
}

/* Content - NO SCROLL */
.command-content {
  padding: 20px;
  overflow: visible;
}

/* Section */
.command-section {
  padding: 0;
  margin-bottom: 16px;
}

.command-section:last-child {
  margin-bottom: 0;
}

.command-section[hidden] {
  display: none;
}

.command-section-title {
  padding: 0 0 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Items - GRID of square buttons */
.command-items {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.command-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 1;
  padding: 12px 8px;
  border: 1px solid var(--border);
  background: var(--card);
  font: inherit;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border-radius: 16px;
  width: auto;
}

.command-item:hover,
.command-item.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.02);
}

.command-item:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  outline: none;
}

.command-item[hidden] {
  display: none;
}

.command-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 12px;
  flex-shrink: 0;
  color: var(--muted);
  transition: all 0.15s ease;
}

.command-item:hover .command-icon,
.command-item.selected .command-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.command-label {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Hide kbd in grid view - too cluttered */
.command-item kbd {
  display: none;
}

/* Footer - compact */
.command-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.command-footer-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.command-footer-hint kbd {
  padding: 3px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.7rem;
}

/* Mobile: 3 columns, full screen */
@media (max-width: 640px) {
  .command-menu-overlay {
    padding: 16px;
  }
  .command-menu {
    max-width: none;
    border-radius: 20px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
  .command-items {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .command-item {
    padding: 10px 6px;
    border-radius: 14px;
  }
  .command-icon {
    width: 36px;
    height: 36px;
  }
  .command-label {
    font-size: 0.7rem;
  }
  .command-search input {
    padding: 10px 14px;
  }
}

/* =============================================================================
   PROFILE MODAL (Centered Grid - iOS Power-off Style)
   ============================================================================= */

.profile-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.profile-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.profile-modal {
  width: 100%;
  max-width: 360px;
  background: var(--bg);
  border-radius: 24px;
  box-shadow: 0 25px 80px -12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

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

/* Header - Centered avatar */
.profile-modal__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 24px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2, var(--accent)));
  position: relative;
}

.profile-modal__avatar {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
  font-size: 1.4rem;
  border-radius: 50%;
  flex-shrink: 0;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.profile-modal__info {
  text-align: center;
  color: #fff;
}

.profile-modal__name {
  font-weight: 600;
  font-size: 1.1rem;
  color: #fff;
}

.profile-modal__email {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 2px;
}

.profile-modal__company {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
}

.profile-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.9);
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.profile-modal__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Content - Grid layout */
.profile-modal__content {
  padding: 20px;
  overflow: visible;
}

.profile-modal__section {
  padding: 0;
  margin-bottom: 16px;
}

.profile-modal__section:last-child {
  margin-bottom: 0;
}

.profile-modal__section-title {
  padding: 0 0 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.profile-modal__divider {
  display: none;
}

/* Grid items */
.profile-modal__section .profile-modal__item {
  display: inline-flex;
}

.profile-modal__section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.profile-modal__section-title {
  grid-column: 1 / -1;
}

.profile-modal__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 1;
  padding: 12px 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  border-radius: 16px;
  transition: all 0.15s ease;
}

.profile-modal__item:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.02);
}

.profile-modal__item--admin {
  color: var(--muted);
}

.profile-modal__item--admin:hover {
  color: #fff;
}

.profile-modal__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 10px;
  flex-shrink: 0;
  color: var(--muted);
  transition: all 0.15s ease;
}

.profile-modal__item:hover .profile-modal__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.profile-modal__label {
  font-size: 0.65rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.profile-modal__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--danger);
  color: #fff;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Make items with badge relative */
.profile-modal__item:has(.profile-modal__badge) {
  position: relative;
}

/* Footer - Logout button prominent */
.profile-modal__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.profile-modal__logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  border: none;
  background: rgba(225, 82, 82, 0.1);
  color: var(--danger);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 14px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.profile-modal__logout:hover {
  background: var(--danger);
  color: #fff;
}

/* Mobile */
@media (max-width: 640px) {
  .profile-modal-overlay {
    padding: 16px;
  }
  .profile-modal {
    max-width: none;
    border-radius: 24px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
  .profile-modal__avatar {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }
  .profile-modal__section {
    gap: 8px;
  }
  .profile-modal__item {
    padding: 10px 6px;
    border-radius: 14px;
  }
  .profile-modal__icon {
    width: 32px;
    height: 32px;
  }
  .profile-modal__label {
    font-size: 0.6rem;
  }
}

/* =============================================================================
   Mass Actions - массовые действия над элементами списка
   ============================================================================= */

/* Чекбокс в строке таблицы/карточке */
.row-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent, #3b82f6);
}

.row-checkbox:focus {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 2px;
}

/* Контейнер mass actions в footer */
.mass-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.2s ease;
}

.mass-actions__count {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--accent, #3b82f6);
  color: #fff;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

.mass-actions__count strong {
  font-weight: 700;
}

.mass-actions__buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Выделение выбранной строки */
tr.selected,
.card.selected,
.list-item.selected {
  background: color-mix(in srgb, var(--accent, #3b82f6) 8%, transparent) !important;
}

tr.selected td:first-child,
.card.selected .row-checkbox,
.list-item.selected .row-checkbox {
  position: relative;
}

tr.selected td:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent, #3b82f6);
}

/* Кнопка "Выбрать все" в header таблицы */
.select-all-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent, #3b82f6);
}

/* Dropdown для mass actions (статус, экспорт и т.п.) */
.mass-dropdown {
  position: relative;
  display: inline-block;
}

.mass-dropdown__trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.mass-dropdown__trigger:hover {
  border-color: var(--accent, #3b82f6);
  background: var(--bg, #f9fafb);
}

.mass-dropdown__trigger svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  transition: transform 0.15s;
}

.mass-dropdown.open .mass-dropdown__trigger svg {
  transform: rotate(180deg);
}

.mass-dropdown__menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 160px;
  margin-top: 4px;
  padding: 6px 0;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.mass-dropdown.open .mass-dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mass-dropdown__item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text, #1f2937);
  text-align: left;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.1s;
}

.mass-dropdown__item:hover {
  background: var(--bg, #f9fafb);
}

.mass-dropdown__item.danger {
  color: #dc2626;
}

.mass-dropdown__item.danger:hover {
  background: #fef2f2;
}

.mass-dropdown__divider {
  height: 1px;
  margin: 6px 0;
  background: var(--border, #e5e7eb);
}

/* Анимация появления */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile: mass actions в footer stack вертикально */
@media (max-width: 640px) {
  .mass-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .mass-actions__buttons {
    width: 100%;
    justify-content: flex-end;
  }

  .mass-dropdown__menu {
    right: 0;
    left: auto;
  }
}

/* ==========================================
   Two-Level Flow Navigation
   ========================================== */
.flow-navigation-two-level {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
}

/* Верхний уровень: сквозной путь */
.flow-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.flow-top .flow-stage {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.flow-top .flow-stage.done { color: var(--accent); }
.flow-top .flow-stage.current { color: var(--accent); font-weight: 700; }
.flow-top .flow-stage.future { color: var(--muted); }

.flow-top a.flow-stage:hover {
  text-decoration: underline;
}

.flow-top .flow-arrow {
  color: var(--border);
  font-size: 0.9rem;
}

/* Нижний уровень: детальный flow */
.flow-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.flow-step {
  white-space: nowrap;
}

.flow-step.done { color: var(--muted); }
.flow-step.current { color: var(--accent); font-weight: 600; }
.flow-step.future { color: var(--muted); opacity: 0.6; }

.flow-bottom .flow-sep {
  color: var(--border);
  font-size: 0.8rem;
}

/* Адаптивность */
@media (max-width: 768px) {
  .flow-top {
    padding: 10px 12px;
    gap: 6px;
  }

  .flow-top .flow-stage {
    font-size: 0.8rem;
  }

  .flow-bottom {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .flow-top .flow-stage .flow-label {
    display: none;
  }

  .flow-top .flow-stage .flow-icon {
    font-size: 1rem;
  }
}

/* ===== UI Tabs Filter ===== */
.ui-tabs-filter {
  display: flex;
  gap: 4px;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--border, #d9e4df);
  margin-bottom: 16px;
}

.ui-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: var(--font-sm, 0.8rem);
  font-weight: 500;
  color: var(--muted, #5d756f);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.ui-tab:hover {
  color: var(--text, #0c3c3a);
  background: var(--card, #f4f8f6);
}

.ui-tab.is-active {
  color: var(--accent, #2f8f63);
  background: rgba(47, 143, 99, 0.1);
  border-color: rgba(47, 143, 99, 0.2);
}

.ui-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: var(--font-xxs, 0.65rem);
  font-weight: 600;
  color: #fff;
  background: var(--warning, #f59e0b);
  border-radius: 9px;
}

.ui-tab.is-active .ui-tab-badge {
  background: var(--accent, #2f8f63);
}
