/* ============================================================
   App24 — дизайн-система
   Оболочка приложения: тёмная навигация слева, светлый холст
   справа. Акцент — электрический синий, вторичный — бирюзовый,
   и оба используются дозированно: на активном пункте меню,
   прогрессе и результате.
   ============================================================ */

:root {
  --bg:          #F4F6FA;
  --surface:     #FFFFFF;
  --surface-2:   #FAFBFD;

  --side:        #0E1219;
  --side-2:      #161B24;
  --side-text:   #98A2B7;
  --side-active: #FFFFFF;

  --text:        #0D1220;
  --muted:       #69738A;
  --line:        #E6E9F0;

  --accent:      #3355FF;
  --accent-dark: #2440DB;
  --accent-soft: #EDF0FF;
  --teal:        #00C2A8;
  --ok:          #10A35A;
  --danger:      #E14434;

  --r:    14px;
  --r-sm: 10px;
  --side-w: 264px;

  --shadow:    0 1px 2px rgba(13,18,32,.05), 0 8px 24px -12px rgba(13,18,32,.12);
  --shadow-lg: 0 2px 4px rgba(13,18,32,.06), 0 24px 48px -20px rgba(13,18,32,.22);

  --f: "Manrope", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 800; letter-spacing: -0.025em; margin: 0 0 12px; line-height: 1.15; }
h1 { font-size: clamp(28px, 4vw, 38px); }
h2 { font-size: 24px; margin-top: 40px; }
h3 { font-size: 18px; margin-top: 26px; letter-spacing: -0.015em; }
p  { margin: 0 0 14px; }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ─────────────────────────── Оболочка ─────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  background: var(--side);
  color: var(--side-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 14px 28px;
  scrollbar-width: thin;
  scrollbar-color: #2A3241 transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #2A3241; border-radius: 3px; }

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 20px;
  color: #fff; font-weight: 800; font-size: 20px;
  letter-spacing: -0.03em; text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800; color: #fff;
}

.nav-group { margin-bottom: 6px; }
.nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: #5C6679; padding: 14px 10px 7px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--side-text); text-decoration: none;
  font-size: 14.5px; font-weight: 500;
  position: relative;
  transition: background .13s, color .13s;
}
.nav-item:hover { background: var(--side-2); color: #E4E8F0; text-decoration: none; }
.nav-item.active { background: var(--side-2); color: var(--side-active); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent), var(--teal));
}
.nav-item svg { flex: 0 0 17px; width: 17px; height: 17px; opacity: .75; }
.nav-item.active svg { opacity: 1; }
.nav-item.soon { opacity: .42; }
.nav-item .tag {
  margin-left: auto; font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; color: #5C6679; font-weight: 700;
}

/* ─────────────────────────── Контент ──────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none;
  align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.burger {
  width: 40px; height: 40px; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--r-sm);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.burger span { display: block; width: 17px; height: 2px; background: var(--text); border-radius: 2px; box-shadow: 0 -5px 0 var(--text), 0 5px 0 var(--text); }

.content { padding: 34px 34px 10px; max-width: 1180px; width: 100%; }
.narrow { max-width: 720px; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 6px; opacity: .5; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-soft); color: var(--accent-dark);
  padding: 5px 11px 5px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; margin-bottom: 16px;
}
.badge svg { width: 13px; height: 13px; }

.lede { font-size: 17.5px; color: var(--muted); max-width: 62ch; margin-bottom: 0; }
.lede b { color: var(--text); font-weight: 700; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card.pad-lg { padding: 26px; }
@media (max-width: 620px) { .card { padding: 16px; } }

/* ─────────────────────────── Кнопки ───────────────────────── */
.btn {
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 11px 20px; min-height: 44px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--accent); color: #fff;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; transition: background .13s, transform .08s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); border-color: #D3D9E5; }
.btn.sm { padding: 7px 13px; min-height: 36px; font-size: 13.5px; }
.btn svg { width: 16px; height: 16px; }

