/* ── Дизайн-система KMUT Supply ────────────────────────── */
:root {
  --bg-primary:    #1C1C1E;
  --bg-card:       #2C2C2E;
  --bg-card-hover: #3A3A3C;

  --text-primary:   #FFFFFF;
  --text-secondary: #AEAEB2;
  --text-tertiary:  #8E8E93;

  --accent-green:  #30D158;
  --accent-orange: #FF9F0A;
  --accent-red:    #FF453A;
  --accent-blue:   #0A84FF;

  --chart-primary:   #30D158;
  --chart-secondary: #FF9F0A;

  --radius-card: 16px;
  --radius-btn:  12px;
  --radius-chip: 8px;
  --radius-badge: 6px;

  --font: -apple-system, 'SF Pro Display', 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Заголовок ──────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 10;
}
.header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.header-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.refresh-btn {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-btn);
  color: var(--accent-blue);
  cursor: pointer;
  font-size: 18px;
  height: 36px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.refresh-btn:active { background: var(--bg-card-hover); }

/* ── Навигация (табы) ───────────────────────────────────── */
.nav-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 20px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 18px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.tab-btn.active {
  background: var(--accent-blue);
  color: #fff;
}
.tab-btn:active { opacity: 0.8; }

/* ── Экраны ─────────────────────────────────────────────── */
.screen { display: none; padding: 0 16px 100px; animation: fadeIn 0.25s ease; }
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Метрики (2×2 сетка) ────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 16px;
  cursor: default;
  transition: background 0.15s;
}
.metric-card:active { background: var(--bg-card-hover); }
.metric-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 4px;
}
.metric-value.green  { color: var(--accent-green); }
.metric-value.orange { color: var(--accent-orange); }
.metric-value.red    { color: var(--accent-red); }
.metric-value.blue   { color: var(--accent-blue); }
.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Секции ─────────────────────────────────────────────── */
.section {
  margin-bottom: 20px;
}
.section-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.2px;
}

/* ── График ─────────────────────────────────────────────── */
.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 16px;
}
.chart-wrap { position: relative; height: 160px; }

/* ── Прогресс-бар отгрузок ──────────────────────────────── */
.progress-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 16px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.progress-label span { font-size: 13px; color: var(--text-secondary); }
.progress-label strong { color: var(--text-primary); }
.progress-bar-track {
  background: var(--bg-card-hover);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  background: var(--accent-green);
  border-radius: 4px;
  height: 100%;
  transition: width 0.6s ease;
}

/* ── Алерты ─────────────────────────────────────────────── */
.alert-card {
  background: rgba(255,69,58,0.1);
  border: 1px solid rgba(255,69,58,0.25);
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.alert-icon { font-size: 22px; }
.alert-text { font-size: 14px; color: var(--text-primary); }
.alert-sub  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── Поиск ──────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  margin-bottom: 14px;
}
.search-input {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-btn);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  padding: 11px 14px 11px 40px;
  width: 100%;
}
.search-input::placeholder { color: var(--text-tertiary); }
.search-icon {
  color: var(--text-tertiary);
  font-size: 16px;
  left: 13px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

/* ── Фильтры-чипы ───────────────────────────────────────── */
.filter-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-chip);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.chip.active { background: var(--accent-blue); color: #fff; }
.chip:active { opacity: 0.8; }

/* ── Список контрактов ──────────────────────────────────── */
.contracts-list { display: flex; flex-direction: column; gap: 10px; }
.contract-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  cursor: pointer;
  padding: 14px 16px;
  transition: background 0.15s;
}
.contract-card:active { background: var(--bg-card-hover); }
.contract-id {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 3px;
}
.contract-client {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}
.contract-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.contract-amount {
  font-size: 16px;
  font-weight: 700;
}

/* ── Бейджи статусов ────────────────────────────────────── */
.badge {
  border-radius: var(--radius-badge);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
}
.badge-green  { background: rgba(48,209,88,0.15);  color: var(--accent-green); }
.badge-orange { background: rgba(255,159,10,0.15); color: var(--accent-orange); }
.badge-red    { background: rgba(255,69,58,0.15);  color: var(--accent-red); }
.badge-gray   { background: rgba(142,142,147,0.15); color: var(--text-secondary); }

/* ── Карточка клиента ───────────────────────────────────── */
.client-header {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.back-btn {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-btn);
  color: var(--accent-blue);
  cursor: pointer;
  font-size: 20px;
  height: 36px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.client-name {
  font-size: 18px;
  font-weight: 700;
}
.client-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 14px 10px;
  text-align: center;
}
.stat-value {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.stat-label { font-size: 11px; color: var(--text-secondary); }

/* ── Скелетон (загрузка) ────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-card);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-metric { height: 90px; }
.skeleton-row    { height: 80px; margin-bottom: 10px; }

/* ── Пустые состояния ───────────────────────────────────── */
.empty-state {
  color: var(--text-tertiary);
  font-size: 14px;
  padding: 40px 0;
  text-align: center;
}
.empty-state .emoji { font-size: 40px; margin-bottom: 12px; }

/* ── Заглушка доступа ──────────────────────────────────── */
.access-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-primary);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.4s ease;
}
.access-overlay.visible {
  display: flex;
}
.access-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 40px 32px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  animation: accessSlideUp 0.5s ease;
}
@keyframes accessSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.access-icon {
  font-size: 56px;
  margin-bottom: 20px;
}
.access-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}
.access-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-line;
  margin-bottom: 28px;
}
.access-btn {
  display: inline-block;
  background: var(--accent-blue);
  color: #fff;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  padding: 14px 32px;
  border-radius: var(--radius-btn);
  transition: opacity 0.15s;
}
.access-btn:active { opacity: 0.8; }
.access-btn.hidden { display: none; }
