/* Kizzy Codes · компоненты. Требует design/tokens.css и шрифты Inter Tight, Inter, JetBrains Mono.
   Имена классов — это имена компонентов, на них ссылаемся в задачах. Список и правила: design/ui-kit.md
   Обновлено: 2026-10-14 */

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
a { color: inherit; }

/* ---------- Типографика ---------- */
.t-display { font-family: var(--f-display); font-weight: 700; letter-spacing: -.035em; line-height: .95; font-size: clamp(36px, 5vw, 64px); text-wrap: balance; }
.t-h1 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; font-size: 28px; text-wrap: balance; }
.t-h2 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-size: 20px; text-wrap: balance; }
.t-h3 { font-family: var(--f-body); font-weight: 600; line-height: 1.3; font-size: 15.5px; }
.t-body { font-size: 15px; line-height: 1.5; }
.t-small { font-size: 13px; line-height: 1.45; }
.t-muted { color: var(--ink-2); }
.t-faint { color: var(--ink-3); }
.t-num { font-family: var(--f-display); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.t-mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--f-mono); font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.eyebrow-dash { display: inline-flex; align-items: center; gap: 10px; }
.eyebrow-dash::before { content: ""; width: 20px; height: 1px; background: currentColor; }
.on-dark { color: var(--ink-on-dark); }
.on-dark .t-muted, .on-dark .t-faint, .on-dark .eyebrow { color: var(--ink-on-dark-2); }
.measure { max-width: 62ch; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-pill); border: 1.5px solid transparent;
  font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap; text-decoration: none;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--yellow); color: var(--on-yellow); }
