/* ИИ-гид на весь экран: раскладка фронта B2C (история, разговор, панель сведений). Общие стили в site.css */
html, body.gid { height: 100%; }
body.gid { overflow: hidden; }
.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 280px minmax(0, 1fr) 0; grid-template-rows: 64px minmax(0, 1fr); grid-template-areas: "tb tb tb" "side main panel"; }
.app.with-panel { grid-template-columns: 280px minmax(0, 1fr) min(480px, 40vw); }

/* ---------- Верхняя строка ---------- */
.tb { grid-area: tb; display: flex; align-items: center; gap: 12px; padding: 0 20px 0 12px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.tb__back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 10px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap; transition: background-color .2s; }
.tb__back:hover { background: var(--sunk); color: var(--ink); }
.tb__hist { display: none; }
.tb__title { display: flex; align-items: baseline; gap: 10px; min-width: 0; font-size: 20px; letter-spacing: -.03em; white-space: nowrap; }
.tb__title span { font: 400 13px/1 var(--text); letter-spacing: 0; color: var(--muted); }
.tb .status { margin-left: auto; }
.tb__rules { font-size: 14px; }

/* ---------- История ---------- */
.side { grid-area: side; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.side__top { padding: 16px 16px 8px; }
.side__list { flex: 1; overflow: auto; padding: 8px 10px 16px; overscroll-behavior: contain; }
.side__grp { margin: 14px 8px 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.hi { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px; border-radius: var(--r-sm); transition: background-color .2s; }
.hi:hover { background: var(--sunk); }
.hi[aria-current="true"] { background: var(--sea-soft); }
.hi a { display: grid; gap: 2px; min-width: 0; padding: 10px 4px 10px 12px; }
.hi b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi small { font-size: 12px; color: var(--muted); }
.hi .ib { width: 36px; height: 36px; margin-right: 4px; color: var(--muted); opacity: 0; }
.hi:hover .ib, .hi:focus-within .ib { opacity: 1; }
.side__empty { margin: 16px 10px; font-size: 14px; color: var(--muted); }
.side__foot { display: grid; gap: 6px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.lnk-btn { justify-self: start; padding: 4px 0; border: 0; background: none; color: var(--sea); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Разговор ---------- */
.main { grid-area: main; display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.main:focus { outline: 0; }
.feed { flex: 1; overflow: auto; overscroll-behavior: contain; }
.feed__in { max-width: 820px; margin: 0 auto; padding: 32px 24px 20px; display: grid; gap: 20px; }
.conv { display: grid; gap: 20px; }
.turn { display: grid; gap: 12px; }
.turn .bub--u { max-width: 78%; }
.turn .ans { max-width: 100%; background: transparent; padding: 0; border-radius: 0; font-size: 16px; line-height: 1.6; }
.turn .ans-reg li, .turn .ans-co { background: var(--surface); border: 1px solid var(--line); }
.turn .srcs { font-size: 13px; }
.turn.is-new { animation: swap .2s var(--ease) both; }
.pbtn { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--sea); text-align: left; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.pbtn:hover { text-decoration-thickness: 2px; }
.masked { font-size: 13px; color: var(--muted); }

/* ---------- Приветствие ---------- */
.welcome { display: grid; gap: 20px; padding-top: clamp(8px, 3vh, 32px); }
.welcome h2 { font-size: clamp(36px, 4.6vw, 56px); line-height: 1; letter-spacing: -.045em; }
.welcome > p:not(.note) { max-width: 60ch; font-size: 18px; color: var(--ink-2); }
.welcome__h { margin-top: 8px; font: 600 15px/1.3 var(--text); letter-spacing: 0; color: var(--muted); }
.scen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sc2 { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: border-color .2s; }
.sc2:hover { border-color: var(--control); }
.sc2 picture, .sc2 img, .sc2__ic { width: 72px; height: 72px; border-radius: var(--r-sm); }
.sc2 img { object-fit: cover; }
.sc2__ic { display: grid; place-items: center; background: var(--sea-soft); color: var(--sea); }
.sc2__ic .i { width: 28px; height: 28px; }
.sc2 b { display: block; font-weight: 600; }
.sc2 span span { display: block; font-size: 14px; line-height: 1.4; color: var(--muted); }

/* ---------- Поле внизу ---------- */
.dock { width: 100%; max-width: 820px; margin: 0 auto; display: grid; gap: 8px; padding: 8px 24px calc(12px + env(safe-area-inset-bottom, 0px)); }
.cmp2 { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 18px; border: 1.5px solid var(--control); border-radius: var(--r-md); background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.cmp2:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.cmp2 textarea { flex: 1; min-width: 0; max-height: 180px; padding: 11px 0; border: 0; outline: 0; resize: none; background: transparent; font-size: 16px; line-height: 1.45; }
.cmp2 textarea::placeholder { color: var(--muted); opacity: 1; }
.cmp2 .send { width: 48px; height: 48px; }
.dock__note { font-size: 13px; line-height: 1.45; color: var(--muted); text-align: center; }

/* ---------- Панель сведений о компании ---------- */
.pp { grid-area: panel; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.pp__bar { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--line); }
.pp__bar b { margin-right: auto; font-weight: 600; }
.pp__in { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 20px; display: grid; gap: 18px; align-content: start; }
.pp h2 { font-size: 26px; line-height: 1.1; letter-spacing: -.035em; }
.pp__marks { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: var(--r-sm); background: var(--sunk); }
.pp-tabs button { min-height: 40px; border: 0; border-radius: var(--r-xs); background: none; font-weight: 600; font-size: 14px; color: var(--muted); }
.pp-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.pp .facts-dl { font-size: 14px; }
.pp .facts-dl dd { overflow-wrap: anywhere; }
.pp .facts-dl a, .pp__src a { color: var(--sea); text-decoration: underline; text-underline-offset: 2px; }
.pp__src { display: grid; gap: 8px; padding-left: 20px; list-style: decimal; font-size: 14px; }
.pp__foot { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* ---------- Полотно справа от разговора (задание 3, Д3): проверка, поездка сорвалась, маршрут ---------- */
.app.with-canvas { grid-template-columns: 280px 440px minmax(0, 1fr); grid-template-areas: "tb tb tb" "side main canvas"; }
.app.with-canvas .feed__in, .app.with-canvas .dock { max-width: none; }
.cv { grid-area: canvas; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); border-left: 1px solid var(--line); }
.cv:focus { outline: 0; }
.cv__bar { display: none; }
.cv__in { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 28px clamp(20px, 2.6vw, 40px) 40px; display: grid; gap: 16px; align-content: start; }
.app.with-canvas .pp { grid-area: canvas; z-index: 3; }
.cv-head { display: flex; align-items: center; gap: 14px; }
.cv-head small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.cv-title { font-size: clamp(22px, 2vw, 28px); line-height: 1.1; letter-spacing: -.03em; }
.ring { width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--sea) var(--p), var(--line) 0); }
.ring span { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font: 800 13px/1 var(--display); }
.chk { display: grid; padding: 4px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.chk__i { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.chk__i:last-child { border-bottom: 0; }
.chk .m { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.chk .m .i { width: 14px; height: 14px; stroke-width: 2.6; }
.chk__i--no .m { background: var(--warn-soft); color: var(--warn); }
.chk__i--neutral .m { background: var(--sunk); color: var(--muted); }
.chk small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.chk b { font-weight: 600; overflow-wrap: anywhere; }
.chk a { color: var(--sea); text-decoration: underline; text-underline-offset: 2px; }
.verdict { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: var(--r-md); background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.verdict .i { flex: none; width: 20px; height: 20px; stroke-width: 2.4; margin-top: 1px; }
.incl { display: grid; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 14px; }
.incl b { font-size: 13px; color: var(--muted); }
.incl b:not(:first-child) { margin-top: 6px; }
.incl ul { display: grid; gap: 4px; }
.incl li { position: relative; padding-left: 16px; }
.incl li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 7px; height: 2px; background: var(--control); }
.cv-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.forks { display: grid; gap: 10px; }
.fork { display: grid; gap: 6px; }
.fork__l { font-size: 13px; font-weight: 600; color: var(--muted); }
.fork__o { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: var(--r-sm); background: var(--sunk); }
.fork__o button { min-height: 44px; border: 0; border-radius: var(--r-xs); background: none; font-size: 14px; font-weight: 600; color: var(--muted); }
.fork__o button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.bignum { display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.bignum b { font: 800 clamp(30px, 3vw, 40px)/1 var(--display); letter-spacing: -.03em; }
.bignum span { color: var(--ink-2); }
.cv-steps { display: grid; gap: 10px; padding-left: 22px; list-style: decimal; line-height: 1.55; }
.cv-steps li::marker { font-weight: 700; color: var(--ink-2); }
.cv-steps a { color: var(--sea); text-decoration: underline; text-underline-offset: 2px; }
.calls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.call { display: grid; gap: 4px; min-height: 44px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: border-color .2s; }
.call:hover { border-color: var(--control); }
.call b { font-size: 19px; font-variant-numeric: tabular-nums; color: var(--sea); }
.call small { font-size: 13px; line-height: 1.4; color: var(--muted); }
.cv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 24px; align-items: start; }
.tl { position: relative; display: grid; gap: 14px; }
.tl::before { content: ""; position: absolute; left: 19px; top: 14px; bottom: 14px; width: 2px; background: var(--line); }
.tl__row { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; }
.tl__n { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font: 800 15px/1 var(--display); z-index: 1; }
.tl__card { display: grid; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 14px; line-height: 1.5; }
.tl__card img { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-sm); object-fit: cover; }
.tl__card b { display: block; margin-bottom: 4px; font-size: 15px; }
.tl__card ul { display: grid; gap: 4px; color: var(--ink-2); }
.cv-side { display: grid; gap: 14px; position: sticky; top: 0; }
.mapx { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--sea-soft); }
.mapx polyline { fill: none; stroke: var(--sea); stroke-width: 2.5; stroke-dasharray: 6 5; }
.mapx circle { fill: var(--ink); }
.mapx .n { fill: #fff; font: 800 11px var(--display); text-anchor: middle; }
.mapx .l { fill: var(--ink); font: 600 10.5px var(--text); text-anchor: middle; }
.stay2 { display: grid; gap: 8px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 14px; }
.stay2 > b { font-size: 13px; color: var(--muted); }
.stay2 ul { display: grid; gap: 8px; }
.stay2 li { display: grid; gap: 2px; }
.stay2 li span { font-weight: 600; }
.stay2 small { color: var(--ink-2); }
.stay2 a { color: var(--sea); text-decoration: underline; text-underline-offset: 2px; }

/* Полоска полотна на узком экране */
.cvbar { flex: none; padding: 8px 12px 0; }
.cvbar button { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; text-align: left; box-shadow: var(--sh-1); }
.cvbar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cvbar b { flex: none; color: var(--sea); }

/* Приветствие: четыре главные кнопки и все примеры под раскрытием */
.prim { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prim__b { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: center; min-height: 72px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: border-color .2s; }
.prim__b:hover { border-color: var(--control); }
.prim__ic { width: 48px; height: 48px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--sea-soft); color: var(--sea); }
.prim__b b { display: block; font-weight: 600; }
.prim__b span span { display: block; font-size: 14px; line-height: 1.4; color: var(--muted); }
.more-ex summary { cursor: pointer; font-weight: 600; color: var(--sea); text-decoration: underline; text-underline-offset: 3px; }
.more-ex[open] summary { margin-bottom: 8px; }

/* Ответы без JavaScript */
.js .nojs { display: none; }
.nojs { display: grid; gap: 10px; margin-top: 24px; }
.nojs h2 { font-size: 24px; }
.nojs__i { padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.nojs__i summary { cursor: pointer; font-weight: 600; }
.nojs__i .ans { margin-top: 12px; max-width: 100%; }

.scrim { position: fixed; inset: 0; z-index: 85; background: rgba(var(--shade), .42); opacity: 0; transition: opacity .25s var(--ease); }
.scrim.open { opacity: 1; }

/* ---------- Узкие экраны ---------- */
@media (max-width: 1279px) {
  .app.with-canvas { grid-template-columns: 280px minmax(0, 1fr) 0; grid-template-areas: "tb tb tb" "side main panel"; }
  .cv { position: fixed; left: 0; right: 0; bottom: 0; z-index: 92; height: 88svh; border-left: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--bg); transform: translateY(104%); visibility: hidden; transition: transform .3s var(--ease-emph), visibility 0s linear .3s; box-shadow: var(--sh-3); }
  .cv.open { transform: none; visibility: visible; transition: transform .3s var(--ease-emph), visibility 0s; }
  .cv__bar { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--line); }
  .cv__bar b { margin-right: auto; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cv__in { padding: 18px 16px 32px; }
  .cv-grid { grid-template-columns: minmax(0, 1fr); }
  .cv-side { position: static; }
}
@media (max-width: 1023px) {
  .app, .app.with-panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: 60px minmax(0, 1fr); grid-template-areas: "tb" "main"; }
  .tb { padding: 0 8px; gap: 6px; }
  .tb__hist { display: grid; }
  .tb__back span, .tb__title span, .tb__rules { display: none; }
  .tb__back { padding: 0 10px; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 92; width: min(320px, 86vw); padding-top: env(safe-area-inset-top, 0px); transform: translateX(-104%); visibility: hidden; transition: transform .3s var(--ease-emph), visibility 0s linear .3s; box-shadow: var(--sh-3); }
  .side.open { transform: none; visibility: visible; transition: transform .3s var(--ease-emph), visibility 0s; }
  .pp { position: fixed; left: 0; right: 0; bottom: 0; z-index: 92; height: 86svh; border-left: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(104%); visibility: hidden; transition: transform .3s var(--ease-emph), visibility 0s linear .3s; box-shadow: var(--sh-3); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .pp.open { transform: none; visibility: visible; transition: transform .3s var(--ease-emph), visibility 0s; }
}
@media (max-width: 640px) {
  .feed__in { padding: 20px 14px 12px; gap: 16px; }
  .dock { padding: 6px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .turn .bub--u { max-width: 88%; }
  .scen, .prim { grid-template-columns: minmax(0, 1fr); }
  .tb__title { font-size: 18px; }
}
