/* ============================================================
   ALPSSTROY Platform (Exchange) Design System v1.0
   ============================================================
   Технологии: чистый CSS. Bootstrap НЕ используется.
   Айдентика: тёмная премиум-тема + золото как ЕДИНСТВЕННЫЙ
   фирменный акцент. Mobile-first.
   ============================================================ */

/* ═════════════════════════════════════════════════════════════
   §2  ТОКЕНЫ
   ═════════════════════════════════════════════════════════════ */

:root {
  /* ── Бренд (единственный акцент) ── */
  --gold:            #dcb163;
  --gold-2:          #b88a38;
  --gold-grad:       linear-gradient(135deg, #dcb163, #b88a38);
  --gold-glow:       rgba(220,177,99,.18);
  --gold-border:     rgba(220,177,99,.15);
  --gold-light:      rgba(220,177,99,.08);

  /* ── Фоны (тёмная премиум-шкала) ── */
  --bg-0:            #0b0a09;   /* корпус страницы */
  --bg-1:            #131210;   /* секции */
  --bg-card:         #17161a;   /* карточки (НЕПРОЗРАЧНЫЕ) */
  --bg-card-2:       #1d1c22;   /* вложенные блоки */
  --bg-elevated:     #232228;   /* поповеры, дропдауны */

  /* ── Текст (высокий контраст) ── */
  --text-primary:    #f2efe9;   /* заголовки, важное */
  --text-body:       #d7d3cb;   /* основной текст */
  --text-secondary:  rgba(255,255,255,.66);
  --text-muted:      rgba(255,255,255,.45);

  /* ── Линии ── */
  --border:          rgba(255,255,255,.09);
  --border-strong:   rgba(255,255,255,.16);

  /* ── Семантика (сдержанная) ── */
  --success:         #4caf50;   --success-bg:  rgba(76,175,80,.14);
  --danger:          #ef5350;   --danger-bg:   rgba(239,83,80,.14);
  --info:            #5b9bd5;   --info-bg:     rgba(91,155,213,.14);
  --warning:         #e0a23c;   --warning-bg:  rgba(224,162,60,.14);

  /* ── Отступы (других значений не вводить) ── */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ── Радиусы / тени ── */
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  --shadow-gold: 0 4px 20px var(--gold-glow);

  /* ── Типографика (≤6 кеглей) ── */
  --fs-display: 40px;
  --fs-h1:      30px;
  --fs-h2:      22px;
  --fs-body:    16px;
  --fs-sm:      14px;
  --fs-xs:      12px;
  --lh-tight:   1.2;
  --lh-body:    1.55;

  /* ── Высота контролов ── */
  --control-height: 44px;
}

@media (min-width: 769px) {
  :root { --control-height: 42px; }
}

/* ── Светлая тема ── */
[data-theme="light"] {
  --bg-0:           #f5f5f0;
  --bg-1:           #eaeae5;
  --bg-card:        #fff;
  --bg-card-2:      #f0f0ea;
  --bg-elevated:    #e8e8e2;
  --text-primary:   #1a1a1a;
  --text-body:      #333;
  --text-secondary: rgba(0,0,0,.66);
  --text-muted:     rgba(0,0,0,.45);
  --border:         rgba(0,0,0,.09);
  --border-strong:  rgba(0,0,0,.16);
  --gold:           #c49a3b;
  --gold-2:         #a07d2a;
  --gold-glow:      rgba(196,154,59,.18);
  --gold-border:    rgba(196,154,59,.15);
  --gold-light:     rgba(196,154,59,.08);
}

/* ═════════════════════════════════════════════════════════════
   СБРОС (мини)
   ═════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

/* ═════════════════════════════════════════════════════════════
   §3  БАЗОВЫЕ КЛАССЫ — Layout
   ═════════════════════════════════════════════════════════════ */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container-narrow {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.row > * { flex: 1 1 0; min-width: 0; }

.col-1  { flex: 0 0 8.333%;  max-width: 8.333%; }
.col-2  { flex: 0 0 16.666%; max-width: 16.666%; }
.col-3  { flex: 0 0 25%;     max-width: 25%; }
.col-4  { flex: 0 0 33.333%; max-width: 33.333%; }
.col-6  { flex: 0 0 50%;     max-width: 50%; }
.col-12 { flex: 0 0 100%;    max-width: 100%; }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

/* ═════════════════════════════════════════════════════════════
   §3  БАЗОВЫЕ КЛАССЫ — Поля / Формы
   ═════════════════════════════════════════════════════════════ */

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.field-group + .field-group { margin-top: var(--space-4); }

.field {
  position: relative;
  display: block;
}
.field > i,
.field > .input-suffix,
.field > .field-action {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .75rem;
  pointer-events: none;
}
.field > .field-action { pointer-events: auto; }
.field > span:first-child {
  left: var(--space-3);
  right: auto;
  color: var(--text-secondary);
  font-size: .85rem;
}
.field:has(> span:first-child) .form-input { padding-left: var(--space-10); }

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

.form-input,
select.form-input,
.input-date {
  width: 100%;
  height: var(--control-height);
  padding: 0 var(--space-3);
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-sm);
  outline: none;
  caret-color: var(--gold);
  transition: border-color .2s, background .2s, box-shadow .2s;
  appearance: none;
}

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

.form-input:focus,
select.form-input:focus,
.input-date:focus {
  border-color: rgba(220,177,99,.42);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(220,177,99,.07);
}

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

/* Поле с иконкой/суффиксом справа */
.field .form-input { padding-right: var(--space-10); }

/* Стрелка селекта */
select.form-input {
  padding-right: var(--space-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23dcb163' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  cursor: pointer;
}

[data-theme="light"] select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23c49a3b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
}

/* ═════════════════════════════════════════════════════════════
   §3  БАЗОВЫЕ КЛАССЫ — Кнопки
   ═════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-height);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold-grad);
  color: #111;
  border-color: transparent;
  box-shadow: var(--shadow-gold);
}
.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}

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

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: rgba(239,83,80,.25);
}
.btn-danger-ghost:hover {
  background: var(--danger-bg);
}

.btn-sm { height: 32px; padding: 0 var(--space-3); font-size: 12px; }
.btn-lg { height: 48px; padding: 0 var(--space-6); font-size: 14px; }

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Card
   ═════════════════════════════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: transform .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.3);
}

@media (prefers-reduced-motion: reduce) {
  .card:hover { transform: none; }
}

/* Card-stat — метрика равной высоты */
.card-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  transition: transform .2s ease, box-shadow .2s ease;
}

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

