/* Визуальная демка продукта: общий каркас и компоненты всех экранов.
   Дизайн-токены едины с будущим приложением (Express + EJS). */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #1c2430;
  --muted: #66707d;
  --line: #e3e7ec;
  --line-strong: #cfd6de;
  --accent: #2a5fb8;
  --accent-soft: #eaf1fb;
  --good: #0a7d0a;
  --good-bg: #e9f7e9;
  --warn: #8a6400;
  --warn-bg: #fdf3dd;
  --serious: #b4501e;
  --serious-bg: #fdeee6;
  --crit: #b32424;
  --crit-bg: #fdeaea;
  --info: #175cd3;
  --info-bg: #e8f0fe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 36, 48, 0.06), 0 4px 14px rgba(28, 36, 48, 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

/* ── Каркас: топбар + сайдбар проекта + контент ─────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 54px; padding: 0 20px;
  background: #12233d; color: #fff;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; color: #fff; text-decoration: none; }
.topbar .brand .logo {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, #4d8af0, #2a5fb8);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.topbar .crumb { color: #b8c4d6; font-size: 13.5px; }
.topbar .crumb b { color: #fff; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .demo-tag {
  font-size: 12px; letter-spacing: 0.4px; text-transform: uppercase;
  color: #ffd479; background: rgba(255, 212, 121, 0.12);
  border: 1px solid rgba(255, 212, 121, 0.35);
  padding: 3px 10px; border-radius: 999px; font-weight: 600;
}
.role-switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #b8c4d6; }
.role-switch select {
  background: #1c3252; color: #fff; border: 1px solid #33507c;
  border-radius: 7px; padding: 4px 8px; font: inherit; font-size: 13px;
}

.shell { display: flex; min-height: calc(100vh - 54px); }

.projnav {
  width: 232px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  position: sticky; top: 54px; align-self: flex-start;
  max-height: calc(100vh - 54px); overflow-y: auto;
}
.projnav .proj {
  font-weight: 650; font-size: 14px; padding: 4px 10px 10px;
  border-bottom: 1px solid var(--line); margin-bottom: 8px;
}
.projnav .proj .sub { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.projnav a.item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 13.8px;
}
.projnav a.item .ic { width: 18px; text-align: center; opacity: 0.75; font-size: 13px; }
.projnav a.item:hover { background: var(--surface-2); }
.projnav a.item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.projnav .group { margin: 14px 10px 4px; font-size: 11.5px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); font-weight: 650; }

.content { flex: 1; min-width: 0; padding: 26px 30px 60px; max-width: 1120px; }

/* ── Пагинатор демо-сценария ─────────────────────────────────────── */