.btn-primary:hover:not(:disabled) { background: var(--yellow-hover); }
.btn-dark { background: var(--surface-dark); color: var(--yellow); }
.btn-dark:hover:not(:disabled) { background: var(--surface-dark-2); }
.btn-outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-outline:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.btn-ghost { color: var(--ink); background: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.on-dark .btn-outline { border-color: var(--ink-on-dark); color: var(--ink-on-dark); }
.on-dark .btn-outline:hover:not(:disabled) { background: var(--ink-on-dark); color: var(--surface-dark); }
.on-dark .btn-ghost { color: var(--ink-on-dark); }
.on-dark .btn-ghost:hover:not(:disabled) { background: var(--surface-dark-2); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn .arrow { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Чипы и бейджи ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.chip-neutral { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-crit { background: var(--crit-soft); color: var(--crit); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-yellow { background: var(--yellow); color: var(--on-yellow); }
.chip-dark { background: var(--surface-dark); color: var(--ink-on-dark); }
.chip-mono { font-family: var(--f-mono); font-weight: 500; letter-spacing: .04em; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: var(--r-pill); font: 500 11.5px/1 var(--f-mono); background: var(--yellow); color: var(--on-yellow); }
.badge-ok { background: var(--ok); color: #fff; }

/* ---------- Карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0; }
.card-dark { background: var(--surface-dark); color: var(--ink-on-dark); border-radius: var(--r-card); min-width: 0; border: 1px solid var(--line-dark); }   /* в тёмной теме граница отделяет панель от фона */
.card-soft { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-dark .card-head { border-color: var(--line-dark); }
.card-body { padding: 22px; }
.card-body-tight { padding: 14px 22px; }

/* Плитка с числом */
.stat { padding: 20px 22px; }
.stat .eyebrow { display: block; margin-bottom: 12px; }
.stat .stat-value { font-family: var(--f-display); font-weight: 700; font-size: 36px; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .stat-value small { font-family: var(--f-body); font-weight: 500; font-size: 14px; letter-spacing: 0; color: var(--ink-3); margin-left: 4px; }
.stat .stat-note { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.stat-crit { background: var(--crit-soft); border-color: transparent; }
.stat-crit .stat-value { color: var(--crit); }
.stat-ok { background: var(--ok-soft); border-color: transparent; }
.stat-ok .stat-value { color: var(--ok); }
.stat-warn { background: var(--warn-soft); border-color: transparent; }
.stat-warn .stat-value { color: var(--warn); }

/* Алерт: одна мысль и одно действие */
.alert { display: flex; align-items: center; gap: 18px; padding: 22px 24px; border-radius: var(--r-card); flex-wrap: wrap; }
.alert-dark { background: var(--surface-dark); color: var(--ink-on-dark); border: 1px solid var(--line-dark); }
.alert-ok { background: var(--ok-soft); }
.alert-crit { background: var(--crit-soft); }
.alert-yellow { background: var(--yellow-soft); }
.alert .alert-text { flex: 1 1 320px; min-width: 0; }
.alert .alert-text p { margin-top: 6px; font-size: 14px; }
.alert-dark .alert-text p { color: var(--ink-on-dark-2); }
.alert .alert-act { flex: none; }

/* ---------- Списки и пары ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { font-weight: 500; }
.on-dark .kv dt { color: var(--ink-on-dark-2); }
.steps { display: grid; gap: 18px; }
.steps > div { display: grid; gap: 6px; }
.steps .eyebrow { color: var(--yellow); }
.steps .step-title { font-family: var(--f-display); font-weight: 700; font-size: 17px; letter-spacing: -.02em; line-height: 1.15; }
.steps p { font-size: 14px; color: var(--ink-on-dark-2); }
.checklist { display: grid; gap: 10px; }
.checklist > div { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-3); }
.checklist .tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; }
.checklist .is-run { color: var(--ink); }
.checklist .is-run .tick { border-color: var(--yellow); border-top-color: transparent; animation: kz-spin .8s linear infinite; }
.checklist .is-done { color: var(--ink); }
.checklist .is-done .tick { border-color: var(--ok); background: var(--ok); }
.checklist .is-done .tick::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.checklist .is-fail { color: var(--crit); }
.checklist .is-fail .tick { border-color: var(--crit); background: var(--crit); color: #fff; font: 700 12px/1 var(--f-body); }
.checklist .is-fail .tick::after { content: "×"; }
@keyframes kz-spin { to { transform: rotate(360deg); } }

/* Сертификат подписи */
.cert { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--line); }
.cert.is-selected { border-color: var(--ink); }
.cert .cert-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-dark); color: var(--yellow); display: grid; place-items: center; flex: none; }
.cert .cert-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cert b { display: block; font-weight: 600; }
.cert span { font-size: 12.5px; color: var(--ink-3); }

/* ---------- Таблица ---------- */
.tbl-wrap { overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font: 500 11px/1.3 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .cell-title { font-weight: 500; }
.tbl .cell-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.tbl .row-done td { color: var(--ink-3); }
.tbl .row-done .cell-title { color: var(--ink-3); }
.tbl-scroll { max-height: 560px; overflow: auto; }
.code { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-3); }
.code b { font-weight: 500; color: var(--ink); }
.row-done .code b { color: var(--ink-3); }

/* ---------- Поля ---------- */
.field { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 12px; border: 1.5px solid var(--line-2); border-radius: var(--r-ctl); background: var(--surface); font-size: 14px; color: var(--ink); }
.field:focus { outline: none; border-color: var(--ink); }
.field:disabled { opacity: .5; }
select.field { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236B6B66' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.check { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; vertical-align: middle; cursor: pointer; }
.switch { position: relative; width: 44px; height: 26px; flex: none; appearance: none; margin: 0; border-radius: var(--r-pill); background: var(--line-2); cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch:checked { background: var(--ink); }
.switch:checked::after { left: 21px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { padding: 6px 13px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: transparent; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg button:hover { border-color: var(--ink); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .setting-text b { display: block; font-weight: 600; margin-bottom: 3px; }
.setting-row .setting-text span { display: block; font-size: 13.5px; color: var(--ink-2); max-width: 58ch; }

/* ---------- Навигация (чёрный сайдбар) ---------- */
.side { background: var(--surface-dark); color: var(--ink-on-dark); display: flex; flex-direction: column; gap: 24px; padding: 22px 16px; border-right: 1px solid var(--line-dark); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; }
.brand .brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-dark); display: grid; place-items: center; flex: none; }
.brand .brand-mark svg { width: 28px; height: auto; display: block; }
.brand .brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand .brand-name { font-family: var(--f-display); font-weight: 700; font-size: 17px; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.brand .brand-sub { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--ink-on-dark-2); margin-top: 3px; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--ink-on-dark-2); font-weight: 500; font-size: 14.5px; text-align: left; }
.nav-item:hover { background: var(--surface-dark-2); color: var(--ink-on-dark); }
a.nav-item { text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--surface-dark-2); color: var(--ink-on-dark); }
.nav-item[aria-current="page"] svg { stroke: var(--yellow); }
.nav-item svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item .badge { margin-left: auto; }
.nav-item .soon { margin-left: auto; font: 500 10.5px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-on-dark-2); border: 1px solid var(--line-dark); border-radius: var(--r-pill); padding: 4px 7px; }
.nav-item:disabled { opacity: .5; cursor: default; }
.nav-item:disabled:hover { background: transparent; color: var(--ink-on-dark-2); }
.side-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--line-dark); font-size: 12.5px; line-height: 1.55; color: var(--ink-on-dark-2); }
.side-foot .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 7px; vertical-align: 1px; }
.side-foot b { color: var(--ink-on-dark); font-weight: 500; }

/* ---------- Модалка и тост ---------- */
.modal-back { position: fixed; inset: 0; z-index: 20; background: rgba(10, 10, 10, .6); display: grid; place-items: center; padding: 20px; }
.modal { width: min(540px, 100%); background: var(--surface); color: var(--ink); border-radius: var(--r-card); box-shadow: var(--shadow-pop); overflow: hidden; }
.modal-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; padding: 12px 18px; border-radius: var(--r-pill); background: var(--surface-dark); color: var(--ink-on-dark); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-pop); white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
.result-ok { text-align: center; padding: 8px 0; }
.result-ok .result-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--ok-soft); display: grid; place-items: center; margin: 0 auto 16px; }
.result-ok .result-icon svg { width: 28px; height: 28px; stroke: var(--ok); fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Полоса «демо» ---------- */
.demo-bar { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 9px 16px; background: var(--yellow); color: var(--on-yellow); font-size: 13px; }
.demo-bar b { font-family: var(--f-mono); font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.demo-bar button { background: transparent; border: 1.5px solid var(--on-yellow); border-radius: var(--r-pill); padding: 4px 12px; font-size: 12.5px; font-weight: 600; color: var(--on-yellow); }

/* ---------- Раскладка ---------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3-2 { grid-template-columns: minmax(0, 1fr); }
  .stat .stat-value { font-size: 30px; }
}

/* ---------- График (SVG) ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--f-mono); font-size: 10px; fill: var(--ink-3); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar-neutral { fill: var(--line-2); }
.chart .bar-ink { fill: var(--ink); }
.chart .bar-yellow { fill: var(--yellow); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

@media (prefers-reduced-motion: reduce) {
  .checklist .is-run .tick { animation: none; border-top-color: var(--yellow); }
  .btn, .switch, .switch::after { transition: none; }
}