.card-stat .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: var(--fs-body);
  margin-bottom: var(--space-2);
}

.card-stat .stat-value {
  font-size: var(--fs-h1);
  font-weight: 700;
  color: var(--text-primary);
  line-height: var(--lh-tight);
}

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

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Badge
   ═════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-gold    { background: var(--gold-light); color: var(--gold); }

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Avatar (§7)
   ═════════════════════════════════════════════════════════════ */

.avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--gold-grad);
  color: #111;
  font-weight: 600;
}

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

.avatar-sm  { width: 32px;  height: 32px;  font-size: var(--fs-xs); }
.avatar-md  { width: 48px;  height: 48px;  font-size: var(--fs-sm); }
.avatar-lg  { width: 64px;  height: 64px;  font-size: var(--fs-body); }
.avatar-xl  { width: 96px;  height: 96px;  font-size: var(--fs-h2); }
.avatar-2xl { width: 128px; height: 128px; font-size: var(--fs-h1); }

/* Бейджи на аватаре — абсолютные дочерние без наложения */
.avatar .avatar-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg-card);
  background: var(--success);
}

.avatar .avatar-role {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
  background: var(--gold-grad);
  color: #111;
  border: 2px solid var(--bg-card);
}

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Rating
   ═════════════════════════════════════════════════════════════ */

.rating-stars {
  display: inline-flex;
  gap: 2px;
  color: var(--gold);
  font-size: var(--fs-sm);
}

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

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

