/* ── Основа ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0a0f1e;
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

a { text-decoration: none; color: inherit; }

/* ── Обёртка страницы ── */
.page-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 14px 32px;
}

/* ── Шапка страницы ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 0 12px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 16px;
}
.page-header h1 { font-size: 20px; font-weight: 700; color: #f1f5f9; }
.data-date { font-size: 12px; color: #64748b; margin-top: 3px; }
.header-btns { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.btn-icon {
  padding: 8px 10px;
  background: #1e293b;
  border-radius: 8px;
  font-size: 14px;
  color: #94a3b8;
  border: 1px solid #334155;
}
.btn-logout {
  padding: 8px 12px;
  background: #7f1d1d;
  color: #fca5a5;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

/* ── Уведомления flash ── */
.flash-container { max-width: 600px; margin: 12px auto 0; padding: 0 14px; }
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 8px;
}
.flash-success { background: #14532d; color: #4ade80; }
.flash-error   { background: #7f1d1d; color: #f87171; }
.flash-warning { background: #78350f; color: #fbbf24; }

/* ── Alert-блоки ── */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.alert-success { background: #14532d; color: #4ade80; }
.alert-error   { background: #7f1d1d; color: #f87171; }
.alert-warning { background: #78350f; color: #fbbf24; }

/* ── Форма входа ── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-icon  { font-size: 56px; margin-bottom: 12px; }
.login-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login-sub   { font-size: 14px; color: #64748b; margin-bottom: 28px; }

/* ── Поля ввода ── */
.input-field {
  display: block;
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 16px;
  color: #f1f5f9;
  margin-bottom: 10px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.input-field:focus { border-color: #3b82f6; }
.input-field::placeholder { color: #475569; }

/* ── Кнопки ── */
.btn-primary {
  display: block;
  width: 100%;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  -webkit-appearance: none;
}
.btn-primary:active { background: #1d4ed8; }
.btn-secondary {
  display: block;
  width: 100%;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  text-align: center;
}

/* ── Форма по центру ── */
.form-centered { max-width: 360px; margin: 0 auto; }

/* ── Карточка зарплаты ── */
.salary-card {
  background: linear-gradient(135deg, #1e3a5f 0%, #172554 100%);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid #1d4ed8;
  text-align: center;
}
.salary-label  { font-size: 13px; color: #93c5fd; margin-bottom: 6px; }
.salary-amount { font-size: 36px; font-weight: 800; color: #60a5fa; letter-spacing: -0.5px; }
.salary-breakdown {
  font-size: 12px; color: #64748b; margin-top: 8px;
  display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
}
.salary-store-name { font-size: 12px; color: #475569; margin-top: 8px; }

/* ── Заголовок секции ── */
.section-title {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 16px 0 10px;
}

/* ── Карточка цели ── */
.goal-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  border: 1px solid #334155;
}
.goal-card-inner {
  background: #131e2f;
  border-color: #1e293b;
  border-radius: 8px;
  margin-bottom: 6px;
}
.goal-card-inner:last-child { margin-bottom: 0; }
.goal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.goal-name  { font-size: 14px; color: #cbd5e1; font-weight: 500; }
.goal-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.goal-values {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.goal-fact { font-size: 16px; font-weight: 700; color: #f1f5f9; }
.goal-sep  { font-size: 12px; color: #475569; }
.goal-plan { font-size: 13px; color: #64748b; }
.bonus-earned { font-size: 13px; font-weight: 700; color: #4ade80; }
.bonus-zero   { font-size: 13px; font-weight: 700; color: #ef4444; }

/* ── Прогресс-бар ── */
.progress-track {
  background: #334155;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  height: 8px;
  border-radius: 99px;
  transition: width 0.5s ease;
}
.progress-fill.green  { background: linear-gradient(90deg, #16a34a, #4ade80); }
.progress-fill.yellow { background: linear-gradient(90deg, #d97706, #fbbf24); }
.progress-fill.red    { background: linear-gradient(90deg, #dc2626, #f87171); }

/* ── Бейджи статуса ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-green  { background: #14532d; color: #4ade80; }
.badge-yellow { background: #78350f; color: #fbbf24; }
.badge-red    { background: #7f1d1d; color: #f87171; }
.badge-gray   { background: #1e293b; color: #64748b; border: 1px solid #334155; }

/* ── Сводка (сетка) ── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.summary-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.summary-box {
  background: #1e293b;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid #334155;
  text-align: center;
}
.summary-num { font-size: 24px; font-weight: 800; }
.summary-lbl { font-size: 12px; color: #64748b; margin-top: 3px; }
.summary-lbl-green { color: #4ade80; }
.summary-lbl-red   { color: #ef4444; }

/* ── Раскрывающиеся магазины ── */
.store-expand { margin-bottom: 8px; }
.store-header {
  background: #1e293b;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.store-header:active { background: #263548; }
.store-header.open { border-radius: 12px 12px 0 0; border-bottom-color: transparent; }
.store-header-left  { flex: 1; min-width: 0; }
.store-header-right { text-align: right; flex-shrink: 0; margin-left: 12px; }
.dm-name   { font-size: 14px; color: #cbd5e1; font-weight: 500; margin-bottom: 3px; }
.dm-meta   { font-size: 12px; color: #64748b; margin-bottom: 3px; }
.dm-salary { font-size: 17px; font-weight: 700; color: #60a5fa; }
.dm-bonus-yes { font-size: 12px; color: #4ade80; }
.dm-bonus-no  { font-size: 12px; color: #ef4444; }
.expand-arrow { font-size: 12px; color: #64748b; margin-top: 4px; transition: transform 0.2s; }
.expand-arrow.open { transform: rotate(90deg); }
.store-detail {
  background: #131e2f;
  border: 1px solid #1e293b;
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 10px;
}
.store-detail.hidden { display: none; }
.store-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #94a3b8;
  padding: 5px 0;
  border-bottom: 1px solid #1e293b;
}
.store-detail-row:last-child { border-bottom: none; }
.total-row { color: #60a5fa; font-weight: 700; }

/* ── Вкладки admin ── */
.tabs {
  display: flex;
  gap: 4px;
  background: #0f172a;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid #1e293b;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 9px 4px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tab.active { background: #1e293b; color: #f1f5f9; }
.tab-content { }
.tab-content.hidden { display: none; }

/* ── Загрузка файла ── */
.upload-box {
  background: #1e293b;
  border-radius: 16px;
  padding: 28px 20px;
  text-align: center;
  border: 2px dashed #334155;
}
.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-hint { font-size: 14px; color: #94a3b8; margin-bottom: 20px; }
.file-label {
  display: block;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: #94a3b8;
  cursor: pointer;
  margin-bottom: 12px;
  text-align: left;
}
.file-label input[type="file"] { display: none; }
.file-name { display: block; }

/* ── Подразделения ── */
.division-row {
  background: #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 6px;
  border: 1px solid #334155;
}
.division-name { font-size: 14px; font-weight: 600; color: #f1f5f9; margin-bottom: 6px; }
.division-stats { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.div-count  { font-size: 12px; color: #64748b; }
.div-bonus-ok { font-size: 12px; color: #4ade80; }
.div-bonus-no { font-size: 12px; color: #ef4444; }
.div-fot    { font-size: 12px; color: #60a5fa; margin-left: auto; }

/* ── Журнал ── */
.log-row {
  background: #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 6px;
  border: 1px solid #334155;
}
.log-time { font-size: 11px; color: #475569; margin-bottom: 4px; }
.log-info { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.log-user  { font-size: 13px; font-weight: 600; color: #f1f5f9; }
.log-date  { font-size: 13px; color: #60a5fa; }
.log-rows  { font-size: 12px; color: #64748b; margin-left: auto; }

/* ── Страница пользователей ── */
.user-row {
  background: #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 6px;
  border: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 14px; color: #f1f5f9; font-weight: 500; margin-bottom: 3px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.user-meta { font-size: 12px; color: #64748b; }
.user-actions { flex-shrink: 0; }
.btn-reset {
  padding: 8px 12px;
  background: #1e3a5f;
  color: #93c5fd;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-reset:active { background: #1d4ed8; }
