/* Дизайн B «Помощник» (design/DESIGN_B.md): белые блоки на светло-сером фоне, без рамок и теней,
   одна синяя кнопка на экран, остальное ссылками. Шрифт Onest — свои файлы в /fonts. */
@import url("/fonts/onest.css");

:root {
  --bg: #F4F5F7; --card: #FFFFFF; --text: #15181E; --muted: #586070; --line: #DDE2E9; --edge: #C8D0DC;
  --accent: #2457D6; --accent-press: #1A3F9E; --accent-soft: #E3EAFB; --accent-ink: #FFFFFF;
  --warn-bg: #FFF3E0; --warn-ink: #6B3A00; --warn-link: #8A4500; --ok: #1E7F45; --danger: #B42318;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 Onest, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
a:hover { color: var(--accent-press); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
body.pending main, body.pending .app { visibility: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- общие элементы ----------------------------------------------------------- */
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 24px; }
.card { background: var(--card); border-radius: 20px; padding: 20px; margin-bottom: 14px; }
.step { font-weight: 700; font-size: 17px; margin: 0 0 12px; }
.step span { color: var(--muted); font-weight: 400; }
.hint { color: var(--muted); font-size: 14px; margin-top: 10px; }
.err { color: var(--danger); margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 14px 22px;
       background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 16px; font-size: 17px; font-weight: 700;
       cursor: pointer; text-decoration: none; }
.btn:hover { color: var(--accent-ink); background: var(--accent-press); }
.btn:active { background: var(--accent-press); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.wide { width: 100%; }
.btn.ghost, .btn.plain { background: var(--card); color: var(--text); font-weight: 600; }
.btn.ghost:hover, .btn.plain:hover { background: var(--card); color: var(--accent); }
.link-btn { background: none; border: 0; padding: 12px 4px; min-height: 44px; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: none; }
.link-btn:hover { color: var(--accent-press); }
.link-btn.muted { color: var(--muted); font-weight: 500; }
.field, .input { width: 100%; font-size: 16px; padding: 13px 16px; border: 0; border-radius: 14px; background: var(--card);
                 color: var(--text); font-family: inherit; }
.field::placeholder, .input::placeholder { color: #7A8394; }
textarea.input { resize: vertical; }
progress { width: 100%; height: 6px; accent-color: var(--accent); }
.notice { background: var(--card); border-radius: 14px; padding: 12px 14px; font-size: 15px; margin-top: 12px; }
.warn-box { background: var(--warn-bg); color: var(--warn-ink); border-radius: 14px; padding: 14px 16px; }
.warn-box a, .warn-box .link-btn { color: var(--warn-link); }

/* шапка страниц */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 18px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 12px; font-size: 15px; font-weight: 500; }
.nav a.active, .nav a:hover { background: var(--card); color: var(--text); }
.user { display: flex; align-items: center; gap: 4px; font-size: 15px; }
.user a { color: var(--muted); text-decoration: none; padding: 10px 8px; }
.user a.me { color: var(--text); font-weight: 600; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--card); color: var(--text); display: inline-flex;
          align-items: center; justify-content: center; font-weight: 700; text-decoration: none; }

/* вход (B-Login) и аккаунт */
.auth { min-height: 100vh; max-width: 440px; margin: 0 auto; padding: 56px 20px 28px; display: flex; flex-direction: column; gap: 28px; }
.auth .logo { font-weight: 700; font-size: 34px; letter-spacing: -0.01em; }
.auth .tagline { margin: 10px 0 0; font-size: 17px; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: #E6E9EE; border-radius: 14px; padding: 4px; }
.seg button { font-size: 15px; font-weight: 500; padding: 11px 0; min-height: 44px; border-radius: 11px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--card); color: var(--text); font-weight: 600; }
.auth form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.auth label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.auth .field { font-size: 17px; padding: 15px 16px; }
.auth .btn { margin-top: 8px; width: 100%; }
.auth .link-btn { align-self: center; }
.auth .foot { margin: auto 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.auth .notice { margin: 0; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 420px; padding: 28px 24px; border-radius: 24px; }
.login h1 { font-size: 26px; margin-bottom: 4px; }
.login form, .login-inline form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.login .field, .login-inline .field { background: var(--bg); }
.login .btn, .login-inline .btn { width: 100%; margin-top: 4px; }
.login .notice { background: var(--bg); }
.login .hint a { font-weight: 600; }
.login-inline form { max-width: 420px; }

/* --- уникализатор ------------------------------------------------------------- */
#drop { background: var(--bg); border-radius: 16px; padding: 32px 16px; text-align: center; cursor: pointer; color: var(--muted); }
#drop.over { background: var(--accent-soft); color: var(--accent); }
#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.tile { border-radius: 14px; overflow: hidden; background: var(--bg); position: relative; }
.tile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.tile .bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; gap: 6px; }
.tile .num { position: absolute; top: 6px; left: 6px; background: rgba(21,24,30,.7); color: #fff; font-size: 12px; border-radius: 6px; padding: 1px 6px; }
.tile .x { position: absolute; top: 6px; right: 6px; background: rgba(21,24,30,.7); color: #fff; border: 0; border-radius: 8px; cursor: pointer; width: 28px; height: 28px; }
.tile.banner { outline: 3px solid #E8A04A; }
.toggle { border: 0; background: var(--card); color: var(--text); border-radius: 10px; padding: 8px; font-size: 14px; font-weight: 600; cursor: pointer; width: 100%; min-height: 36px; }
.tile.banner .toggle { background: var(--warn-bg); color: var(--warn-link); }
.moves { white-space: nowrap; }
.moves button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 4px; }
input[type=number] { width: 110px; font-size: 18px; padding: 12px; border: 0; border-radius: 14px; background: var(--bg); color: var(--text); font-family: inherit; }
@media (max-width: 480px) { #grid { grid-template-columns: repeat(2, 1fr); } }

/* --- помощник: главная --------------------------------------------------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.home { width: 100%; max-width: 640px; margin: 0 auto; padding: 20px 20px 32px; display: flex; flex-direction: column; gap: 24px; flex: 1; }
.home h1 { font-size: 30px; margin: 0; }
.dir-card { background: var(--card); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dir-card .dir-name { font-size: 15px; color: var(--muted); }
.dir-card .dir-status { font-size: 22px; font-weight: 700; line-height: 1.25; }
.dir-card .link-btn { align-self: center; }
.services { display: flex; flex-direction: column; gap: 14px; }
.section-label { font-size: 15px; font-weight: 600; color: var(--muted); padding: 0 4px; margin-bottom: -4px; }
.last { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; }
.last .label { font-size: 15px; color: var(--muted); }
.last .what { font-size: 17px; font-weight: 600; }
.home-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* --- помощник: переписка -------------------------------------------------------- */
.chat-head { padding: 12px 16px 10px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.chat-head .bar-row { display: flex; align-items: center; gap: 8px; max-width: 640px; width: 100%; margin: 0 auto; }
.back { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); border-radius: 50%; flex: none; }
.back:hover { background: var(--card); color: var(--text); }
.chat-title { flex: 1; text-align: center; font-size: 15px; color: var(--muted); }
.chat-title b { color: var(--text); font-weight: 600; }
.head-spacer { width: 44px; flex: none; }
.progress { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; max-width: 640px; width: 100%; margin: 0 auto; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.chat { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 14px 16px; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; background: var(--card); border-radius: 6px 20px 20px 20px; }
.msg.bot.q { font-weight: 600; font-size: 17px; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-radius: 20px 6px 20px 20px; font-weight: 500; white-space: pre-line; }
.msg.warn { background: var(--warn-bg); color: var(--warn-ink); }
.msg.warn a, .msg.warn .link-btn { color: var(--warn-link); }
.msg .small { display: block; font-size: 14px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.msg.me .more { opacity: .8; }
.msg .examples { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; color: var(--muted); font-size: 15px; font-weight: 400; }
.msg .link-btn { padding: 6px 0; min-height: 0; }
.msg.done { align-self: stretch; max-width: none; border-radius: 16px; display: flex; flex-direction: column; gap: 6px; }
.msg.done .ok-line { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.check { width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.photos-msg { align-self: flex-end; width: min(300px, 85%); background: var(--accent); padding: 6px; border-radius: 20px 6px 20px 20px;
              display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.ph { position: relative; aspect-ratio: 1 / 1; border-radius: 6px; overflow: hidden; background: #C9D3E6; border: 0; padding: 0; cursor: pointer; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .tag { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); font-size: 11px; font-weight: 600; background: #fff;
           color: var(--warn-link); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.ph .n { position: absolute; left: 4px; top: 4px; font-size: 11px; font-weight: 700; background: rgba(21,24,30,.65); color: #fff; padding: 0 5px; border-radius: 5px; }
.typing { align-self: flex-start; color: var(--muted); font-size: 14px; padding: 4px 6px; }

/* ответы внизу */
.answers { position: sticky; bottom: 0; background: var(--bg); padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); }
.answers-in { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.opt { width: 100%; text-align: left; padding: 16px 18px; min-height: 52px; border-radius: 18px; border: 0; background: var(--card); color: var(--text);
       cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: 17px; font-weight: 600; }
.opt:hover { background: var(--accent-soft); }
.opt .opt-sub { font-size: 14px; color: var(--muted); font-weight: 400; }
.opt.text { background: transparent; color: var(--accent); }
.opt.text:hover { background: var(--card); }
.opts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.opts-grid .opt { text-align: center; align-items: center; justify-content: center; }
.opts-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt.primary { background: var(--accent); color: #fff; }
.opt.primary:hover { background: var(--accent-press); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 15px; font-weight: 600; padding: 11px 16px; min-height: 44px; border-radius: 999px; border: 1px solid var(--edge); background: var(--card);
        color: var(--text); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer label { flex: 1; display: flex; background: var(--card); border-radius: 22px; padding: 0 16px; }
.composer textarea { font: inherit; font-size: 16px; border: 0; outline: 0; padding: 13px 0; flex: 1; min-width: 0; background: transparent; color: var(--text);
                     resize: none; max-height: 40vh; line-height: 1.4; }
.send { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: inline-flex; align-items: center;
        justify-content: center; cursor: pointer; flex: none; }
.send:hover { background: var(--accent-press); }
.send:disabled { opacity: .45; cursor: not-allowed; }
.attach { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--card); color: var(--text); display: inline-flex;
          align-items: center; justify-content: center; cursor: pointer; flex: none; }
.answers .note { font-size: 13px; color: var(--muted); text-align: center; }

/* готово */
.done-top { background: var(--card); padding: 32px 20px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.done-top h1 { margin: 0; font-size: 26px; }
.done-top p { margin: 0; color: var(--muted); }
.done-top .btn { width: 100%; max-width: 420px; margin-top: 8px; }
.big-check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; display: flex; align-items: center; justify-content: center; }
.done-body { width: 100%; max-width: 640px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.how { background: var(--card); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.how b { font-size: 16px; }
.how-step { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.how-step span:first-child { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
                             display: flex; align-items: center; justify-content: center; flex: none; }
.warn-box { display: flex; gap: 12px; align-items: flex-start; }
.warn-box ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.done-links { display: flex; gap: 8px; }
.done-links a { flex: 1; text-align: center; text-decoration: none; font-weight: 600; font-size: 15px; padding: 14px; border-radius: 14px; background: var(--card); color: var(--text); }

/* настройки направления */
.set-group { background: var(--card); border-radius: 20px; padding: 6px 0; margin-bottom: 14px; }
.set-group h2 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 12px 20px 4px; }
.set-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; min-height: 56px; background: none; border: 0;
           text-align: left; cursor: pointer; }
.set-row:hover { background: var(--bg); }
.set-row .k { font-weight: 600; }
.set-row .v { color: var(--muted); font-size: 15px; text-align: right; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-row .v.empty { color: var(--accent); }
.set-edit { padding: 4px 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.set-edit .input { background: var(--bg); }
.set-edit .hint { margin: 0; }
.list-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 20px; font-size: 15px; }
.list-item span { flex: 1; white-space: pre-line; overflow-wrap: anywhere; }
.list-item button { border: 0; background: none; color: var(--muted); cursor: pointer; width: 36px; height: 36px; border-radius: 50%; flex: none; }
.list-item button:hover { background: var(--bg); color: var(--danger); }

@media (min-width: 720px) {
  .msg { font-size: 17px; padding: 16px 18px; }
  .msg.bot.q { font-size: 18px; }
  .answers-in .opts-row { display: flex; gap: 10px; flex-wrap: wrap; }
  .answers-in .opts-row .opt { flex: 1 1 200px; }
}
