/* ясно. — setup checklist, the AI assistant chat, one-time credentials.
   Uses the tokens of style.css only (both themes follow them). */

/* ---------- one-time credentials (team, assistant) ---------- */
.creds-dialog { width: min(520px, calc(100vw - 32px)); }
.creds { display: grid; gap: 8px; }
.creds-row {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 8px 8px 8px 12px; border-radius: var(--r-md); background: var(--sunken);
}
.creds-row > span { font: 500 12px/16px var(--font); color: var(--ink-3); }
.creds-row code { font: 600 14px/20px var(--mono); color: var(--ink); overflow-wrap: anywhere; user-select: all; }

/* ---------- setup checklist ---------- */
.setup-progress { display: flex; align-items: center; gap: 16px; padding: 20px 24px; }
.setup-progress .bar { flex: 1; height: 6px; border-radius: var(--r-xs); background: var(--sunken); overflow: hidden; }
.setup-progress .bar i { display: block; height: 100%; border-radius: var(--r-xs); background: var(--brand); transition: width var(--d3) var(--ease-out); }
.setup-progress b { font: 600 13px/20px var(--font); white-space: nowrap; }
.setup-list { display: grid; gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.setup-step {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 18px 20px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--e1);
}
.setup-step.is-next { box-shadow: var(--e2), inset 3px 0 0 var(--brand); }
.setup-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-lg);
  background: var(--sunken); color: var(--ink-3); font: 600 13px/1 var(--font);
}
.setup-step.is-done .setup-mark { background: var(--k-on-tint); color: var(--k-on-ink); }
.setup-step.is-next .setup-mark { background: var(--brand-50); color: var(--brand); }
.setup-text { min-width: 0; display: grid; gap: 2px; }
.setup-text b { font: 600 14px/20px var(--font); }
.setup-text p { font: 400 13px/20px var(--font); color: var(--ink-3); }
.setup-text .setup-count { font: 500 12px/16px var(--font); color: var(--k-on-ink); }
.setup-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.setup-name { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; max-width: 620px; }
.setup-name input.input { flex: 1 1 200px; }
.setup-name select.input { flex: 1 1 220px; }
.setup-name .input { height: 36px; }
.setup-done { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.setup-done .kchip { --k-tint: var(--k-on-tint); --k-ink: var(--k-on-ink); }

/* compact card on the dashboard */
.setup-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: center; padding: 18px 20px; margin-bottom: 20px; }
.setup-card-main { display: grid; gap: 10px; min-width: 0; }
.setup-card-main h2 { font: 600 15px/22px var(--font); }
.setup-card-main p { font: 400 13px/20px var(--font); color: var(--ink-3); }
.setup-card .bar { height: 6px; border-radius: var(--r-xs); background: var(--sunken); overflow: hidden; max-width: 420px; }
.setup-card .bar i { display: block; height: 100%; background: var(--brand); border-radius: var(--r-xs); }
.setup-card-actions { display: flex; gap: 8px; align-items: center; }

