/* ============================================================
   Онбординг: «Старт» и первый вход (onboarding-start.js, 26.09.2026).
   Приветствие #onb-welcome, мастер ключа поверх #credential-modal,
   панель «Старт» #onb-start в «Срезе дня». Только токены из styles.css.
   ============================================================ */

#onb-start [hidden],
#onb-welcome [hidden],
#credential-modal [hidden] { display: none !important; }

/* Без кабинета в «Срезе дня» видна только панель «Старт». */
#page-tactical.onb-no-cred #tactical-tabs,
#page-tactical.onb-no-cred .tac-tab-content { display: none !important; }

/* ---------- Общие мелочи ---------- */
.onbs-s { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.onbs-ok-text { color: var(--ok); font-weight: 600; font-size: 13px; }
.onbs-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.onbs-link:hover { color: var(--accent-hover); }
.onbs-btn-sm { padding: 6px 12px; font-size: 12.5px; }
button.onbs-btn-sm:disabled,
.onbs-next-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.onbs-bar { height: 6px; border-radius: 999px; background: var(--border-light); overflow: hidden; }
.onbs-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.onbs-bar-sm { width: 90px; flex: none; }
.onbs-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Панель «Старт» ---------- */
#onb-start {
  padding: 14px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#onb-start:focus { outline: none; }
.onbs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  min-width: 0;
}
.onbs-card:focus { outline: 2px solid var(--accent-border); outline-offset: 2px; }
.onbs-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.onbs-head h3 { font-size: 14.5px; font-weight: 700; color: var(--heading); letter-spacing: -0.01em; }
.onbs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.onbs-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.onbs-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.onbs-head .onbs-head-acts { margin-top: 0; gap: 12px; }

/* Чек-лист */
.onbs-cklist { list-style: none; margin: 8px 0 0; padding: 0; }
.onbs-ck {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-light);
}
.onbs-ck:last-child { border-bottom: 0; }
.onbs-ico {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  flex: none;
}
.onbs-ico-done { background: var(--ok-bg); color: var(--ok); }
.onbs-ico-now { background: var(--accent-soft); color: var(--accent); border: 1.5px solid var(--accent); }
.onbs-ico-todo, .onbs-ico-locked, .onbs-ico-opt { background: var(--border-light); color: var(--text-subtle); }
.onbs-ico-err { background: var(--danger-soft); color: var(--danger); }
.onbs-t { font-weight: 600; color: var(--heading); font-size: 13.5px; }
.onbs-locked .onbs-t { color: var(--text-subtle); }
.onbs-st { font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--text-subtle); padding-top: 2px; }
.onbs-st.onbs-ok { color: var(--ok); }
.onbs-st.onbs-now { color: var(--accent); }
.onbs-later { margin-top: 6px; }
.onbs-later > summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 0 2px;
}
.onbs-later > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Строка-свёртка */
.onbs-rowcard {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 16px;
}
.onbs-rowcard b { color: var(--heading); font-size: 13.5px; }
.onbs-rowcard b.onbs-ok-text { color: var(--ok); }
.onbs-push { margin-left: auto; }

/* «Загружаем ваши данные» */
.onbs-load-list { list-style: none; margin: 4px 0 0; padding: 0; }
.onbs-stage {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.onbs-stage:last-child { border-bottom: 0; }
.onbs-stage b { color: var(--heading); font-weight: 600; }
.onbs-stw { font-size: 12px; font-weight: 600; color: var(--text-subtle); white-space: nowrap; }
.onbs-stage-done .onbs-stw, .onbs-stage-empty .onbs-stw { color: var(--ok); }
.onbs-stage-running .onbs-stw { color: var(--accent); }
.onbs-stage-error .onbs-stw { color: var(--danger); }
.onbs-spin {
  width: 16px;
  height: 16px;
  margin-left: 3px;
  border-radius: 50%;
  border: 2px solid var(--accent-border);
  border-top-color: var(--accent);
  animation: onbs-spin 1s linear infinite;
}
@keyframes onbs-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .onbs-spin { animation: none; } }
.onbs-live { font-size: 12.5px; color: var(--text); margin: 0 0 2px; }
.onbs-load-bad { border-color: var(--warn-border); }
.onbs-warnbox {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  font-size: 12.5px;
  line-height: 1.45;
}

/* Плитки продаж: .tkpi из «Среза дня», сами — кнопки */
.onbs-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
button.tkpi.onbs-tile {
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  color: inherit;
  padding: 11px 13px;
}
button.tkpi.onbs-tile:hover { border-color: var(--accent-border); }
button.tkpi.onbs-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.onbs-tile .tkpi-v { font-size: 18px; }
.onbs-tile .tkpi-sub { color: var(--text-muted); }
.onbs-dim { color: var(--text-subtle) !important; }