/* ─────────────────────── Поля и опции ─────────────────────── */
.opt { margin-bottom: 18px; }
.opt-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin-bottom: 9px; display: block;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 14px; min-height: 38px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; cursor: pointer; color: var(--text);
  transition: all .13s;
}
.chip:hover { border-color: #C3CBDA; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

input[type="number"], input[type="text"], select {
  font: inherit; font-size: 15px;
  padding: 9px 12px; min-height: 40px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  max-width: 100%;
}
input[type="number"] { width: 108px; }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.field-row .hint { font-size: 13px; color: var(--muted); }

input[type="range"] { width: 220px; accent-color: var(--accent); }

/* ─────────────────────── Зона загрузки ────────────────────── */
.drop {
  position: relative;
  border: 2px dashed #CFD6E4;
  border-radius: var(--r);
  background: var(--surface-2);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); border-style: solid; }
.drop-ico {
  width: 46px; height: 46px; margin: 0 auto 12px;
  border-radius: 13px; background: var(--accent-soft);
  display: grid; place-items: center; color: var(--accent);
}
.drop-ico svg { width: 22px; height: 22px; }
.drop-title { font-weight: 700; font-size: 17px; margin-bottom: 3px; }
.drop-sub { font-size: 14px; color: var(--muted); }

/* ─────────────────────── Список файлов ────────────────────── */
.files { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.file {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface);
  font-size: 14px;
}
.file .thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--bg); flex: 0 0 40px; }
.file .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file .fsize { color: var(--muted); font-size: 13px; }
.file .x { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px 6px; border-radius: 6px; }
.file .x:hover { background: var(--bg); color: var(--danger); }

/* ─────────────────────── Прогресс ─────────────────────────── */
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 16px 0 8px; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--teal)); transition: width .25s ease; }
.status { font-size: 14px; color: var(--muted); }
.err { color: var(--danger); font-size: 14.5px; font-weight: 600; margin-top: 12px; }

/* ───────────── Результат: сравнение веса (сигнатура) ──────── */
.result { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.res-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin-bottom: 18px; }
.res-prev { width: 92px; height: 92px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); flex: 0 0 92px; background: var(--bg); }

.weigh { flex: 1; min-width: 240px; }
.weigh-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.weigh-key { font-size: 12px; font-weight: 700; color: var(--muted); width: 48px; flex: 0 0 48px; text-transform: uppercase; letter-spacing: .05em; }
.weigh-track { flex: 1; height: 22px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.weigh-fill { height: 100%; border-radius: 6px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.weigh-fill.before { background: #C9D1E2; }
.weigh-fill.after { background: linear-gradient(90deg, var(--accent), var(--teal)); }
.weigh-val { font-family: var(--f-mono); font-size: 14px; font-weight: 500; width: 86px; flex: 0 0 86px; text-align: right; }

.verdict { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }
.verdict.ok { background: rgba(16,163,90,.1); color: var(--ok); }
.verdict.warn { background: rgba(225,68,52,.09); color: var(--danger); }
.saved { font-size: 13px; color: var(--muted); margin-top: 4px; }

.res-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.res-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.res-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: 14px; }
.res-item .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-item .btn { margin-left: auto; }

/* ─────────────────────── Сетка карточек ───────────────────── */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 17px;
  text-decoration: none; color: var(--text); display: block;
  transition: border-color .14s, transform .14s, box-shadow .14s;
}
.tile:hover { border-color: #C9D2E6; transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.tile-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 11px; background: var(--accent-soft); color: var(--accent); }
.tile-ico.pdf { background: rgba(225,68,52,.09); color: var(--danger); }
.tile-ico svg { width: 18px; height: 18px; }
.tile b { display: block; font-weight: 700; font-size: 15.5px; margin-bottom: 2px; letter-spacing: -0.01em; }
.tile small { color: var(--muted); font-size: 13.5px; line-height: 1.45; display: block; }
.tile.soon { opacity: .5; pointer-events: none; }

/* ─────────────────────── Прочее ───────────────────────────── */
.ad { min-height: 250px; margin: 32px 0; border: 1px dashed #D6DCE8; border-radius: var(--r); display: grid; place-items: center; background: var(--surface); color: var(--muted); font-size: 13px; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 18px 42px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.steps li::after { content: ""; position: absolute; left: 13px; top: 30px; bottom: 4px; width: 1px; background: var(--line); }
.steps li:last-child::after { display: none; }

details { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); margin-bottom: 8px; padding: 14px 16px; }
details summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; margin-left: auto; color: var(--accent); font-weight: 700; font-size: 19px; }
details[open] summary::after { content: "\2013"; }
details p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 15px; }
th, td { border: 1px solid var(--line); padding: 10px 13px; text-align: left; }
th { background: var(--surface-2); font-weight: 700; }