/* floating «Помощник» button */
.as-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px 0 14px;
  border: 0; border-radius: var(--r-lg); background: var(--brand); color: #fff;
  font: 600 14px/1 var(--font); box-shadow: var(--e3);
  transition: transform var(--d1) var(--ease), background var(--d1) var(--ease);
}
.as-fab:hover { background: var(--brand-700); }
.as-fab:active { transform: translateY(1px); }
.as-fab .ic { color: #fff; }

/* ---------- assistant chat ---------- */
.as-page { max-width: 980px; padding-bottom: 32px; }
.as-page-card { height: calc(100vh - 120px); min-height: 520px; overflow: hidden; position: relative; }
.as-drawer { width: min(560px, 100vw); }
.as-drawer-body { flex: 1; min-height: 0; display: flex; }
.as-drawer-body > .as-shell { flex: 1; }

.as-shell { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.as-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.as-head .spacer { flex: 1; }
.as-title { display: grid; min-width: 0; }
.as-title b { font: 600 15px/20px var(--font); }
.as-title small { font: 400 12px/16px var(--font); color: var(--ink-3); }

.as-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.as-msg { display: flex; gap: 10px; max-width: 100%; }
.as-user { flex-direction: column; align-items: flex-end; gap: 6px; }
.as-user .as-bubble { background: var(--brand); color: #fff; border-radius: var(--r-xl) var(--r-xl) var(--r-xs) var(--r-xl); }
.as-user .as-bubble code { background: rgba(255, 255, 255, .18); color: #fff; }
.as-bot { align-items: flex-start; }
.as-av { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: var(--r-md); background: var(--brand-50); color: var(--brand); }
.as-av .ic { width: 16px; height: 16px; }
.as-parts { display: grid; gap: 10px; min-width: 0; flex: 1; }
.as-bubble {
  max-width: min(620px, 100%); padding: 10px 14px; border-radius: var(--r-xs) var(--r-xl) var(--r-xl) var(--r-xl);
  background: var(--sunken); color: var(--ink); font: 400 14px/21px var(--font); overflow-wrap: anywhere;
}
.as-bot .as-bubble { justify-self: start; }
.as-bubble p + p, .as-bubble p + ul, .as-bubble ul + p { margin-top: 6px; }
.as-bubble ul { margin: 4px 0 0; padding-left: 18px; }
.as-bubble li + li { margin-top: 2px; }
.as-bubble code { font: 500 12px/18px var(--mono); padding: 1px 4px; border-radius: var(--r-xs); background: var(--surface); }
.as-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.as-file {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; max-width: 100%;
  border-radius: var(--r-md); background: var(--surface); box-shadow: var(--e1); font: 500 12px/1 var(--font); color: var(--ink-2);
}
.as-file small { color: var(--ink-3); font-weight: 400; }
.as-file .ic { color: var(--ink-3); }
.as-x { display: grid; place-items: center; width: 20px; height: 20px; margin-right: -4px; padding: 0; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--ink-3); }
.as-x:hover { background: var(--sunken); color: var(--ink); }
.as-action { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/16px var(--font); color: var(--ink-3); }
.as-err {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--r-lg);
  background: var(--k-else-tint); color: var(--k-else-ink); font: 400 13px/20px var(--font);
}
.as-err .ic { margin-top: 2px; flex: none; }

/* proposal card */
.as-card { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--e2); min-width: 0; }
.as-card-head { display: flex; align-items: center; gap: 8px; }
.as-card-head > .ic { color: var(--brand); }
.as-card-head b { font: 600 14px/20px var(--font); flex: 1; min-width: 0; }
.as-st { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-sm); font: 600 11px/1 var(--font); }
.as-st-ok { background: var(--k-on-tint); color: var(--k-on-ink); }
.as-st-off { background: var(--sunken); color: var(--ink-3); }
.as-st-bad { background: var(--k-else-tint); color: var(--k-else-ink); }
.as-sum { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font: 400 13px/20px var(--font); color: var(--ink-2); }
.as-table { overflow-x: auto; border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line); }
.as-table table { width: 100%; border-collapse: collapse; font: 400 12px/16px var(--font); }
.as-table th { text-align: left; font-weight: 600; color: var(--ink-3); background: var(--surface-2); padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.as-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--ink); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-table tr:last-child td { border-bottom: 0; }
.as-errors { font: 400 12px/18px var(--font); color: var(--k-else-ink); }
.as-errors summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; list-style: none; }
.as-errors summary::-webkit-details-marker { display: none; }
.as-errors ul { margin: 6px 0 0; padding-left: 18px; max-height: 160px; overflow-y: auto; }
.as-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.as-result { font: 500 13px/20px var(--font); color: var(--ink-2); }
.as-secret .creds-row { grid-template-columns: 64px minmax(0, 1fr); }