/* «Скоро кончится» */
.onbs-short { list-style: none; margin: 2px 0 0; padding: 0; }
.onbs-short li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.onbs-short li:last-child { border-bottom: 0; }
.onbs-short-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.onbs-days { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.onbs-danger { color: var(--danger); }
.onbs-warn { color: var(--warn-text); }

/* «Куда дальше» */
.onbs-next { display: flex; flex-wrap: wrap; gap: 8px; }
.onbs-next-btn { font-size: 13px; }
.onbs-bullets { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; color: var(--text); line-height: 1.6; }

/* «Скрыть суммы» — правило ядра (onboarding.css): body.cc-blur-money .cc-money */

@media (max-width: 1000px) {
  .onbs-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  #onb-start { padding: 12px 12px 0; }
  .onbs-tiles { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Приветствие ---------- */
#onb-welcome { z-index: 120; }
#onb-welcome .modal-box { width: 540px; max-height: calc(100vh - 32px); overflow: auto; }
#onb-welcome h3 { font-size: 19px; margin-bottom: 10px; letter-spacing: -0.015em; }
.onbs-lead { font-size: 14px; color: var(--text); line-height: 1.55; margin-bottom: 10px; }
#onb-welcome .onbs-s { font-size: 12.5px; margin-bottom: 10px; }
.onbs-welcome-actions {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 14px;
}
.onbs-welcome-actions .primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.onbs-welcome-main { display: flex; flex-direction: column; gap: 4px; }
.onbs-welcome-actions .onbs-s { margin: 0 !important; font-size: 11.5px; }
.onbs-welcome-help { margin-left: auto; align-self: center; }
.onbs-err { color: var(--error); font-size: 12.5px; margin-top: 8px; }

/* Галочки (оферта, «загрузить и их»). Перебиваем .modal-box label {display:block}. */
.modal-box label.onbs-check,
label.onbs-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--text);
  margin: 10px 0 0;
  line-height: 1.45;
  cursor: pointer;
}
label.onbs-check input { margin-top: 2px; flex: none; }
label.onbs-check a { color: var(--accent); }
label.onbs-check.onbs-check-box {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: var(--radius);
  padding: 8px 10px;
}

/* ---------- Мастер ключа (#credential-modal.onbs-wiz) ---------- */
#credential-modal.onbs-wiz .modal-box {
  width: 780px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.onbs-wiz-cols { display: block; }
#credential-modal.onbs-wiz .onbs-wiz-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 290px);
  gap: 18px;
  align-items: start;
}
.onbs-wiz-main { min-width: 0; }
#credential-modal.onbs-wiz .modal-box input[type=password],
#credential-modal.onbs-wiz .modal-box input[type=text],
#credential-modal.onbs-wiz select.onbs-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
#credential-modal.onbs-wiz .modal-box input[type=password]:focus,
#credential-modal.onbs-wiz select.onbs-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.onbs-keywrap { position: relative; }
#credential-modal.onbs-wiz #cred-api-key { padding-right: 84px; font-family: var(--font-mono); font-size: 12.5px; }
.onbs-keyshow {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.onbs-keyshow:hover { background: var(--accent-soft); }
.onbs-fieldnote { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.45; }
.onbs-warnnote { color: var(--warn-text); }

/* «Что разрешить SELLERSYSTEM» — сегменты на радиокнопках */
fieldset.onbs-role { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
fieldset.onbs-role legend { font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; padding: 0; }
.onbs-seg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.modal-box .onbs-seg label { flex: 1 1 0; margin: 0; display: block; position: relative; color: inherit; font-size: inherit; }
.onbs-seg input { position: absolute; opacity: 0; pointer-events: none; }
.onbs-seg span {
  display: block;
  padding: 8px 10px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.onbs-seg label + label span { border-left: 1px solid var(--border); }
.onbs-seg input:checked + span { background: var(--accent-soft); color: var(--accent-strong); }
.onbs-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.onbs-schemes { margin-top: 2px; }
.onbs-nametoggle { display: block; margin-top: 12px; text-decoration: none; }

/* Правая колонка — «Где взять ключ» */
.onbs-help {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  margin-top: 10px;
}
.onbs-help-h { display: block; color: var(--heading); font-size: 13px; margin-bottom: 6px; }
.onbs-help ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.onbs-help a { color: var(--accent); }
.onbs-help b { color: var(--heading); }
.onbs-help-note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--text-subtle); }

/* Экран «Готово» */
.onbs-result h3 { margin-bottom: 12px; font-size: 18px; }
.onbs-result h3:focus { outline: none; }
.onbs-acc { list-style: none; margin: 0; padding: 0; }
.onbs-acc li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: 13px; color: var(--text); }
.onbs-acc .onbs-ico { width: 20px; height: 20px; font-size: 11px; }
.onbs-result .onbs-s { margin-top: 10px; font-size: 12.5px; }
.onbs-result .modal-actions { flex-wrap: wrap; }

@media (max-width: 760px) {
  #credential-modal.onbs-wiz .onbs-wiz-cols { grid-template-columns: minmax(0, 1fr); }
  .onbs-welcome-help { margin-left: 0; }
}