article p, article ul { max-width: 68ch; }
article li { margin-bottom: 7px; }

.posts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 17px; text-decoration: none; color: var(--text); transition: border-color .14s, transform .14s; }
.post:hover { border-color: #C9D2E6; transform: translateY(-2px); text-decoration: none; }
.post .cat { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.post b { display: block; margin: 6px 0 4px; font-weight: 700; letter-spacing: -0.01em; }
.post small { color: var(--muted); font-size: 13.5px; line-height: 1.45; }

.foot { margin-top: 48px; padding: 22px 34px 30px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-size: 13.5px; color: var(--muted); }
.foot a { color: var(--muted); }

.scrim { display: none; position: fixed; inset: 0; background: rgba(13,18,32,.45); z-index: 40; }

/* ─────────────────────── Мобильные ────────────────────────── */
@media (max-width: 900px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .content { padding: 20px 16px 6px; }
  .foot { padding: 20px 16px 28px; }
  .res-prev { width: 68px; height: 68px; flex: 0 0 68px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ─────────────────── Рекламные слоты ─────────────────── */
.adbox { margin: 32px 0; }
.adbox.rail { margin: 0; }
.adbox.native { margin: 22px 0 0; }
.adlabel {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: #98A2B7; margin-bottom: 5px; display: flex; align-items: center; gap: 6px;
}
.adlabel::after { content: ""; flex: 1; height: 1px; background: var(--line); }
/* Высота зарезервирована заранее — иначе баннер сдвинет вёрстку (CLS) */
.adbox > div:not(.adlabel) { min-height: 250px; }
.adbox.rail > div:not(.adlabel) { min-height: 600px; }
.adbox.native > div:not(.adlabel) { min-height: 200px; }
.ad-stub {
  border: 1px dashed #D6DCE8; border-radius: var(--r);
  display: grid; place-items: center; background: var(--surface);
  color: var(--muted); font-size: 13px;
}

/* ─────────────────── Экран «Готово» ─────────────────── */
.done-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.done-check {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
  background: rgba(16,163,90,.12); color: var(--ok); display: grid; place-items: center;
}
.done-check svg { width: 20px; height: 20px; }
.done-t { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.done-s { font-size: 13.5px; color: var(--muted); }
.chain { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line); }
.chain-t {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin-bottom: 10px;
}
.chain-row { display: flex; flex-wrap: wrap; gap: 8px; }
.res-actions .btn { min-width: 160px; justify-content: center; }

@media (max-width: 900px) {
  /* Место под липкий баннер РСЯ, чтобы он не перекрывал подвал */
  body { padding-bottom: 78px; }
  .res-actions .btn { width: 100%; }
}

/* ─────────────────── Две колонки с рекламным рельсом ─────────────────── */
.cols { display: flex; gap: 28px; align-items: flex-start; }
.col-main { flex: 1; min-width: 0; max-width: 840px; }
.col-rail { width: 300px; flex: 0 0 300px; position: sticky; top: 20px; }
@media (max-width: 1180px) { .col-rail { display: none; } }

/* Логотип длиннее прежнего — уменьшаем кегль, чтобы не переносился */
.brand { font-size: 17px; }
.sidebar .brand { font-size: 17.5px; }