/* typing */
.as-dots { display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: var(--r-xs) var(--r-xl) var(--r-xl) var(--r-xl); background: var(--sunken); }
.as-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); animation: as-dot 1.2s infinite var(--ease); }
.as-dots i:nth-child(2) { animation-delay: .15s; }
.as-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes as-dot { 0%, 60%, 100% { transform: none; opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .as-dots i { animation: none; } }

/* empty state */
.as-empty { margin: auto 0; display: grid; justify-items: center; gap: 10px; padding: 24px 8px; text-align: center; }
.as-empty h3 { font: 600 18px/24px var(--font-display); }
.as-empty p { max-width: 460px; font: 400 14px/21px var(--font); color: var(--ink-2); }
.as-sugg { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.as-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 0; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--e1);
  font: 500 13px/1 var(--font); color: var(--ink-2);
}
.as-chip:hover { box-shadow: var(--e2); color: var(--ink); }
.as-chip .ic { color: var(--brand); }

/* composer */
.as-compose { display: grid; gap: 6px; padding: 12px 16px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
.as-pending { display: flex; flex-wrap: wrap; gap: 6px; }
.as-pending:empty { display: none; }
.as-row { display: flex; align-items: flex-end; gap: 8px; }
.as-compose .as-input { flex: 1; min-height: 40px; max-height: 160px; height: 40px; padding: 9px 12px; line-height: 20px; resize: none; }
.as-attach { cursor: pointer; }
.as-attach:has(input:disabled) { opacity: .5; cursor: default; }
.as-send { width: 40px; height: 40px; }
.as-hint { font: 400 11px/16px var(--font); color: var(--ink-3); }

.as-drop {
  position: absolute; inset: 8px; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 6px;
  border-radius: var(--r-xl); background: color-mix(in srgb, var(--brand-50) 92%, transparent);
  box-shadow: inset 0 0 0 2px var(--brand); color: var(--brand-800); pointer-events: none;
}
.as-drop .ic { width: 28px; height: 28px; color: var(--brand); }
.as-drop small { color: var(--ink-3); }

@media (max-width: 768px) {
  .setup-step { grid-template-columns: 32px minmax(0, 1fr); padding: 16px; }
  .setup-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .setup-card { grid-template-columns: 1fr; }
  .as-page { padding: 0; }
  .as-page-card { height: calc(100vh - 56px - 64px - env(safe-area-inset-bottom)); min-height: 420px; border-radius: 0; box-shadow: none; }
  .as-hide-sm { display: none; }
  .as-hint { display: none; }
  .as-log { padding: 16px 12px; }
  .as-fab { right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .as-drawer { border-radius: 0; }
}

/* links in answers, download buttons */
.as-link { color: var(--brand-700); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.as-user .as-link { color: #fff; }
.as-dl { justify-self: start; }

/* ---------- «Работа с предложениями» ---------- */
.offers-card .card-head { padding-bottom: 4px; }
.of-list { list-style: none; margin: 0; padding: 8px 12px 12px; display: grid; }
.of-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--r-md); }
.of-row + .of-row { border-top: 1px solid var(--line); border-radius: 0; }
.of-main { min-width: 0; display: grid; gap: 2px; }
.of-main b { font: 600 14px/20px var(--font); overflow-wrap: anywhere; }
.of-main small { font: 400 12px/16px var(--font); color: var(--ink-3); }
.of-main small a { color: var(--brand-700); font-weight: 600; }
.of-main p { font: 400 13px/19px var(--font); color: var(--ink-2); margin-top: 2px; }
.of-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--r-sm); font: 600 12px/1 var(--font); white-space: nowrap; }
.of-offered { background: var(--brand-50); color: var(--brand-800); }
.of-accepted { background: var(--k-on-tint); color: var(--k-on-ink); }
.of-declined { background: var(--k-else-tint); color: var(--k-else-ink); }
.of-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px 24px 4px; }
.of-stat { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--r-md); }
.of-stat strong { font: 650 22px/26px var(--font-display); }
.of-stat span { font: 500 12px/16px var(--font); }