.rating-bar .bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-card-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.rating-bar .bar-fill {
  height: 100%;
  background: var(--gold-grad);
  border-radius: var(--radius-pill);
  transition: width .4s ease;
}

.rating-bar .bar-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

.rating-bar .bar-percent {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
}

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Timeline (адаптивный, §7)
   ═════════════════════════════════════════════════════════════ */

.timeline {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.timeline-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  top: 14px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.timeline-item:first-child::before { display: none; }

.timeline-dot {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  z-index: 1;
  background: var(--bg-card-2);
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all .3s ease;
}

.timeline-item.done .timeline-dot {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.timeline-item.active .timeline-dot {
  background: var(--gold-light);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

.timeline-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  max-width: 100px;
}

.timeline-item.active .timeline-label {
  color: var(--gold);
  font-weight: 600;
}

/* Мобильный: вертикальный */
@media (max-width: 768px) {
  .timeline {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }
  .timeline-item {
    flex-direction: row;
    text-align: left;
    width: 100%;
  }
  .timeline-item::before {
    top: -50%;
    left: 14px;
    width: 2px;
    height: 100%;
  }
  .timeline-item:first-child::before { display: none; }
  .timeline-label { max-width: none; }
}

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Stepper
   ═════════════════════════════════════════════════════════════ */

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

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

.step-number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  background: var(--bg-card-2);
  border: 2px solid var(--border);
  color: var(--text-muted);
}

.step.active .step-number {
  background: var(--gold-light);
  border-color: var(--gold);
  color: var(--gold);
}

.step.done .step-number {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.step-label {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

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

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  max-width: 40px;
}

.step.done + .step-connector {
  background: var(--success);
}

@media (max-width: 768px) {
  .stepper {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .step-connector {
    width: 2px;
    height: 20px;
    max-width: none;
  }
}

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Tabs
   ═════════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: color .2s, border-color .2s;
}

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

.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Empty state / Error state
   ═════════════════════════════════════════════════════════════ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-5);
  text-align: center;
}

.empty-state .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-pill);
  background: var(--bg-card-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--fs-h2);
}

.empty-state .empty-title {
  font-size: var(--fs-h2);
  font-weight: 600;
  color: var(--text-primary);
}

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

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Toggle (§7)
   ═════════════════════════════════════════════════════════════ */

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.toggle input { display: none; }

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background .2s, border-color .2s;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: var(--radius-pill);
  transition: transform .2s, background .2s;
}

.toggle input:checked + .toggle-track {
  background: var(--success-bg);
  border-color: var(--success);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
  background: var(--success);
}

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

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Tier card (тарифы)
   ═════════════════════════════════════════════════════════════ */

.tier-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}

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

.tier-card.featured {
  border-color: var(--gold-border);
  box-shadow: 0 0 20px var(--gold-glow);
}

.tier-card .tier-name {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--text-primary);
}

.tier-card .tier-price {
  font-size: var(--fs-h1);
  font-weight: 800;
  color: var(--gold);
}

.tier-card .tier-price span {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--text-muted);
}

.tier-card .tier-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tier-card .tier-features li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.tier-card .tier-features li i {
  color: var(--success);
  font-size: var(--fs-xs);
}

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Breadcrumbs
   ═════════════════════════════════════════════════════════════ */

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .2s;
}

.breadcrumbs a:hover { color: var(--gold); }

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

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

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Banner
   ═════════════════════════════════════════════════════════════ */

.banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.banner .banner-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--bg-card-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: var(--fs-body);
  flex-shrink: 0;
}

.banner .banner-content {
  flex: 1;
}

.banner .banner-title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.banner .banner-text {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* ═════════════════════════════════════════════════════════════
   §3  КОМПОНЕНТЫ — Dropzone
   ═════════════════════════════════════════════════════════════ */

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-8);
  text-align: center;
  background: var(--bg-card-2);
  transition: border-color .2s, background .2s;
  cursor: pointer;
}

