/* Изиландия — компактный одноэкранный App Shell + мобильный PWA-таббар.
   Onest, кремовый фон, глубокий синий акцент, золотистый для денег. */

@font-face {
  font-family: "Onest";
  src: url("../fonts/onest/Onest-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-2: #edf2f4;
  --ink: #10233d;
  --ink-2: #536274;
  --ink-3: #7a8795;
  --rule: #dce3e7;
  --accent: #174f78;
  --accent-hover: #103d60;
  --accent-soft: #e7eff4;
  --money: #a86808;
  --money-soft: #fff0d2;
  --ok: #1f6a4a;
  --ok-soft: #e2f0e9;
  --warn: #9c3f26;
  --warn-soft: #f8e6e0;
  --r: 8px;
  --r-lg: 12px;
  --shadow: 0 1px 2px rgba(19, 25, 34, .06);
  --shadow-lg: 0 10px 28px rgba(16, 35, 61, .10);
  font-family: "Onest", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4 {
  line-height: 1.22;
  letter-spacing: -.01em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.3rem, 2.2vw, 1.65rem);
  font-weight: 760;
  margin: 4px 0 6px;
}

h2 {
  font-size: 1.12rem;
  font-weight: 680;
  margin: 0 0 12px;
}

h3 {
  font-size: .98rem;
  font-weight: 660;
  margin: 18px 0 10px;
}

h4 {
  font-size: .94rem;
  font-weight: 650;
  margin: 0 0 6px;
}

p {
  margin: 0 0 .6rem;
}

/* ---------- компактная шапка (56px) ---------- */
header.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1360px;
  padding: 10px 24px;
  margin: auto;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, .96);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.site-header--pro { border-bottom: 2px solid var(--accent); }
.header-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { font-size: 1.2rem; font-weight: 760; letter-spacing: -.02em; color: var(--ink); line-height: 1.15; }
.brand span { display: block; font-size: .66rem; font-weight: 500; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }
.brand--with-mark { display: inline-flex; align-items: center; gap: 10px; }
.brand--with-mark:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; box-shadow: 0 2px 6px rgba(23, 79, 120, .18); }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 1.16rem; font-weight: 780; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.brand-text small { font-size: .66rem; font-weight: 560; letter-spacing: .05em; color: var(--ink-3); text-transform: uppercase; margin-top: 2px; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; font-size: .86rem; font-weight: 560; }
nav a { color: var(--ink-2); }
nav a:hover { color: var(--accent); text-decoration: none; }

.mode-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 9px; padding: 2px; gap: 2px; }
.mode-switch form { margin: 0; }
.mode-btn { width: auto; margin: 0; padding: 5px 11px; border-radius: 7px; background: transparent; color: var(--ink-2); font-size: .8rem; font-weight: 640; text-align: center; transition: .15s; }
.mode-btn:hover { background: rgba(23, 79, 120, .08); color: var(--ink); }
.mode-btn.is-active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(16, 35, 61, .12); }
.nav-logout { width: auto; margin: 0; padding: 0; background: none; color: var(--ink-2); font-weight: 560; }

main, main.app-shell { max-width: 1360px; margin: auto; padding: 14px 24px 24px; }
.eyebrow {
  display: inline-block;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 20px;
}

.eyebrow--pro {
  background: var(--ink);
  color: #fff;
}

/* ---------- карточки и общие элементы ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
}

.tag {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #cfe0ea;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 640;
  padding: 3px 10px;
  white-space: nowrap;
}

.tag--ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: #bfe0cf;
}

.muted,
small {
  color: var(--ink-2);
}

.small {
  font-size: .82rem;
}

.nums {
  font-variant-numeric: tabular-nums;
}

/* ---------- формы и кнопки ---------- */
label {
  display: block;
  font-size: .78rem;
  font-weight: 640;
  margin: 8px 0 4px;
  color: var(--ink-2);
}

input,
textarea,
select {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 8px 11px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

button {
  width: 100%;
  border: 0;
  border-radius: var(--r);
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: .9rem;
  font-weight: 640;
  cursor: pointer;
  margin-top: 12px;
  text-align: center;
  transition: background .15s;
}

button:hover {
  background: var(--accent-hover);
}

button:disabled {
  opacity: .5;
  cursor: default;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r);
  font-weight: 640;
  font-size: .84rem;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  white-space: nowrap;
}