/* ---------- Telegram bot settings ---------- */
.tg-card { margin-top: 20px; max-width: 720px; }
.tg-card .form-body > p { font: 400 14px/21px var(--font); color: var(--ink-2); }
.tg-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font: 400 14px/21px var(--font); color: var(--ink-2); }
.tg-steps code, .tg-card code { font: 500 12px/18px var(--mono); padding: 1px 4px; border-radius: var(--r-xs); background: var(--sunken); }
.tg-token { display: grid; gap: 12px; margin-top: 8px; }

/* ---------- База знаний ---------- */
.help-page { max-width: 1440px; }
.help-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.help-grid.no-aside { grid-template-columns: 260px minmax(0, 1fr); }
.help-grid.no-aside .kb-aside { display: none; }
.kb-nav { position: sticky; top: 16px; padding: 12px; }
.kb-search .search .input { height: 36px; }
.kb-nav-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.kb-nav-list a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-md); font: 500 13px/18px var(--font); color: var(--ink-2); }
.kb-nav-list a:hover { background: var(--sunken); color: var(--ink); }
.kb-nav-list a[aria-current="page"] { background: var(--brand-50); color: var(--brand-800); }
.kb-nav-list .ic { color: var(--ink-3); flex: none; }
.kb-nav-list a[aria-current="page"] .ic { color: var(--brand); }
.kb-aside { position: sticky; top: 16px; height: calc(100vh - 32px); min-height: 480px; overflow: hidden; }
.kb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.kb-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--e1); }
.kb-card:hover { box-shadow: var(--e2); }
.kb-card b { display: block; font: 600 14px/20px var(--font); }
.kb-card small { display: block; margin-top: 2px; font: 400 13px/19px var(--font); color: var(--ink-3); }
.kb-article { padding: 24px 28px 28px; }
.kb-head { display: grid; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.kb-goal { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--r-md); background: var(--brand-50); }
.kb-goal b { font: 600 11px/16px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--brand-800); }
.kb-goal p, .kb-step-body p, .kb-problems dd p { font: 400 14px/22px var(--font); color: var(--ink-2); }
.kb-article code { font: 500 12px/18px var(--mono); padding: 1px 4px; border-radius: var(--r-xs); background: var(--sunken); }
.kb-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px; margin-top: 20px; }
.kb-step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; }
.kb-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-md); background: var(--brand); color: #fff; font: 600 13px/1 var(--font); }
.kb-step-body { display: grid; gap: 10px; min-width: 0; padding-top: 3px; }
.kb-shot { margin: 0; }
.kb-shot img { display: block; max-width: 100%; height: auto; border-radius: var(--r-md); box-shadow: var(--e1), 0 0 0 1px var(--line); }
.kb-shot figcaption { margin-top: 6px; font: 400 12px/16px var(--font); color: var(--ink-3); }
.kb-problems { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.kb-problems h3 { font: 600 15px/22px var(--font); margin-bottom: 10px; }
.kb-problems dl { margin: 0; display: grid; gap: 12px; }
.kb-problems dt { font: 600 14px/20px var(--font); }
.kb-problems dd { margin: 2px 0 0; }
.kb-related { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 24px; }
.kb-shot.is-phone img { max-width: 280px; } /* phone screens at their own scale */
/* «?» of the sheet (desktop); phones have it in the header */
.sheet { position: relative; }
.help-btn {
  position: absolute; top: 14px; right: 16px; z-index: 5; display: grid; place-items: center;
  width: 32px; height: 32px; border: 0; border-radius: var(--r-md); background: var(--surface); color: var(--ink-3); box-shadow: var(--e1);
}
.help-btn:hover { color: var(--brand); box-shadow: var(--e2); }
@media (max-width: 1280px) {
  .help-grid { grid-template-columns: 240px minmax(0, 1fr); }
  .kb-aside { display: none; }
}
@media (max-width: 860px) {
  .help-grid, .help-grid.no-aside { grid-template-columns: 1fr; }
  .kb-nav { position: static; }
  .help-grid.has-article .kb-nav { display: none; } /* the crumbs lead back to the list */
  .kb-article { padding: 18px 16px 20px; }
  .help-btn { display: none; }
}
