/* ---------- кабинет: каркас ---------- */
body.app { background: var(--bg); }
.app-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid #E4E7EC; }
.app-header-right { display: flex; align-items: center; gap: 8px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.demo-bar { background: #FEF0C7; color: #7A2E0E; font-size: 14px; text-align: center; padding: 10px 16px; }
.demo-bar a { color: #7A2E0E; font-weight: 600; }

.app-body { max-width: 1320px; margin: 0 auto; padding: 24px; display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.side { flex: 1 1 240px; max-width: 260px; position: sticky; top: 84px; }
.content { flex: 999 1 560px; min-width: 0; outline: none; }

.side-plan { padding: 4px 12px 16px; }
.side-plan-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.side-plan-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px; white-space: nowrap; }
.side-nav a svg { color: #667085; flex: none; }
.side-nav a:hover { background: #E9ECF0; color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,.06); border: 1px solid #E4E7EC; }
.side-nav a[aria-current="page"] svg { color: var(--accent); }
.side-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); background: #E9ECF0; padding: 2px 8px; border-radius: 999px; }
.side-nav a[aria-current="page"] .side-count { background: var(--accent-soft); color: var(--accent-dark); }

@media (max-width: 860px) {
  .app-body { display: block; padding: 0 16px 48px; }
  .side { position: sticky; top: 61px; z-index: 5; max-width: none; margin: 0 -16px 16px; padding: 12px 16px 8px; background: var(--bg); border-bottom: 1px solid #E4E7EC; }
  .side-plan { padding: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
  .side-plan-title { font-size: 16px; }
  .side-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav a { min-height: 40px; padding: 0 12px; font-size: 14px; }
  .side-nav a svg { display: none; }
  .app-header { padding: 10px 16px; }
  .app-header .btn-link { display: none; }
}

/* ---------- содержимое ---------- */
.content-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.content-head h1 { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; }
.content-sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.panel { background: var(--surface); border: 1px solid #E4E7EC; border-radius: 16px; padding: 24px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 17px; letter-spacing: -0.01em; }
.panel p { margin: 0; color: var(--ink-2); line-height: 1.6; }
.block-title { margin: 28px 0 12px; font-size: 17px; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.cols2 .panel { margin-bottom: 0; }
.cols2 + .panel, .cols2 + .cols2, .panel + .cols2, .tiles + .cols2 { margin-top: 16px; }

.verdict { background: var(--ink); color: #fff; border-color: var(--ink); }
.verdict .eyebrow { color: #7CE0B5; }
.verdict h2 { margin: 6px 0 12px; font-size: 22px; line-height: 1.3; letter-spacing: -0.01em; }
.verdict p { color: #D0D5DD; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid #E4E7EC; border-radius: 14px; padding: 16px 18px; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { margin-top: 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile-value-sm { font-size: 17px; letter-spacing: 0; line-height: 1.3; }
.tile-sub { margin-top: 2px; font-size: 12px; color: var(--muted-2); }

.marks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.marks li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.mark.good { background: var(--accent-soft); color: var(--accent-dark); }
.mark.warn { background: #FEF0C7; color: #93370D; }

.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.link-card { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px 40px 16px 18px; background: var(--surface); border: 1px solid #E4E7EC; border-radius: 14px; text-decoration: none; color: var(--ink); transition: border-color .15s; }
.link-card:hover { border-color: var(--accent); color: var(--ink); }
.link-card-title { font-weight: 600; }
.link-card-sub { font-size: 13px; color: var(--muted); }
.link-card-arrow { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--accent); }

/* документ */
.doc-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.toc { flex: 1 1 200px; max-width: 240px; position: sticky; top: 100px; padding: 4px 0; }
.toc-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin-bottom: 8px; }
.toc ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--accent-dark); text-decoration: underline; }
.doc { flex: 999 1 420px; min-width: 0; padding: 40px; }
.doc-title { margin: 0 0 24px; font-size: 28px; letter-spacing: -0.02em; }
.doc section + section { margin-top: 28px; }
.doc h3 { font-size: 19px; }
.doc p { font-size: 16px; line-height: 1.7; }
@media (max-width: 860px) { .toc { display: none; } .doc { padding: 24px; } }

/* таблицы */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table thead th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); white-space: nowrap; }
.table tbody th { font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }
.table.num td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table.num thead th:not(:first-child) { text-align: right; }
.neg { color: var(--danger); }
.accent-panel { background: var(--accent-soft); border-color: #BFE3D3; }

/* аудитория */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card-grid .panel { margin: 0; }
.persona-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.persona-head h3 { margin: 0; }
.mini-title { margin: 18px 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: #F2F4F7; border: 1px solid #E4E7EC; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }

/* план запуска */
.progress-row { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress { height: 10px; border-radius: 5px; background: #E4E7EC; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .3s; }
.phase-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.phase-head h3 { margin: 0; display: flex; align-items: center; gap: 10px; }
.phase-num { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li + li { border-top: 1px solid var(--line-2); }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.task input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.task-text { display: flex; flex-direction: column; gap: 2px; }
.task-title { font-weight: 500; }
.task-note { font-size: 13px; color: var(--muted); }
.task input:checked + .task-text .task-title { color: var(--muted-2); text-decoration: line-through; }

/* реклама */
.ad-list { display: flex; flex-direction: column; }
.ad { padding: 0; }
.ad summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 18px 20px; cursor: pointer; list-style: none; min-height: 44px; }
.ad summary::-webkit-details-marker { display: none; }
.ad-logo { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.ad-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ad-name { font-weight: 600; font-size: 16px; }
.ad-goal { font-size: 14px; color: var(--muted); }
.ad-budget { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 110px; text-align: right; }
.fit { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.fit-high { background: var(--accent-soft); color: var(--accent-dark); }
.fit-medium { background: #E0EAFF; color: #2D3D9E; }
.fit-low { background: #F2F4F7; color: var(--muted); }
.chev { width: 10px; height: 10px; border-right: 2px solid #667085; border-bottom: 2px solid #667085; transform: rotate(45deg); margin: -4px 4px 0; transition: transform .2s; }
.ad[open] .chev { transform: rotate(-135deg); margin-top: 4px; }
.ad-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; padding: 4px 20px 22px; border-top: 1px solid var(--line-2); }
.ad-body .mini-title:first-child { margin-top: 18px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }
.ad-preview { margin-bottom: 12px; padding: 16px; border-radius: 12px; border: 1px solid #E4E7EC; background: #FCFCFD; }
.ad-preview-label { font-size: 12px; color: var(--muted-2); }
.ad-preview-title { margin-top: 4px; font-weight: 700; color: #1A47B8; font-size: 17px; }
.ad-preview-body { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
@media (max-width: 560px) { .ad-budget { min-width: 0; text-align: left; } }

/* график */
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.chart-head h3 { margin: 0; }
.seg-toggle { display: inline-flex; padding: 3px; background: #F2F4F7; border-radius: 10px; }
.seg-toggle button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px; background: none; font: 500 14px var(--font); color: var(--muted); cursor: pointer; }
.seg-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.chart-plot { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; }
.bar-col { display: grid; grid-template-rows: var(--pos) var(--neg) auto; padding: 0 2px; border: 0; background: none; cursor: default; border-radius: 6px; font: inherit; }
.bar-col:hover, .bar-col:focus-visible { background: #F2F4F7; outline: none; }
.bar-pos { display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid #98A2B3; }
.bar-neg { display: flex; align-items: flex-start; justify-content: center; }
.bar { display: block; width: min(100%, 36px); background: var(--accent); border-radius: 4px 4px 0 0; }
.bar-down { background: #E8836F; border-radius: 0 0 4px 4px; }
.bar-label { font-size: 12px; color: var(--muted); padding-top: 6px; text-align: center; }
.chart-note { margin-top: 12px; font-size: 13px; color: var(--muted-2); }
.tooltip { position: absolute; z-index: 50; pointer-events: none; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 13px; white-space: nowrap; box-shadow: 0 4px 12px rgba(16,24,40,.2); }

.sum-list { list-style: none; margin: 0 0 12px; padding: 0; }
.sum-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 15px; }
.sum-list li span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-total { font-weight: 700; border-bottom: 0 !important; }

/* ожидание генерации */
.pending { text-align: center; padding: 56px 24px; }
.pending h1 { margin: 16px 0 8px; font-size: 24px; }
.spinner-dark { display: inline-block; width: 32px; height: 32px; border-width: 3px; border-color: #E4E7EC; border-top-color: var(--accent); }

/* ---------- список планов ---------- */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; gap: 12px; padding: 22px; background: var(--surface); border: 1px solid #E4E7EC; border-radius: 16px; text-decoration: none; color: var(--ink); min-height: 180px; transition: border-color .15s, box-shadow .15s; }
.plan-card:hover { color: var(--ink); border-color: var(--accent); box-shadow: 0 8px 24px rgba(16,24,40,.06); }
.plan-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.plan-card h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.plan-card p { margin: 0; font-size: 14px; color: var(--muted); flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.plan-card-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted-2); }
.plan-card.new { align-items: center; justify-content: center; text-align: center; border-style: dashed; background: transparent; color: var(--accent-dark); font-weight: 600; }
.plan-card.new .plus { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; font-size: 24px; }

@media print {
  .app-header, .side, .demo-bar, .content-head .btn, .toc { display: none !important; }
  .app-body { display: block; padding: 0; }
  .panel { border: 0; padding: 0; }
  body.app { background: #fff; }
}