.dropzone:hover {
  border-color: var(--gold-border);
  background: var(--gold-light);
}

.dropzone .dropzone-icon {
  font-size: var(--fs-h1);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.dropzone .dropzone-text {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* ═════════════════════════════════════════════════════════════
   §4  ЖЁСТКИЕ ПРАВИЛА — Таблицы, оверфлоу, мобильный
   ═════════════════════════════════════════════════════════════ */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.table-wrap th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-strong);
  background: var(--bg-card-2);
}

.table-wrap td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  color: var(--text-body);
  border-bottom: 1px solid var(--border);
}

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

/* ═════════════════════════════════════════════════════════════
   §7  Фоновые фото — оверлей
   ═════════════════════════════════════════════════════════════ */

.bg-photo-overlay {
  position: relative;
}

.bg-photo-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(8,8,12,.92) 0%,
    rgba(10,10,16,.88) 50%,
    rgba(6,6,10,.94) 100%
  );
  z-index: 1;
}

.bg-photo-overlay > * {
  position: relative;
  z-index: 2;
}

[data-theme="light"] .bg-photo-overlay::before {
  background: linear-gradient(
    135deg,
    rgba(245,245,240,.95) 0%,
    rgba(250,250,245,.92) 50%,
    rgba(240,240,235,.95) 100%
  );
}

/* ═════════════════════════════════════════════════════════════
   §8  Микровзаимодействия
   ═════════════════════════════════════════════════════════════ */

/* Focus-ring для интерактивных элементов */
a:focus-visible,
button:focus-visible,
.form-input:focus-visible,
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220,177,99,.25);
}

/* Hover карточек */
.card,
.card-stat,
.tier-card {
  will-change: transform;
}

/* Сдержанные анимации появления */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeInUp .4s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ═════════════════════════════════════════════════════════════
   §9  Защита от broken-значений (CSS-layer)
   ═════════════════════════════════════════════════════════════ */

[data-value="[object Object]"],
[data-value="NaN"],
[data-value="Invalid Date"],
[data-value="undefined"],
[data-value="null"] {
  color: var(--danger) !important;
  font-style: italic;
}

[data-value="[object Object]"]::after,
[data-value="NaN"]::after,
[data-value="Invalid Date"]::after {
  content: '—';
  color: var(--text-muted);
  font-style: normal;
}

/* ═════════════════════════════════════════════════════════════
   Мобильные правки (mobile-first, десктоп через min-width)
   ═════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .row { flex-direction: column; }
  .col-1, .col-2, .col-3, .col-4, .col-6, .col-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .container,
  .container-narrow {
    padding: 0 var(--space-3);
  }

  :root {
    --fs-display: 28px;
    --fs-h1: 24px;
    --fs-h2: 18px;
  }
}

/* ═════════════════════════════════════════════════════════════
   УТИЛИТЫ (замена Bootstrap)
   ═════════════════════════════════════════════════════════════ */

.d-flex      { display: flex; }
.d-block     { display: block; }
.d-inline    { display: inline; }
.d-inline-block { display: inline-block; }
.d-none      { display: none; }
.d-grid      { display: grid; }

.justify-start   { justify-content: flex-start; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }

.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.items-center  { align-items: center; }
.items-stretch { align-items: stretch; }

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

.fw-bold      { font-weight: 700; }
.fw-semibold  { font-weight: 600; }
.fw-medium    { font-weight: 500; }
.fw-normal    { font-weight: 400; }

.text-muted     { color: var(--text-muted); }
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }
.text-danger    { color: var(--danger); }
.text-gold      { color: var(--gold); }

.ms-auto { margin-left: auto; }
.me-1    { margin-right: var(--space-2); }
.me-2    { margin-right: var(--space-3); }
.ms-1    { margin-left: var(--space-2); }
.ms-2    { margin-left: var(--space-3); }

.gap-1 { gap: var(--space-2); }
.gap-2 { gap: var(--space-3); }
.gap-3 { gap: var(--space-4); }
.gap-4 { gap: var(--space-5); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-2); }
.p-2 { padding: var(--space-3); }
.p-3 { padding: var(--space-4); }
.p-4 { padding: var(--space-5); }