.button:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-sm {
  width: auto;
  margin-top: 0;
  padding: 7px 13px;
  font-size: .82rem;
}

.secondary,
.button.secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--rule);
}

.secondary:hover,
.button.secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- сообщения ---------- */
.notice {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 9px 13px;
  font-size: .84rem;
  border-radius: 6px;
  color: var(--ink-2);
  margin-bottom: 10px;
}

.notice--compact {
  padding: 7px 11px;
  font-size: .8rem;
}

.error,
.notice.error {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--warn);
}

.msg {
  padding: 9px 13px;
  border-radius: 6px;
  font-size: .85rem;
  margin-bottom: 10px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}

.msg.error {
  background: var(--warn-soft);
  border-color: var(--warn);
}

.msg.success {
  background: var(--ok-soft);
  border-color: var(--ok);
}

/* ---------- СТАРТОВЫЙ ЭКРАН (1 VIEWPORT) ---------- */
.start-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
  align-items: start;
}

/* Уютная архитектурная hero-карточка (без мимими, ровно под 1 экран) */
.hero-editorial {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(115deg, #fdfbf6 0%, #f5efe2 100%);
  border: 1px solid #e3dac8; border-radius: var(--r-lg);
  padding: 12px 18px; margin-bottom: 10px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(16, 35, 61, .04);
}
.hero-editorial--pro { background: linear-gradient(115deg, #f9f8f4 0%, #eaf0f4 100%); border-color: #d2dce4; }
.hero-editorial-copy { flex: 1; min-width: 0; }
.hero-editorial-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.hero-editorial h1 { margin: 0 0 3px; font-size: 1.32rem; color: var(--ink); line-height: 1.2; }
.hero-sub { margin: 0; font-size: .82rem; color: var(--ink-2); }
.hero-editorial-art { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; margin: -6px -4px -6px 0; }
.hero-editorial-art img {
  display: block; height: 108px; width: auto; max-width: 185px;
  object-fit: contain; mix-blend-mode: multiply; border-radius: 8px;
}

.start-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.start-hero h1 {
  margin: 4px 0 0;
  font-size: 1.42rem;
}

.scenario-grid--compact {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 0 0 11px;
}

.scenario-card--compact {
  width: 100%; margin: 0; padding: 8px 10px; border-radius: 11px;
  border: 1px solid #e4ddd0; background: #fffdf9; color: var(--ink);
  text-align: left; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  transition: border-color .15s, box-shadow .15s, transform .12s, background .15s;
}
.scenario-card--compact:hover { background: var(--surface); border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.scenario-card--compact.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(23, 79, 120, .14); }
.scenario-card--compact .scenario-icon { font-size: 1.25rem; line-height: 1.1; flex-shrink: 0; }
.scenario-thumb {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 9px;
  border: 1px solid #e6dfd1; background: #f7f5ef; object-fit: cover;
  display: block; transition: transform .15s;
}
.scenario-card--compact:hover .scenario-thumb { transform: scale(1.04); }

/* Экран входа */
.login-card { display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: center; padding: 22px 26px; }
.login-visual { background: linear-gradient(160deg, #fdfbf6 0%, #f3ecdd 100%); border: 1px solid #e4dccb; border-radius: 11px; padding: 16px; }
.login-visual img { display: block; width: 100%; height: auto; border-radius: 8px; mix-blend-mode: multiply; margin-bottom: 12px; }
.login-visual-cap h2 { font-size: 1.12rem; margin: 8px 0 6px; }
.login-form-col { padding: 4px 2px; }
.scenario-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.scenario-copy strong { font-size: .86rem; font-weight: 700; color: var(--ink); line-height: 1.25; }
.scenario-copy span { font-size: .74rem; font-weight: 400; color: var(--ink-2); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.scenario-card--compact:hover {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.scenario-card--compact.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(23, 79, 120, .14);
}

.scenario-card--compact .scenario-icon {
  font-size: 1.25rem;
  line-height: 1.1;
  flex-shrink: 0;
  margin-top: 1px;
}

.scenario-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.scenario-copy strong {
  font-size: .86rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.scenario-copy span {
  font-size: .74rem;
  font-weight: 400;
  color: var(--ink-2);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card--start {
  padding: 14px 18px;
  margin-bottom: 0;
}

.start-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.field-col label:first-child {
  margin-top: 0;
}

/* Компактные чипы направлений вместо 485px простыни */
.directions--compact {
  border: 0;
  padding: 0;
  margin: 10px 0 8px;
}

.directions--compact legend {
  font-size: .78rem;
  font-weight: 640;
  color: var(--ink-2);
  margin-bottom: 5px;
  padding: 0;
}

.dir-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dir-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--bg);
  font-size: .8rem;
  font-weight: 560;
  color: var(--ink);
  cursor: pointer;
  transition: .12s;
}

.dir-pill:hover {
  border-color: var(--accent);
}

.dir-pill input {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.dir-pill:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 660;
}

.dir-pill-icon {
  font-size: .92rem;
  line-height: 1;
}

/* Компактная dropzone */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 16px 14px;
  margin: 6px 0 8px;
  border: 2px dashed #b9cad6;
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  transition: .15s;
}

.dropzone--inline {
  flex-direction: row;
  text-align: left;
  justify-content: flex-start;
  gap: 10px;
  padding: 7px 11px;
  margin: 0;
  border-width: 1.5px;
  min-height: 40px;
}

.dropzone-inline-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.dropzone-inline-text strong {
  font-size: .82rem;
  color: var(--ink);
}

.dropzone-inline-text small {
  font-size: .7rem;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone.has-files {
  border-style: solid;
  border-color: var(--ok);
  background: var(--ok-soft);
}

.dropzone-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
}

.dropzone-files {
  font-size: .76rem;
  font-weight: 640;
  color: var(--ok);
}

.start-footer-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.quick-facts--inline {
  flex: 1 1 320px;
  margin-top: 0 !important;
  padding: 8px 12px !important;
}

.btn-primary-big {
  padding: 11px 20px;
  font-size: .94rem;
  text-align: center;
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(23, 79, 120, .20);
}

.btn-start-cta {
  width: auto;
  min-width: 240px;
  margin-top: 0;
  flex-shrink: 0;
}

.privacy-line {
  margin: 8px 0 0;
  font-size: .75rem;
  color: var(--ink-3);
}

.pro-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 9px;
}

.pro-settings-grid label {
  margin-top: 0;
}

/* ---------- правый рельс ---------- */
.rail-card {
  padding: 14px 16px;
  margin-bottom: 12px;
}

.rail-card h2,
.rail-card h3 {
  font-size: .94rem;
  margin: 0 0 8px;
}

.steps--compact {
  padding-left: 0;
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.steps--compact li {
  padding: 0;
  color: var(--ink-2);
  font-size: .78rem;
}

.steps--compact strong {
  display: block;
  color: var(--ink);
  font-size: .8rem;
}

.steps--compact span {
  display: block;
  color: var(--ink-3);
  font-size: .74rem;
}

.history {
  display: block;
  padding: 8px 0;
  border-top: 1px solid var(--rule);
}

.history:first-of-type {
  border-top: 0;
  padding-top: 2px;
}

.history:hover {
  text-decoration: none;
}

.history.is-current {
  background: var(--accent-soft);
  margin: 0 -8px;
  padding: 8px;
  border-radius: 8px;
  border-top-color: transparent;
}

.history strong,
.history span,
.history small {
  display: block;
}

.history strong {
  color: var(--ink);
  font-size: .84rem;
}

.history span {
  font-size: .76rem;
  color: var(--ink-2);
}

.history small {
  font-size: .68rem;
  margin-top: 2px;
  color: var(--ink-3);
}

.history-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.status-pill {
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-2);
}

.status-ready {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-queued,
.status-running {
  background: var(--money-soft);
  color: var(--money);
}

.status-failed {
  background: var(--warn-soft);
  color: var(--warn);
}

.mode-promo {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.mode-promo form {
  margin: 0;
}

.mode-promo button {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: .82rem;
}

/* ---------- ЭКРАН ДЕЛА: ПАСПОРТ + ВКЛАДКИ ---------- */
.case-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 10px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.case-bar-left {
  min-width: 0;
  flex: 1;
}

.back-link {
  display: inline-block;
  font-size: .76rem;
  font-weight: 640;
  color: var(--ink-2);
  margin-bottom: 2px;
}

.case-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.case-title-row h1 {
  margin: 0;
  font-size: 1.24rem;
}

.case-q-line {
  margin: 3px 0 0;
  font-size: .82rem;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 780px;
}

.case-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.case-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 11px;
  padding: 4px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.case-tab {
  width: auto;
  margin: 0;
  padding: 8px 14px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: .85rem;
  font-weight: 640;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}

.case-tab:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.case-tab.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(23, 79, 120, .22);
}

.tab-ico {
  font-size: .95rem;
  line-height: 1;
}

.tab-badge {
  font-style: normal;
  font-size: .7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
}

.tab-badge--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.case-tab.is-active .tab-badge {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

.tab-panel[hidden] {
  display: none !important;
}

/* Вкладка 1: Вердикт — 2 колонки с липким калькулятором справа */
.verdict-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, .95fr);
  gap: 16px;
  align-items: start;
}

.verdict-rail {
  position: sticky;
  top: 12px;
}

.docs-grid {
  display: grid;
  grid-template-columns: minmax(290px, .9fr) minmax(0, 1.5fr);
  gap: 16px;
  align-items: start;
}

/* ---------- карточки ответа ---------- */
.answer-hero {
  font-size: .98rem;
  line-height: 1.58;
  color: var(--ink);
  background: var(--bg);
  border-left: 4px solid var(--ok);
  border-radius: 9px;
  padding: 13px 16px;
  margin: 8px 0 14px;
}

.solution-card,
.finding-card {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 9px;
  padding: 12px 15px;
  margin: 9px 0;
}

.solution-card h4,
.finding-card h4 {
  margin: 4px 0 6px;
}

.cond-list {
  margin: 6px 0 4px;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: .86rem;
}

.cond-list li {
  margin-bottom: 3px;
}

.ref-fold {
  border-top: 0;
  padding: 4px 0 0;
  margin-top: 4px;
}

.ref-fold summary {
  font-size: .78rem;
  color: var(--ink-2);
  font-weight: 600;
}

.missing-row {
  background: var(--money-soft);
  border-left: 3px solid var(--money);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 7px 0;
  font-size: .88rem;
}

/* ---------- детали и источники ---------- */
details {
  padding: 10px 0;
  border-top: 1px solid var(--rule);
  margin-top: 8px;
}

summary {
  cursor: pointer;
  font-size: .86rem;
  font-weight: 640;
  color: var(--ink);
}

article {
  margin: 10px 0 14px;
}

.source-item {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.source-item:last-child {
  border-bottom: 0;
}

blockquote {
  margin: 10px 0;
  padding: 9px 14px;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  font-size: .84rem;
  border-radius: 6px;
}

blockquote p {
  margin: 0 0 6px;
}

cite {
  font-size: .74rem;
  font-style: normal;
  overflow-wrap: anywhere;
  color: var(--ink-3);
}

p,
dd {
  overflow-wrap: anywhere;
}

dt {
  font-size: .74rem;
  color: var(--ink-3);
}

dd {
  margin: 0 0 8px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.actions form {
  margin: 0;
}

.link-button {
  width: auto;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}

.link-button:hover {
  background: none;
  text-decoration: underline;
}

.danger,
.link-button.danger {
  color: var(--warn);
}

.document-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.document-row p {
  margin: 4px 0 8px;
}

.document-text {
  white-space: pre-wrap;
  font: 12.5px/1.5 Consolas, monospace;
  overflow-wrap: anywhere;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 10px 12px;
  max-height: 260px;
  overflow: auto;
}

.narrow {
  max-width: 760px;
}

/* ---------- панель экспресс-диагностики, чипы и ГБУ 237-ФЗ ---------- */
.diag-panel {
  border-top: 3px solid var(--ok);
}

.diag-facts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.fact-pill {
  font-size: .74rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 2px 9px;
}

.diag-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.diag-card {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  padding: 10px 13px;
  margin: 0;
  background: var(--bg);
}

.diag-card p {
  font-size: .84rem;
  margin: 0 0 5px;
}

.diag-card p:last-child {
  margin-bottom: 0;
}

.diag-card-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}

.diag-card-head h4 {
  margin: 0;
  font-size: .89rem;
}

.diag-basis {
  font-size: .73rem !important;
  color: var(--ink-3);
}

.diag-tone-ok {
  border-left-color: var(--ok);
  background: #f2f8f5;
}

.diag-tone-warn,
.diag-sev-warn {
  border-left-color: var(--money);
  background: #fffaf0;
}

.diag-tone-info,
.diag-sev-info {
  border-left-color: var(--accent);
  background: #f3f7fa;
}

.diag-sev-danger {
  border-left-color: var(--warn);
  background: #fdf3f0;
}

.diag-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.diag-badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.diag-badge-warn {
  background: var(--money-soft);
  color: var(--money);
}

.diag-badge-info {
  background: var(--accent-soft);
  color: var(--accent);
}

.diag-badge-danger {
  background: var(--warn-soft);
  color: var(--warn);
}

.diag-side-card {
  padding: 14px 16px;
  margin-bottom: 12px;
}

.diag-side-card h3 {
  margin: 0 0 8px;
  font-size: .94rem;
}

.diag-facts-form--side {
  margin-top: 6px;
  padding-top: 0;
  border-top: 0;
}

.diag-followup-box {
  background: #f6f2fb;
  border: 1px solid #d9cdf0;
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.quick-facts,
.diag-all-facts {
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--bg);
}

.quick-facts summary,
.diag-all-facts summary {
  font-size: .82rem;
  color: var(--accent);
}

.diag-all-grid {
  margin-top: 8px;
}

.chip-fieldset {
  border: 0;
  padding: 0;
  margin: 8px 0 0;
}

.chip-fieldset legend {
  font-size: .76rem;
  font-weight: 660;
  color: var(--ink);
  margin-bottom: 4px;
  padding: 0;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip-radio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
  font-size: .78rem;
  font-weight: 540;
  color: var(--ink);
  cursor: pointer;
  transition: .12s;
}

.chip-radio:hover {
  border-color: var(--accent);
}

.chip-radio input {
  width: 13px;
  height: 13px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.chip-radio:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 640;
}

.diag-price-row {
  margin-top: 8px;
}

.diag-price-row label {
  margin-top: 2px;
}

.diag-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.diag-btn-primary,
.diag-btn-secondary {
  width: auto;
  flex: 1;
  margin-top: 0;
  padding: 8px 12px;
  font-size: .82rem;
  text-align: center;
}

.diag-gbu-card {
  background: var(--accent-soft);
  border: 1px solid #cfe0ea;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: .82rem;
  margin-bottom: 8px;
}

.diag-draft-item {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  margin-top: 6px;
}

.diag-draft-item summary {
  font-size: .82rem;
  color: var(--ink);
}

/* ---------- вспомогательные страницы (профиль, доступы, стенд) ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

footer.app-footer {
  max-width: 1360px;
  margin: auto;
  padding: 0 24px 20px;
  color: var(--ink-3);
  font-size: .74rem;
}

/* ---------- АДАПТИВ + МОБИЛЬНЫЙ PWA НИЖНИЙ ТАББАР ---------- */
@media (max-width: 1024px) {

  .start-shell,
  .verdict-grid,
  .docs-grid {
    grid-template-columns: 1fr;
  }

  .verdict-rail {
    position: static;
  }

  .scenario-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  header.site-header { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .header-left { gap: 10px; width: 100%; justify-content: space-between; }
  nav { gap: 10px; font-size: .8rem; width: 100%; }
  main, main.app-shell { padding: 10px 12px 80px; }
  .hero-editorial { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hero-editorial-art { align-self: center; margin: 0; }
  .hero-editorial-art img { height: 96px; }
  .login-card { grid-template-columns: 1fr; }
  .start-row-2, .pro-settings-grid { grid-template-columns: 1fr; }
  .scenario-grid--compact { grid-template-columns: 1fr; }
  .btn-start-cta { width: 100%; }
  .case-bar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 12px; }
  .case-q-line { white-space: normal; }
  .case-bar-actions { width: 100%; flex-wrap: wrap; }
  .case-bar-actions .button, .case-bar-actions button { flex: 1 1 auto; }
  /* На мобильном вкладки превращаются в фиксированный нижний PWA-таббар */
  .page-case .case-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    margin: 0;
    border-radius: 14px 14px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    gap: 2px;
    box-shadow: 0 -6px 24px rgba(16, 35, 61, .12);
    background: rgba(255, 255, 255, .98);
    backdrop-filter: blur(8px);
  }

  .page-case .case-tab {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px;
    font-size: .68rem;
    position: relative;
  }

  .page-case .case-tab .tab-ico {
    font-size: 1.15rem;
  }

  .page-case .case-tab .tab-badge {
    position: absolute;
    top: 2px;
    right: 6px;
    font-size: .62rem;
    padding: 0 4px;
  }

  .page-case footer.app-footer {
    display: none;
  }
}