:root {
  --red: #D9283F;
  --red-dark: #B91F33;
  --ink: #18181B;
  --muted: #5B5B66;
  --line: #E4E4E9;
  --bg: #F4F4F6;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
}

h1, h2 { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }

/* Лого */
.logo { display: flex; align-items: flex-start; gap: 2px; }
.logo-num { font-size: 40px; font-weight: 800; color: var(--red); letter-spacing: -1.5px; line-height: 1; }
.logo-word { display: block; font-size: 11px; font-weight: 600; letter-spacing: 5px; margin-top: 2px; }

/* Бутони и полета */
.btn-primary {
  min-height: 48px; border: 0; border-radius: 12px; background: var(--red); color: #fff;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--red-dark); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-ghost {
  min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.btn-ghost:hover { background: var(--bg); }
input {
  min-height: 48px; border: 1px solid #D4D4DA; border-radius: 12px; padding: 0 14px;
  font: inherit; font-size: 15px; width: 100%;
}
input:focus, button:focus-visible, a:focus-visible { outline: 3px solid #F3C2C9; outline-offset: 1px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); }

/* Вход */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 32px; display: flex; flex-direction: column; gap: 10px;
}
.login-card h1 { font-size: 22px; margin: 18px 0 8px; }
.error { margin: 4px 0; color: var(--red-dark); font-size: 14px; }
.mfa-enroll { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.mfa-enroll p { margin: 0; font-size: 13px; }
.mfa-enroll img { border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.secret { font-size: 13px; background: var(--bg); padding: 8px 10px; border-radius: 8px; word-break: break-all; user-select: all; }

/* Оформление */
.layout { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar {
  flex: 1 1 220px; max-width: 260px; min-width: 220px; background: #fff; border-right: 1px solid var(--line);
  padding: 28px 20px; display: flex; flex-direction: column; gap: 28px;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px; font-size: 15px; text-decoration: none; color: #3F3F46; }
.nav-item.active { background: #FDECEE; color: var(--red-dark); font-weight: 600; }
.nav-item.soon { color: #71717A; }
.nav-item small { font-size: 11px; color: #71717A; }
.locations { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.loc { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.loc.active { background: #F5FBF7; }
.loc small { font-size: 11px; font-weight: 600; color: var(--muted); }
.loc.active small { color: #17663A; }

.content { flex: 999 1 560px; min-width: 0; padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 24px; }
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.top h1 { font-size: 32px; letter-spacing: -.5px; margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip-warn { background: #FFF4E5; color: #8A4B00; }
.chip-warn i { background: #E08A00; }
.chip-ok { background: #E9F7EF; color: #17663A; }
.chip-ok i { background: #1F9D55; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.card-red { background: var(--red); border-color: var(--red); color: #fff; }
.card-red .kpi-label, .card-red .kpi-note { color: #fff; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.muted-value { color: #A1A1AA; }
.kpi-note { font-size: 12px; color: var(--muted); }

.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-head h2 { font-size: 18px; }
.list { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #EDEDF1; }
.row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--muted); }
.row-side { display: flex; align-items: center; gap: 8px; flex: none; }
.qty { font-size: 14px; font-weight: 700; color: var(--red-dark); min-width: 52px; text-align: right; }
.badge { font-size: 11px; font-weight: 600; color: #1D5FA8; background: #EAF2FC; border-radius: 6px; padding: 3px 7px; }
.empty { padding: 16px 0; color: var(--muted); font-size: 14px; }
.footer { font-size: 12px; }

.loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--muted); }

@media (max-width: 640px) {
  .content { padding: 20px 16px 32px; }
  .top h1 { font-size: 24px; }
  .sidebar { max-width: none; border-right: 0; border-bottom: 1px solid var(--line); gap: 16px; }
  .locations { margin-top: 0; }
}
