/* =========================================================
   IBPR Check — ICT-MD
   ========================================================= */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --line: #e3e7ef;
  --text: #0f1b2d;
  --text-2: #4a5872;
  --muted: #7b879c;
  --brand: #17191e;
  --brand-2: #2c3039;
  --accent: #e30613;
  --accent-2: #ff5a4f;
  --focus: rgba(227,6,19, .35);

  /* risk levels */
  --low: #16a34a;     --low-bg: #e8f7ee;
  --mid: #d4a106;     --mid-bg: #fdf6d8;
  --high: #ea6a0c;    --high-bg: #fff0e3;
  --crit: #dc2626;    --crit-bg: #fde9e9;

  /* pillars */
  --p1: #7c3aed; --p1-bg: #f3edff;
  --p2: #db2777; --p2-bg: #fdebf4;
  --p3: #0284c7; --p3-bg: #e6f4fc;
  --p4: #059669; --p4-bg: #e5f7f0;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 6px 24px rgba(15, 27, 45, .06);
  --shadow-lg: 0 20px 50px rgba(23,25,30, .18);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) {
    --bg: #111215; --surface: #1b1d22; --surface-2: #16181c; --line: #2b2e35;
    --text: #e8eef8; --text-2: #b0bdd2; --muted: #7d8ba3;
    --low-bg: rgba(22,163,74,.15); --mid-bg: rgba(212,161,6,.16); --high-bg: rgba(234,106,12,.16); --crit-bg: rgba(220,38,38,.18);
    --p1-bg: rgba(124,58,237,.16); --p2-bg: rgba(219,39,119,.15); --p3-bg: rgba(2,132,199,.16); --p4-bg: rgba(5,150,105,.16);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111215; --surface: #1b1d22; --surface-2: #16181c; --line: #2b2e35;
  --text: #e8eef8; --text-2: #b0bdd2; --muted: #7d8ba3;
  --low-bg: rgba(22,163,74,.15); --mid-bg: rgba(212,161,6,.16); --high-bg: rgba(234,106,12,.16); --crit-bg: rgba(220,38,38,.18);
  --p1-bg: rgba(124,58,237,.16); --p2-bg: rgba(219,39,119,.15); --p3-bg: rgba(2,132,199,.16); --p4-bg: rgba(5,150,105,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hide-sm { display: none; }
@media (min-width: 640px) { .hide-sm { display: inline; } .container { padding: 0 24px; } }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(23,25,30, .92); backdrop-filter: blur(10px); color: #fff; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand__mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 22px; color: #fff; box-shadow: 0 4px 14px rgba(227,6,19,.4); }
.brand__mark svg path:first-child { fill: rgba(255,255,255,.18); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-size: 16px; font-weight: 800; }
.brand__text small { font-size: 11.5px; color: rgba(255,255,255,.65); }
.topbar__actions { display: flex; gap: 8px; }
.icon-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #fff; font-size: 13.5px; font-weight: 600; transition: background .2s; }
.icon-btn:hover { background: rgba(255,255,255,.14); }
.icon-btn svg { font-size: 18px; }
.icon-btn--round { width: 38px; padding: 0; justify-content: center; }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; } [data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

/* ---------- Hero ---------- */
.hero { position: relative; color: #fff; padding: 40px 0 34px; background: var(--brand); }
.hero__bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(600px 300px at 85% -10%, rgba(227,6,19,.35), transparent 70%),
    radial-gradient(500px 300px at -5% 110%, rgba(0,128,0,.22), transparent 70%),
    linear-gradient(180deg, #17191e, #262a32);
}
.hero__bg::after { content: ""; position: absolute; inset: 0; opacity: .08;
  background-image: repeating-linear-gradient(135deg, #fff 0 2px, transparent 2px 22px); mask-image: linear-gradient(180deg, #000, transparent 85%); }
.hero__inner { position: relative; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); background: rgba(255,90,79,.1); border: 1px solid rgba(255,90,79,.25); padding: 6px 12px; border-radius: 999px; }
.hero h1 { font-size: clamp(26px, 5.4vw, 46px); font-weight: 800; margin: 16px 0 12px; max-width: 760px; }
.hero h1 .accent { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__lead { color: rgba(255,255,255,.75); max-width: 640px; font-size: 15.5px; }
.hero__meta { margin-top: 14px; font-size: 12.5px; color: rgba(255,255,255,.55); }

/* ---------- Search ---------- */
.search { margin-top: 24px; max-width: 820px; }
.search__box { position: relative; display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 16px; padding: 6px; box-shadow: var(--shadow-lg); transition: box-shadow .2s; }
.search__box:focus-within { box-shadow: 0 0 0 4px rgba(227,6,19,.35), var(--shadow-lg); }
.search__icon { font-size: 20px; color: #7b879c; margin-left: 10px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: #0f1b2d; padding: 12px 4px; }
.search input::placeholder { color: #9aa5b8; }
.search__clear { border: 0; background: #eef1f6; color: #4a5872; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.search__clear svg { font-size: 14px; }
.btn-check { display: inline-flex; align-items: center; gap: 8px; border: 0; height: 48px; padding: 0 20px; border-radius: 12px; font-weight: 700; font-size: 15px; color: #fff; background: linear-gradient(135deg, var(--accent), #ff3b30); box-shadow: 0 6px 18px rgba(227,6,19,.45); transition: transform .15s, box-shadow .2s; white-space: nowrap; }
.btn-check:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(227,6,19,.5); }
.btn-check:active { transform: translateY(0); }
.btn-check svg { font-size: 20px; }
@media (max-width: 520px) {
  .search__box { flex-wrap: wrap; padding: 6px; }
  .search__icon { display: none; }
  .search input { padding: 12px 10px; flex-basis: calc(100% - 44px); }
  .btn-check { width: 100%; justify-content: center; }
}

.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: var(--surface); color: var(--text); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); max-height: min(60vh, 460px); overflow-y: auto; z-index: 30; padding: 6px; overscroll-behavior: contain; }
.suggest__group { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 4px; }
.suggest__item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.suggest__item.active, .suggest__item:hover { background: var(--surface-2); }
.suggest__item.active { box-shadow: inset 3px 0 0 var(--accent); }
.suggest__ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--p3-bg); color: var(--p3); font-size: 17px; }
.suggest__txt { flex: 1; min-width: 0; }
.suggest__name { font-weight: 600; font-size: 14.5px; }
.suggest__name mark { background: rgba(255,90,79,.3); color: inherit; border-radius: 3px; padding: 0 1px; }
.suggest__sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest__empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; margin-top: 18px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; transition: all .2s; }
.chip:hover { background: rgba(255,255,255,.14); }
.chip.active { background: #fff; color: var(--brand); border-color: #fff; }
.chip .n { opacity: .6; margin-left: 4px; font-weight: 500; }

/* ---------- Welcome ---------- */
.welcome { padding: 32px 0 20px; }
.steps4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 860px) { .steps4 { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.step4 { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.step4 span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; font-weight: 800; margin-bottom: 10px; }
.step4 h3 { font-size: 15px; margin-bottom: 4px; }
.step4 p { font-size: 13px; color: var(--text-2); }
.step4.p1 span { background: var(--p1-bg); color: var(--p1); } .step4.p2 span { background: var(--p2-bg); color: var(--p2); }
.step4.p3 span { background: var(--p3-bg); color: var(--p3); } .step4.p4 span { background: var(--p4-bg); color: var(--p4); }
.section-title { font-size: 20px; font-weight: 800; margin: 34px 0 14px; }
.browse { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .browse { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .browse { grid-template-columns: repeat(3, 1fr); } }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.bcard__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bcard__ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: var(--accent-2); font-size: 18px; }
.bcard h3 { font-size: 15px; }
.bcard__count { font-size: 12px; color: var(--muted); }
.bcard ul { list-style: none; margin: 0; padding: 0; }
.bcard li button { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.bcard li button:hover { background: var(--surface-2); color: var(--text); }
.bcard li button .dot { margin-left: auto; }

/* ---------- Risk badges ---------- */
.lvl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.lvl::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.lvl-low { color: var(--low); background: var(--low-bg); }
.lvl-mid { color: var(--mid); background: var(--mid-bg); }
.lvl-high { color: var(--high); background: var(--high-bg); }
.lvl-crit { color: var(--crit); background: var(--crit-bg); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.low { background: var(--low); } .dot.mid { background: var(--mid); } .dot.high { background: var(--high); } .dot.crit { background: var(--crit); }

/* ---------- Picker (did you mean) ---------- */
.picker { margin: 28px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.picker h2 { font-size: 18px; margin-bottom: 4px; }
.picker__list { display: grid; gap: 8px; margin-top: 14px; }
@media (min-width: 700px) { .picker__list { grid-template-columns: 1fr 1fr; } }
.picker__item { text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; transition: border-color .2s, transform .15s; }
.picker__item:hover { border-color: var(--accent); transform: translateY(-1px); }
.picker__item b { display: block; font-size: 14px; }
.picker__item small { color: var(--muted); font-size: 12px; }

/* ---------- Result ---------- */
.result { padding: 28px 0 40px; animation: rise .45s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.summary { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.summary__top { padding: 20px; display: grid; gap: 18px; }
@media (min-width: 900px) { .summary__top { grid-template-columns: 1.3fr 1fr; padding: 26px; align-items: center; } }
.crumb { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.summary h2 { font-size: clamp(21px, 3.4vw, 28px); font-weight: 800; margin: 6px 0 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); padding: 5px 10px; border-radius: 8px; }
.tag svg { font-size: 14px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat__label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat__val { font-size: 26px; font-weight: 800; line-height: 1.1; margin-top: 4px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stat__val .lvl { font-size: 11px; }
.dist { border-top: 1px solid var(--line); padding: 16px 20px 20px; display: grid; gap: 12px; }
@media (min-width: 900px) { .dist { padding: 18px 26px 24px; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 24px; } }
.dist__row { display: grid; gap: 6px; }
.dist__label { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.bar span { height: 100%; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar .low { background: var(--low); } .bar .mid { background: var(--mid); } .bar .high { background: var(--high); } .bar .crit { background: var(--crit); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* toolbar */
.toolbar { position: sticky; top: 60px; z-index: 20; margin: 18px -16px 0; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.toolbar.stuck { border-bottom-color: var(--line); }
@media (min-width: 640px) { .toolbar { margin: 18px -24px 0; padding: 10px 24px; } }
.toolbar__row { display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.toolbar__row::-webkit-scrollbar { display: none; }
.toolbar__row + .toolbar__row { margin-top: 8px; }
.tlabel { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; flex: none; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; transition: all .15s; }
.pill:hover { border-color: var(--muted); }
.pill .num { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; font-size: 11px; font-weight: 800; }
.pill[aria-pressed="false"] { opacity: .5; }
.pill[aria-pressed="false"] .num { filter: grayscale(1); }
.pill.pp1 .num { background: var(--p1-bg); color: var(--p1); } .pill.pp2 .num { background: var(--p2-bg); color: var(--p2); }
.pill.pp3 .num { background: var(--p3-bg); color: var(--p3); } .pill.pp4 .num { background: var(--p4-bg); color: var(--p4); }
.pill.lv[aria-pressed="true"] { border-color: currentColor; }
.pill.lv.low { color: var(--low); } .pill.lv.mid { color: var(--mid); } .pill.lv.high { color: var(--high); } .pill.lv.crit { color: var(--crit); }
.pill.ghost { margin-left: auto; }
.pill.ghost svg { font-size: 14px; }
.tsep { width: 1px; height: 22px; background: var(--line); flex: none; margin: 0 4px; }

/* steps timeline */
.timeline { margin-top: 18px; display: grid; gap: 16px; }
.tstep { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.tstep__head { width: 100%; border: 0; background: none; text-align: left; display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.tstep__num { flex: none; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.tstep__title { flex: 1; min-width: 0; }
.tstep__title small { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.tstep__title b { font-size: 16px; font-weight: 700; }
.tstep__meta { display: none; gap: 6px; align-items: center; }
@media (min-width: 700px) { .tstep__meta { display: flex; } }
.tstep__chev { font-size: 20px; color: var(--muted); transition: transform .25s; }
.tstep.collapsed .tstep__chev { transform: rotate(-90deg); }
.tstep.collapsed .tstep__body { display: none; }
.tstep__body { padding: 0 12px 14px; display: grid; gap: 14px; }
@media (min-width: 640px) { .tstep__body { padding: 0 18px 18px; } }
.tstep.hidden { display: none; }

/* hazard card */
.hz { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); position: relative; }
.hz::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--lc, var(--muted)); }
.hz.low { --lc: var(--low); } .hz.mid { --lc: var(--mid); } .hz.high { --lc: var(--high); } .hz.crit { --lc: var(--crit); }
.hz.hidden { display: none; }
.hz__head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hz__ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); font-size: 18px; color: var(--lc); }
.hz__src { flex: 1; min-width: 140px; }
.hz__src small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.hz__src b { font-size: 14.5px; }
.hz__badges { display: flex; gap: 6px; flex-wrap: wrap; }

.hz__grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 760px) { .hz__grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .hz__grid { grid-template-columns: 1fr 1fr 1.15fr; } }
.pnl { padding: 14px 16px 16px 18px; border-bottom: 1px solid var(--line); }
@media (min-width: 760px) { .pnl { border-right: 1px solid var(--line); } }
.pnl.hidden { display: none; }
.pnl__h { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.pnl__h .num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; }
.pnl.p1 .pnl__h { color: var(--p1); } .pnl.p1 .num { background: var(--p1-bg); }
.pnl.p2 .pnl__h { color: var(--p2); } .pnl.p2 .num { background: var(--p2-bg); }
.pnl.p3 .pnl__h { color: var(--p3); } .pnl.p3 .num { background: var(--p3-bg); }
.pnl.p4 .pnl__h { color: var(--p4); } .pnl.p4 .num { background: var(--p4-bg); }
.pnl__txt { font-size: 14.5px; font-weight: 500; }
.pnl__kv { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.kv { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; color: var(--text-2); }
.kv b { color: var(--text); font-weight: 700; }

/* assessment */
.assess { display: flex; gap: 14px; align-items: center; }
.mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; width: 92px; flex: none; }
.mini i { aspect-ratio: 1; border-radius: 3px; opacity: .28; }
.mini i.on { opacity: 1; outline: 2px solid var(--text); outline-offset: 1px; position: relative; z-index: 1; }
.mini i.low { background: var(--low); } .mini i.mid { background: var(--mid); } .mini i.high { background: var(--high); } .mini i.crit { background: var(--crit); }
.calc { font-size: 13px; color: var(--text-2); }
.calc .eq { font-size: 22px; font-weight: 800; color: var(--text); display: block; line-height: 1.2; }
.calc .eq small { font-size: 13px; font-weight: 600; color: var(--muted); }
.flow { display: flex; align-items: stretch; gap: 6px; margin-top: 12px; }
.flow__box { flex: 1; border-radius: 10px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.flow__box small { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.flow__box b { font-size: 17px; font-weight: 800; display: block; }
.flow__box.low b { color: var(--low); } .flow__box.mid b { color: var(--mid); } .flow__box.high b { color: var(--high); } .flow__box.crit b { color: var(--crit); }
.flow__arrow { align-self: center; color: var(--muted); font-size: 16px; }
.reduce { margin-top: 10px; font-size: 12.5px; color: var(--low); font-weight: 700; display: flex; align-items: center; gap: 6px; }

/* controls */
.pnl.p4 { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
@media (min-width: 760px) and (max-width: 1079px) { .pnl.p3 { grid-column: 1 / -1; border-right: 0; } }
@media (min-width: 1080px) { .pnl.p3 { border-right: 0; } }
.ctrls { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .ctrls { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .ctrls { grid-template-columns: repeat(4, 1fr); } }
.ctrl { border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 10px 12px; }
.ctrl__h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ctrl__ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 14px; color: #fff; }
.ctrl__name { font-size: 12.5px; font-weight: 800; flex: 1; }
.ctrl__k { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.ctrl ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.ctrl li { position: relative; padding-left: 16px; font-size: 13px; color: var(--text-2); }
.ctrl li::before { content: ""; position: absolute; left: 3px; top: 8px; width: 6px; height: 6px; border-radius: 2px; background: var(--cc); }
.ctrl.eng { --cc: #2563eb; } .ctrl.eng .ctrl__ico { background: #2563eb; }
.ctrl.adm { --cc: #7c3aed; } .ctrl.adm .ctrl__ico { background: #7c3aed; }
.ctrl.prk { --cc: #0d9488; } .ctrl.prk .ctrl__ico { background: #0d9488; }
.ctrl.apd { --cc: #ea580c; } .ctrl.apd .ctrl__ico { background: #ea580c; }

/* extra */
.hz__more { border-top: 1px solid var(--line); }
.hz__more > summary { list-style: none; cursor: pointer; padding: 10px 18px; font-size: 12.5px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.hz__more > summary::-webkit-details-marker { display: none; }
.hz__more > summary svg { transition: transform .2s; }
.hz__more[open] > summary svg { transform: rotate(90deg); }
.hz__more > summary:hover { color: var(--text); }
.more__body { padding: 0 18px 16px; display: grid; gap: 14px; }
@media (min-width: 760px) { .more__body { grid-template-columns: 1fr 1fr; } }
.more__h { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ofi { font-size: 13.5px; color: var(--text-2); }
.ofi .kv { margin-top: 8px; display: inline-block; margin-right: 4px; }
.regs { display: flex; flex-wrap: wrap; gap: 6px; }
.reg { font-size: 12px; padding: 4px 9px; border-radius: 7px; background: var(--p3-bg); color: var(--p3); font-weight: 600; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { font-size: 44px; margin-bottom: 8px; color: var(--line); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(5, 12, 24, .6); backdrop-filter: blur(3px); }
.modal__dialog { position: relative; background: var(--surface); border-radius: 20px; padding: 22px; width: 100%; max-width: 760px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: rise .25s ease; }
.modal__dialog h2 { font-size: 20px; font-weight: 800; }
.modal__close { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; }
.mx { margin-top: 16px; overflow-x: auto; }
.mx table { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 480px; font-size: 12.5px; }
.mx th { font-weight: 700; color: var(--text-2); padding: 6px; text-align: center; }
.mx th.row { text-align: right; white-space: nowrap; }
.mx td { text-align: center; font-weight: 800; color: #fff; border-radius: 8px; height: 42px; font-size: 15px; }
.mx td.low { background: var(--low); } .mx td.mid { background: var(--mid); } .mx td.high { background: var(--high); } .mx td.crit { background: var(--crit); }
.cat-list { display: grid; gap: 8px; margin-top: 18px; }
.cat { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.cat p { font-size: 13px; color: var(--text-2); grid-column: 2; }
.cat b { font-size: 13.5px; }
.hier { display: grid; gap: 8px; margin-top: 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 600px) { .hier { grid-template-columns: repeat(4, 1fr); } }
.modal h3 { font-size: 15px; margin-top: 22px; }

/* ---------- Footer / misc ---------- */
.footer { border-top: 1px solid var(--line); padding: 22px 0 30px; color: var(--muted); font-size: 12.5px; margin-top: 20px; }
.to-top { position: fixed; right: 16px; bottom: 16px; z-index: 30; width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--brand); color: #fff; box-shadow: var(--shadow-lg); display: grid; place-items: center; font-size: 22px; }
.to-top[hidden] { display: none; }

/* ---------- Print ---------- */
@media print {
  .topbar, .hero, .toolbar, .footer, .to-top, .welcome, .hz__more > summary svg { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .result { padding: 0; animation: none; }
  .summary, .tstep, .hz { box-shadow: none; break-inside: avoid-page; }
  .hz { break-inside: avoid; }
  .tstep.collapsed .tstep__body { display: grid; }
  .hz__more { display: block; }
  .hz__more .more__body { display: grid !important; }
}

/* grid overflow guards */
.tstep__body > *, .hz__grid > *, .ctrls > * { min-width: 0; }
.flow__box small { overflow: hidden; text-overflow: ellipsis; }
.pnl__txt, .ctrl li, .ofi { overflow-wrap: anywhere; }
.search__clear[hidden] { display: none; }