.px-1 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-2 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-3 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-4 { padding-left: var(--space-5); padding-right: var(--space-5); }

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

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.position-relative { position: relative; }
.position-absolute { position: absolute; }
.overflow-hidden   { overflow: hidden; }
.overflow-auto     { overflow: auto; }

/* ═════════════════════════════════════════════════════════════
   PLATFORM FILTER COMPONENTS (orders, contractors)
   ═════════════════════════════════════════════════════════════ */

.po-filters { margin-bottom: var(--space-4); }
.po-filter-form { display: flex; gap: var(--space-3); align-items: center; max-width: 960px; margin: 0 auto; }

.po-filter-toggle { display: inline-flex; align-items: center; gap: var(--space-2); padding: 10px 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text-secondary); font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; transition: .2s; white-space: nowrap; flex-shrink: 0; }
.po-filter-toggle:hover { border-color: var(--gold-border); color: var(--gold); background: var(--gold-light); }
.po-filter-dot { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--gold); flex-shrink: 0; }

.po-search-wrap { flex: 1; position: relative; display: flex; align-items: center; min-width: 0; }
.po-search-inp { width: 100%; height: var(--control-height); padding: 0 56px 0 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text-primary); font-size: var(--fs-sm); outline: none; transition: border-color .2s; }
.po-search-inp:focus { border-color: rgba(220,177,99,.4); box-shadow: 0 0 0 3px rgba(220,177,99,.07); }
.po-search-inp::placeholder { color: var(--text-muted); }
.po-search-ok { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); height: 36px; padding: 0 18px; background: var(--gold-grad); border: none; border-radius: var(--radius-pill); color: #111; font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: var(--fs-xs); cursor: pointer; transition: filter .2s; }
.po-search-ok:hover { filter: brightness(1.1); }

/* Drawer */
.po-filter-drawer { position: fixed; inset: 0; z-index: 1000; visibility: hidden; opacity: 0; transition: visibility .3s, opacity .3s; }
.po-filter-drawer.open { visibility: visible; opacity: 1; }
.po-drawer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.po-drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: 320px; max-width: 85vw; background: var(--bg-card); border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .3s ease; display: flex; flex-direction: column; }
.po-filter-drawer.open .po-drawer-panel { transform: translateX(0); }
.po-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-5); border-bottom: 1px solid var(--border); }
.po-drawer-head h3 { font-size: var(--fs-h2); font-weight: 700; color: var(--text-primary); margin: 0; }
.po-drawer-close { width: 36px; height: 36px; border-radius: var(--radius-pill); background: var(--bg-card-2); border: 1px solid var(--border); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .2s; }
.po-drawer-close:hover { border-color: var(--gold-border); color: var(--gold); }
.po-drawer-body { flex: 1; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); overflow-y: auto; }
.po-drawer-field { display: flex; flex-direction: column; gap: var(--space-2); }
.po-drawer-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }
.po-drawer-foot { display: flex; gap: var(--space-3); padding: var(--space-5); border-top: 1px solid var(--border); }
.po-drawer-foot .btn { flex: 1; }

@media (max-width: 768px) {
  .po-filter-form { gap: var(--space-2); }
  .po-filter-toggle { padding: 8px 14px; font-size: var(--fs-xs); }
  .po-search-inp { height: 40px; padding: 0 48px 0 16px; font-size: var(--fs-sm); }
  .po-search-ok { height: 32px; padding: 0 14px; font-size: 11px; }
}

/* ═════════════════════════════════════════════════════════════
   UTILITY CLASSES (replacing common inline styles)
   ═════════════════════════════════════════════════════════════ */

.cursor-pointer { cursor: pointer; }
.rounded-full { border-radius: var(--radius-pill); }
.object-cover { object-fit: cover; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

/* Text utilities */
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-body { font-size: var(--fs-body); }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.lh-150 { line-height: 1.5; }
.text-center { text-align: center; }