.pager {
  position: fixed; right: 22px; bottom: 20px; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  background: #12233d; color: #dfe7f2;
  border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow); font-size: 13px;
}
.pager a, .pager span.step { padding: 4px 10px; border-radius: 8px; }
.pager a { color: #fff; text-decoration: none; background: #24406b; }
.pager a:hover { background: #31548a; }
.pager span.step { color: #9fb2cc; }
.pager .arrow { font-size: 15px; }

/* ── Типографика и общие блоки ──────────────────────────────────── */

h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 26px 0 10px; }
h3 { font-size: 14.5px; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 760px; }
a { color: var(--accent); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
}
.card.shadow { box-shadow: var(--shadow); }
.card .card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card .card-title h3 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } .projnav { display: none; } }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 21px; font-weight: 680; margin-top: 2px; letter-spacing: -0.01em; }
.stat .hint { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* ── Бейджи и статусы ────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.serious { background: var(--serious-bg); color: var(--serious); }
.badge.crit { background: var(--crit-bg); color: var(--crit); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.neutral { background: #eef1f4; color: #4a5462; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.conf { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.conf .bar { width: 46px; height: 5px; border-radius: 3px; background: #e8ebee; overflow: hidden; }
.conf .bar i { display: block; height: 100%; background: var(--accent); }
.conf.low .bar i { background: var(--warn); }

/* ── Кнопки и формы ──────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 7px 14px; font: inherit; font-size: 13.8px; font-weight: 600;
  cursor: pointer; text-decoration: none; background: var(--accent); color: #fff;
}
.btn:hover { background: #23519f; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: #fff; color: var(--crit); border-color: #ecc8c8; }
.btn.danger:hover { background: var(--crit-bg); }
.btn.small { padding: 4px 10px; font-size: 12.8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.field label .req { color: var(--crit); }
.field .hinted { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 11px; font: inherit; font-size: 14px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field .err { color: var(--crit); font-size: 12.5px; margin-top: 3px; }
.field .warn-note { color: var(--warn); font-size: 12.5px; margin-top: 3px; }
.form-row { display: flex; gap: 14px; }
.form-row .field { flex: 1; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ── Таблицы ─────────────────────────────────────────────────────── */

table { border-collapse: collapse; width: 100%; font-size: 13.8px; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr.total-row td { font-weight: 680; border-top: 2px solid var(--line-strong); background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { display: block; color: var(--muted); font-size: 12.3px; margin-top: 2px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.6px; }
.nowrap { white-space: nowrap; }

/* ── Карточка позиции подбора ────────────────────────────────────── */

.pick-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; background: var(--surface); }
.pick-card .head { display: flex; align-items: flex-start; gap: 12px; }
.pick-card .head .info { flex: 1; min-width: 0; }
.pick-card .name { font-weight: 650; font-size: 14.5px; }
.pick-card .why { color: var(--muted); font-size: 12.8px; margin-top: 3px; }
.pick-card.main { border-color: #b9d0f2; background: linear-gradient(0deg, #fbfdff, #fbfdff); }
.pick-card.main .tag-main {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 8px;
}
.pick-card.alt { opacity: 0.96; }
.price { font-weight: 680; font-variant-numeric: tabular-nums; }

/* ── Баннеры ─────────────────────────────────────────────────────── */

.banner { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; font-size: 13.8px; }
.banner .ic { font-size: 16px; line-height: 1.3; }
.banner.crit { background: var(--crit-bg); border: 1px solid #f0c7c7; color: #7c1d1d; }
.banner.warn { background: var(--warn-bg); border: 1px solid #f1dfae; color: #6d5000; }
.banner.info { background: var(--info-bg); border: 1px solid #cdddf8; color: #174ea6; }
.banner.good { background: var(--good-bg); border: 1px solid #cdebc9; color: #0a5c0a; }
.banner .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ── Прогресс и мини-бары ────────────────────────────────────────── */

.progress { height: 7px; border-radius: 4px; background: #e8ebee; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.progress.warn i { background: var(--warn); }
.progress.crit i { background: var(--crit); }
.progress.good i { background: var(--good); }

/* ── Модальное окно (в демке — как раскрытое состояние) ──────────── */

.modal-frame { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.modal-frame .modal-tag { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 650; margin-bottom: 10px; }
.modal-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }

/* ── Таймлайн этапов ─────────────────────────────────────────────── */

.timeline { position: relative; margin: 8px 0 4px; }
.timeline .row { display: grid; grid-template-columns: 190px 1fr 150px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.timeline .row:last-child { border-bottom: none; }
.timeline .track { position: relative; height: 22px; background: #edf0f3; border-radius: 6px; }
.timeline .track i { position: absolute; top: 4px; bottom: 4px; border-radius: 5px; background: var(--accent); opacity: 0.85; }
.timeline .track i.late { background: var(--serious); }

/* ── Экран «карта флоу» (index) ──────────────────────────────────── */

.flow-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1000px) { .flow-map { grid-template-columns: repeat(2, 1fr); } }
.flow-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: block; text-decoration: none; color: var(--ink); position: relative; }
.flow-step:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.flow-step .n { position: absolute; top: 12px; right: 12px; font-size: 12px; color: var(--muted); font-weight: 650; }
.flow-step .t { font-weight: 650; margin-bottom: 4px; }
.flow-step .d { color: var(--muted); font-size: 12.6px; }
.flow-step .us { margin-top: 8px; font-size: 11.5px; color: var(--accent); font-weight: 650; letter-spacing: 0.3px; }

.note { border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 8px 8px 0; padding: 10px 14px; color: var(--muted); font-size: 13px; margin: 14px 0; }
kbd { font-family: var(--mono); font-size: 11.5px; background: #eef1f4; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; }
