/* Кабинет партнёра — клиническая палитра (доверие, спокойствие, плотность данных).
   Источник палитры/практик: IQVIA/Veeva-стиль, медицинские UI-гайды. */
:root {
  --bg: #f6fbff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #dde3ea;
  --border-strong: #aab6c5;
  --navy: #1d2d50;
  --primary: #3a7bd5;
  --primary-d: #2c63ad;
  --teal: #1e7f8c;
  --teal-l: #63c9d6;
  --green: #2cb67d;
  --amber: #d99a00;
  --red: #d64545;
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); font-weight: 600; margin: 0 0 .6em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--navy); color: #fff; padding: 0 24px; height: 58px;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: #aab6c5; letter-spacing: .03em; text-transform: uppercase; }
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a { color: #c7d2e0; padding: 8px 14px; border-radius: 8px; font-weight: 500; }
.topnav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.topnav a.active { color: #fff; background: rgba(255,255,255,.14); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-email { color: #c7d2e0; font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topmenu { display: flex; flex: 1; align-items: center; }
.menu-toggle { display: none; margin-left: auto; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.menu-toggle:hover { background: rgba(255,255,255,.08); }
.menu-toggle span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* На узком экране навигация прячется в бургер-меню (выпадает под шапкой) */
@media (max-width: 900px) {
  .topbar { position: relative; z-index: 100; gap: 12px; }
  .menu-toggle { display: inline-flex; }
  .topmenu { position: absolute; top: 100%; left: 0; right: 0; display: none;
    flex-direction: column; align-items: stretch; gap: 4px; padding: 8px 16px 16px;
    background: var(--navy); border-top: 1px solid rgba(255,255,255,.12); box-shadow: 0 10px 24px rgba(0,0,0,.3); }
  .topmenu.open { display: flex; }
  .topnav { flex-direction: column; margin-left: 0; gap: 2px; }
  .topnav a { padding: 12px 14px; }
  .topbar-right { margin-left: 0; flex-direction: column; align-items: stretch; gap: 10px;
    margin-top: 6px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); }
  .user-email { max-width: none; }
  .topbar-right .btn-ghost { text-align: center; }
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 24px; flex: 1; }
.layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; width: 100%; max-width: 1720px; margin: 0 auto; padding: 24px; flex: 1; }
.sidebar { align-self: start; position: sticky; top: 24px; }
.content { min-width: 0; }

/* ---------- Cards / KPI ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.kpi .value { font-size: 28px; font-weight: 700; color: var(--navy); margin-top: 6px; letter-spacing: -.01em; }
.kpi .sub { color: var(--muted-2); font-size: 12px; margin-top: 4px; }
.kpi.accent { border-left: 3px solid var(--primary); }
.kpi.teal { border-left: 3px solid var(--teal); }
.kpi.green { border-left: 3px solid var(--green); }

/* ---------- Логотип / иконки ---------- */
.brand-logo { height: 19px; width: auto; display: block; }
.auth-logo { height: 22px; width: auto; display: block; margin-bottom: 6px; }
.ico { display: inline-block; vertical-align: middle; flex: none; }

/* ---------- Плитки дашборда ---------- */
.sec-title { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin: 8px 0 14px; }
.sec-title .ico { color: var(--primary); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-height: 132px; display: flex; flex-direction: column; }
.tile-ico { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); margin-bottom: 12px; }
.tile-val { font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: -.01em; line-height: 1.1; }
.tile-name { font-weight: 600; color: var(--navy); margin-top: 4px; }
.tile-sub { font-size: 12px; color: var(--muted-2); margin-top: auto; padding-top: 6px; }
.tile-active { transition: box-shadow .14s, transform .14s, border-color .14s; }
a.tile-active:hover { text-decoration: none; box-shadow: 0 6px 20px rgba(16,24,40,.10); transform: translateY(-2px); border-color: var(--primary); }
.tile-active.accent .tile-ico { background: #eaf1fb; color: var(--primary); }
.tile-active.teal .tile-ico { background: #e2f4f6; color: var(--teal); }
.tile-active.green .tile-ico { background: #e6f6ef; color: var(--green); }
.tile-active:not(.accent):not(.teal):not(.green) .tile-ico { background: #f0ecfb; color: #6b4fb0; }
a.tile-active .tile-sub { color: var(--primary); font-weight: 600; }
.tile-soon { background: var(--surface-2); border-style: dashed; box-shadow: none; }
.tile-soon .tile-ico { background: #eef1f4; color: var(--muted-2); }
.tile-soon .tile-name { color: #51607a; }
.tile-soon .tile-val { display: none; }
.tile-badge { position: absolute; top: 14px; right: 14px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--amber); background: #fcf3dd; border: 1px solid #f0e2bd; padding: 3px 8px; border-radius: 20px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > * { min-width: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .layout { grid-template-columns: 1fr; } .sidebar { position: static; } }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--surface-2); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.row-link { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.table a.drug-link { font-weight: 600; color: var(--navy); }
.table .reg { color: var(--primary); font-size: 11px; vertical-align: super; margin-left: 1px; }
.table-wrap { overflow: auto; max-height: calc(100vh - 230px); }
.table-sticky thead th { position: sticky; top: 0; background: #fff; z-index: 2; box-shadow: inset 0 -1px 0 var(--border); }
.table-sticky .col-name { position: sticky; left: 0; background: #fff; z-index: 1; }
.table-sticky thead .col-name { z-index: 3; }
.table tbody tr:hover .col-name { background: var(--surface-2); }
th.sortable a { color: var(--muted); display: block; }
th.sortable a:hover { color: var(--navy); text-decoration: none; }
th.sortable.active a { color: var(--primary); }
.table-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.table-foot .pager { margin: 0; }
.pp-form { display: flex; align-items: center; gap: 8px; }
.pp-form select { width: auto; padding: 5px 8px; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=email], input[type=search], select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 9px;
  font: inherit; color: var(--text); background: #fff;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(58,123,213,.15); }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--muted); }
.check input { margin-top: 2px; }

.btn-primary, .btn-ghost {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: 9px 18px; border-radius: 9px; border: 1px solid transparent; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-d); text-decoration: none; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.content .btn-ghost, .sidebar .btn-ghost { color: var(--primary); border-color: var(--border-strong); }
.content .btn-ghost:hover, .sidebar .btn-ghost:hover { background: var(--surface-2); }
.head-actions { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.head-link { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 600; }
.head-link:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.brand { background: #eaf1fb; color: var(--primary-d); }
.danger--0 { background: #e6f6ef; color: #1c8c5f; }
.danger--1 { background: #fcf3dd; color: #946600; }
.danger--2 { background: #fbe7e3; color: #b23a26; }
.danger--3 { background: #f9dcdc; color: #a32020; }
.danger---1 { background: #eef1f4; color: var(--muted); }
.rating { font-weight: 700; color: var(--navy); }
.stars { color: var(--amber); letter-spacing: 1px; }

/* ---------- Login ---------- */
.auth-shell { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 10px 30px rgba(16,24,40,.08); overflow: hidden; }
.auth-head { background: var(--navy); color: #fff; padding: 24px 28px; }
.auth-head .mark { font-weight: 700; font-size: 17px; }
.auth-head .sub { color: #aab6c5; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.auth-body { padding: 26px 28px; }
.auth-body p.lead { color: var(--muted); margin: 0 0 20px; }
.notice { padding: 11px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 16px; }
.notice.error { background: #fbe7e3; color: #b23a26; border: 1px solid #f4c9c0; }
.notice.info { background: #eaf1fb; color: var(--primary-d); border: 1px solid #cfe0f7; }
.hint { font-size: 12px; color: var(--muted-2); margin-top: 14px; }
.auth-card .btn-primary { width: 100%; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Ввод кода (OTP) */
.code-input { display: flex; gap: 8px; justify-content: space-between; margin: 8px 0 20px; }
.code-cell {
  width: 100%; height: 56px; text-align: center; font-size: 24px; font-weight: 700;
  color: var(--navy); border: 1.5px solid var(--border-strong); border-radius: 11px;
  background: #fff; padding: 0; font-variant-numeric: tabular-nums; transition: border-color .12s, box-shadow .12s;
}
.code-cell:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(58,123,213,.18); }
.code-cell:not(:placeholder-shown), .code-cell[value]:not([value=""]) { border-color: var(--primary); }
@media (max-width: 420px) { .code-cell { height: 48px; font-size: 20px; } .code-input { gap: 6px; } }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 240px; }
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.feed-list { display: flex; flex-direction: column; }
.more-btn { margin-top: 12px; width: 100%; justify-content: center; font-weight: 600;
  background: var(--surface-2); color: var(--primary); border: 1px solid var(--border-strong); }
.content .more-btn:hover, .more-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.muted { color: var(--muted); }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dist-bar { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
.dist-bar .lab { width: 64px; color: var(--muted); }
.dist-bar .track { flex: 1; height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.dist-bar .fill { height: 100%; background: var(--primary); }
.dist-bar .cnt { width: 54px; text-align: right; font-variant-numeric: tabular-nums; color: var(--navy); font-weight: 600; }

.review { padding: 13px 0; border-bottom: 1px solid var(--surface-2); }
.review:last-child { border-bottom: none; }
.review .meta { font-size: 12px; color: var(--muted-2); display: flex; gap: 10px; margin-bottom: 4px; }
.review .text { color: var(--text); }

.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv td { padding: 7px 0; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 42%; padding-right: 12px; }
.kv td:last-child { color: var(--text); font-weight: 500; }
.form-line { font-size: 12.5px; color: #374151; padding: 5px 9px; background: var(--surface-2); border-radius: 7px; margin-bottom: 5px; }

/* ---------- Карточка препарата: разрезы, ленты, похожие ---------- */
.fill-pos { background: var(--green); } .fill-neu { background: var(--amber); } .fill-neg { background: var(--red); }
.col-rank { width: 40px; }
.col-man { max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-sticky thead .col-man { white-space: nowrap; }

.dim-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 14px; }
.dim-tab { font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: #fff; color: var(--muted); }
.dim-tab:hover { color: var(--navy); border-color: var(--border-strong); }
.dim-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.seg-name { color: var(--navy); font-weight: 500; }
.seg-bar { height: 5px; background: var(--surface-2); border-radius: 4px; margin-top: 4px; overflow: hidden; max-width: 320px; }
.seg-bar span { display: block; height: 100%; background: var(--primary); }

.mini-tab { font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 10px; border-radius: 16px;
  border: 1px solid var(--border); background: #fff; color: var(--muted); }
.mini-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.mention { padding: 12px 0; border-bottom: 1px solid var(--surface-2); }
.mention:last-child { border-bottom: none; }
.mention .meta { font-size: 12px; color: var(--muted-2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.mention .meta a { font-weight: 600; }
.mention-theme { font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.mention .text { color: #374151; font-size: 13px; }
.mention-link { font-size: 12px; display: inline-block; margin-top: 5px; }

.pop-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.pop-card { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; background: #fff; transition: box-shadow .12s, border-color .12s; }
.pop-card:hover { text-decoration: none; box-shadow: var(--shadow); border-color: var(--primary); }
.pop-name { font-weight: 600; color: var(--navy); }
.pop-mnn { font-size: 12px; margin: 2px 0 8px; }
.pop-views { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.vb-body { min-height: 40px; }
.sov-kpis { display: flex; gap: 34px; margin: 6px 0 16px; flex-wrap: wrap; }
.sov-val { font-size: 26px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.atu { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.atu-step { flex: 1; min-width: 150px; text-align: center; padding: 16px; border-radius: var(--radius); background: var(--surface-2); }
.atu-step.s1 { background: #eaf1fb; } .atu-step.s2 { background: #e2f4f6; } .atu-step.s3 { background: #e6f6ef; }
.atu-n { font-size: 23px; font-weight: 700; color: var(--navy); }
.atu-l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.atu-arrow { display: flex; align-items: center; color: var(--muted-2); font-size: 20px; }
.conv-row { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.conv-v { font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1.1; }

.sov-controls { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.seg-toggle { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--radius); }
.seg-toggle button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg-toggle button.active { background: #fff; color: var(--navy); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.sov-share { font-size: 15px; color: var(--text); margin-bottom: 12px; }
.sov-share b { color: var(--primary); font-size: 19px; }

.heatmap-wrap { overflow-x: auto; }
.heatmap { border-collapse: collapse; font-size: 12px; width: 100%; }
.heatmap th, .heatmap td { padding: 6px 8px; text-align: center; border: 1px solid var(--border); }
.heatmap thead th { color: var(--muted); font-weight: 600; background: var(--surface-2); }
.heatmap .hm-spec { text-align: left; color: var(--text); font-weight: 600; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.heatmap .hm-cell { color: var(--navy); font-variant-numeric: tabular-nums; }

.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.pager a, .pager span { padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 13px; }
.pager .cur { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Footer / cookie ---------- */
.site-footer { background: var(--surface-2); border-top: 1px solid var(--border); padding: 18px 24px; margin-top: auto; }
.footer-inner { max-width: 1320px; margin: 0 auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); }

.cookie-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 920px; margin: 0 auto;
  background: var(--navy); color: #fff; border-radius: 14px; padding: 16px 20px; box-shadow: 0 12px 34px rgba(16,24,40,.25);
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap; z-index: 50; }
.cookie-banner[hidden] { display: none; }  /* иначе display:flex перебивает атрибут hidden и баннер не прячется */
.cookie-text { flex: 1; min-width: 240px; font-size: 13px; color: #e5ecf5; }
.cookie-text a { color: #9ec3f5; }
.cookie-actions { display: flex; gap: 10px; }
.cookie-banner .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }

/* ---------- Legal docs ---------- */
.doc { max-width: 820px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 40px; box-shadow: var(--shadow); }
.doc h1 { font-size: 22px; } .doc h2 { font-size: 16px; margin-top: 26px; }
.doc p, .doc li { color: #1f2937; }
.doc ol, .doc ul { padding-left: 22px; }
.doc .dl { font-size: 13px; color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 14px; font-size: 13px; }

/* ---------- Тональность упоминаний (MedicationSentiment, ИИ-разметка) ---------- */
.senti-track { display: flex; height: 22px; border-radius: 11px; overflow: hidden; margin: 14px 0 10px; background: #eef1f5; }
.senti-seg { display: block; height: 100%; }
.senti-seg.s-pos, .dot.s-pos { background: #16a34a; }
.senti-seg.s-neu, .dot.s-neu { background: #9ca3af; }
.senti-seg.s-neg, .dot.s-neg { background: #dc2626; }
.senti-legend { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: #374151; }
.senti-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }

/* Тональность: годовые мини-столбики, бейджи в ленте, ссылка к отрицательным */
.senti-years { display: flex; gap: 14px; align-items: flex-end; margin: 16px 0 4px; flex-wrap: wrap; }
.senti-year { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.senti-col { display: flex; flex-direction: column; width: 26px; height: 72px; border-radius: 6px; overflow: hidden; background: #eef1f5; justify-content: flex-end; }
.senti-col span { display: block; width: 100%; }
.senti-ylab { font-size: 11px; color: var(--muted); }
.senti-neg-link { font-size: 13px; }
.badge.tone-pos { background: #e7f6ec; color: #15803d; }
.badge.tone-neu { background: #f1f3f6; color: #4b5563; }
.badge.tone-neg { background: #fdecec; color: #b91c1c; }
.tone-num.tone-p { color: #15803d; font-weight: 600; }
.tone-num.tone-n { color: #b91c1c; font-weight: 600; }

/* Мини-полоса тональности в разрезах аудитории и у лидеров мнений */
.tone-mini { display: inline-flex; align-items: center; gap: 8px; }
.tone-mini-track { display: inline-flex; width: 70px; height: 8px; border-radius: 4px; overflow: hidden; background: #eef1f5; }
.tone-mini-track i { display: block; height: 100%; }
.tone-mini-track .s-pos { background: #16a34a; } .tone-mini-track .s-neu { background: #cbd5e1; } .tone-mini-track .s-neg { background: #dc2626; }
.tone-mini .tone-p { color: #15803d; font-size: 12px; font-variant-numeric: tabular-nums; }
.tone-mini .tone-cnt { color: var(--muted); font-size: 11px; }
.stars .stars-empty { color: #d4dae3; }

/* ---------- Журнал «Doctor Index» ---------- */
.jrn-issue {
  display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.jrn-cover { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(16,24,40,.10); transition: box-shadow .14s, transform .14s; }
.jrn-cover:hover { box-shadow: 0 8px 26px rgba(16,24,40,.18); transform: translateY(-2px); text-decoration: none; }
.jrn-cover img { display: block; width: 100%; height: auto; }
.jrn-body { min-width: 0; }
.jrn-meta { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--teal); }
.jrn-title { font-size: 20px; margin: 8px 0 10px; }
.jrn-lead { color: var(--muted); margin: 0 0 18px; max-width: 620px; }
.jrn-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.jrn-actions .btn-primary, .jrn-actions .btn-ghost { display: inline-flex; align-items: center; gap: 8px; }
/* Страница журнала — на светлом фоне (.wrap), а не в .content: у btn-ghost задаём
   видимые цвета явно, иначе он белый-на-белом (стиль тёмной шапки) и не виден. */
.jrn-actions .btn-ghost { color: var(--primary); border-color: var(--border-strong); background: transparent; }
.jrn-actions .btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
@media (max-width: 720px) {
  .jrn-issue { grid-template-columns: 1fr; gap: 16px; }
  .jrn-cover { max-width: 320px; }
}

/* ---------- E-REP (/erep) ---------- */
.notice.ok { background: #e6f6ef; color: #1c8c5f; border: 1px solid #bfe6d4; }
p.lead { color: var(--muted); }
textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 9px;
  font: inherit; color: var(--text); background: #fff; resize: vertical; min-height: 96px;
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(58,123,213,.15); }
.wrap .btn-ghost { color: var(--primary); border-color: var(--border-strong); background: transparent; }
.wrap .btn-ghost:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- E-REP: интерфейс чатов (как Doctorgram web) ---------- */
.erep-main { width: 100%; max-width: 1320px; margin: 0 auto; padding: 16px 20px 20px; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.erep-top { margin-bottom: 12px; }
.erep-namebar { display: flex; align-items: center; }
.erep-nameform { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.erep-nameform .erep-nl { color: var(--muted); font-size: 13px; }
.erep-nameform input { width: 260px; }
.erep-nameform .btn-primary { padding: 8px 16px; }
.erep-nameview { font-size: 14px; color: var(--text); }
.erep-note { font-size: 12px; color: var(--muted-2); margin-top: 8px; }

.erep-chatapp { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--surface); box-shadow: var(--shadow); flex: 1; min-height: 460px;
  height: calc(100vh - 210px); }

.erep-chatlist { width: 340px; flex: none; border-right: 1px solid var(--border); overflow-y: auto; background: var(--surface-2); }
.erep-ci { display: flex; gap: 11px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--border);
  color: var(--text); }
.erep-ci:hover { background: #eef3f8; text-decoration: none; }
.erep-ci.active { background: #e3edfa; }
.erep-ci.mod { background: #fcf6e5; }
.erep-ci.mod.active { background: #f6ecca; }
.erep-ci.mod .erep-ci-name { color: #946600; }
.erep-ava { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: #fff; }
.erep-ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.erep-ava-ini { font-weight: 600; font-size: 15px; letter-spacing: .3px; user-select: none; }
.erep-ava.sm { width: 36px; height: 36px; }
.erep-ava.sm .erep-ava-ini { font-size: 13px; }

.erep-ci-b { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.erep-ci-top { display: flex; align-items: baseline; gap: 8px; }
.erep-ci-name { font-weight: 600; color: var(--navy); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.erep-ci-time { font-size: 11px; color: var(--muted-2); flex: none; }
.erep-ci-spec { font-size: 12px; color: var(--teal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erep-ci-last { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.erep-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.erep-ph { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.erep-ph-b { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.erep-ph-b b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erep-ph-spec { font-size: 12px; color: var(--teal); }
.erep-back { display: none; align-items: center; justify-content: center; width: 38px; height: 38px;
  margin-left: -8px; border-radius: 9px; color: var(--navy); flex: none; }
.erep-back:hover { background: var(--surface-2); text-decoration: none; }
.erep-flash { margin: 10px 18px 0; }
.erep-thread { flex: 1; overflow-y: auto; overflow-anchor: auto; padding: 16px 18px; display: flex;
  flex-direction: column; gap: 8px; background: #f6fbff; }
.erep-msg { max-width: 74%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45;
  overflow-wrap: anywhere; word-wrap: break-word; position: relative; }
.erep-msg.out { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.erep-msg.in { align-self: flex-start; background: #fff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.erep-msg-t-wrap { display: block; white-space: pre-wrap; }
.erep-msg-time { display: block; font-size: 10.5px; margin-top: 4px; opacity: .7; text-align: right; }
.erep-empty { margin: auto; }
.erep-noselect { margin: auto; padding: 40px; text-align: center; }

/* Вложения в пузыре: фото, видео, аудио, документ */
.erep-msg.media-only { padding: 4px; background: transparent; border: 0; }
.erep-att-img, .erep-att-video, .erep-att-audio, .erep-att-file { display: block; }
.erep-msg .erep-att-img, .erep-msg .erep-att-video, .erep-msg .erep-att-audio { margin-bottom: 6px; }
.erep-msg.media-only .erep-att-img, .erep-msg.media-only .erep-att-video, .erep-msg.media-only .erep-att-audio { margin-bottom: 0; }
.erep-att-img img { display: block; max-width: min(260px, 68vw); max-height: 300px; width: auto; height: auto; border-radius: 12px; }
.erep-att-video { max-width: min(280px, 72vw); max-height: 320px; border-radius: 12px; }
.erep-att-audio { width: 250px; max-width: 100%; }
.erep-att-file { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 11px;
  background: rgba(255,255,255,.16); color: inherit; }
.erep-msg.in .erep-att-file { background: var(--surface-2); color: var(--navy); }
.erep-att-file:hover { text-decoration: none; filter: brightness(1.04); }
.erep-att-ico { flex: none; display: flex; }
.erep-att-name { overflow-wrap: anywhere; font-weight: 600; font-size: 13px; }
.erep-msg.media-only .erep-att-file { background: var(--surface-2); color: var(--navy); }

/* Композер: скрепка, камера, поле, отправка */
.erep-compose { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border); background: var(--surface); }
.erep-compose-row { display: flex; gap: 6px; align-items: flex-end; }
.erep-compose textarea { flex: 1; min-height: 42px; max-height: 140px; resize: none; overflow-y: auto;
  padding: 10px 12px; line-height: 1.4; }
.erep-iconbtn { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: none; border-radius: 10px; color: var(--muted); cursor: pointer; }
.erep-iconbtn:hover { background: var(--surface-2); color: var(--primary); }
.erep-iconbtn input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.erep-camera { display: none; }
.erep-send { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; height: 42px; }
.erep-send svg { display: none; }
.erep-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Открытый чат — режим приложения: страница не прокручивается, композер всегда у нижней кромки,
   прокручивается только лента. Высота = 100dvh минус высота клавиатуры (--erep-kb, её меряет JS
   через VisualViewport; вне ввода 0). Фолбэк 100vh для старых браузеров без dvh. safe-area в композере. */
body[data-erep-chat] { height: 100vh; height: calc(100dvh - var(--erep-kb, 0px)); min-height: 0; overflow: hidden; }
body[data-erep-chat] .erep-main { flex: 1; min-height: 0; overflow: hidden; }
body[data-erep-chat] .erep-chatapp { flex: 1; height: auto; min-height: 0; }
body[data-erep-chat] .site-footer { display: none; }

/* Превью выбранных файлов до отправки */
.erep-attpreview { display: flex; flex-wrap: wrap; gap: 8px; }
.erep-attpreview[hidden] { display: none; }
.erep-chip { position: relative; display: flex; align-items: center; gap: 8px; max-width: 220px;
  padding: 6px 30px 6px 7px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.erep-chip img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; flex: none; }
.erep-chip-ico { width: 34px; height: 34px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; background: #e8eef6; color: var(--primary); flex: none; }
.erep-chip-b { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.erep-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy); font-weight: 600; font-size: 12px; }
.erep-chip-size { color: var(--muted-2); font-size: 11px; }
.erep-chip-x { position: absolute; top: 3px; right: 4px; width: 20px; height: 20px; border: 0; padding: 0;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; border-radius: 50%; }
.erep-chip-x:hover { background: #e6e9ee; color: var(--red); }

@media (max-width: 820px) {
  /* Телефон: одна панель за раз - либо список, либо переписка (как в мессенджерах) */
  .erep-main { padding: 12px 14px 14px; }
  .erep-chatapp { height: auto; min-height: 0; border-radius: var(--radius); }
  .erep-chatlist { width: 100%; border-right: 0; }
  .erep-chatapp:not(.has-selection) .erep-pane { display: none; }
  .erep-chatapp.has-selection .erep-chatlist { display: none; }
  .erep-chatapp.has-selection { border: 0; border-radius: 0; }
  .erep-back { display: inline-flex; }
  .erep-ci { padding: 13px 14px; }

  /* На экране чата убираем всё лишнее сверху и снизу - максимум места переписке */
  body[data-erep-chat] .erep-main { padding: 0; max-width: none; }
  body[data-erep-chat] .erep-top { display: none; }
  body[data-erep-chat] .site-footer { display: none; }

  .erep-camera { display: inline-flex; }
  .erep-send { padding: 0; width: 42px; }
  .erep-send svg { display: block; }
  .erep-send-text { display: none; }
  .erep-compose { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
}

/* ---------- Дерево разделов doctoratwork.com (страница «Обратная связь») ---------- */
.about-tree { margin-top: 12px; }
.about-tree ul { list-style: none; margin: 0; padding: 0; }
.about-tree > ul { columns: 2; column-gap: 30px; }
.about-tree > ul > li { break-inside: avoid; -webkit-column-break-inside: avoid; padding: 5px 0; }
.about-tree > ul > li > a, .about-tree .about-cat { font-weight: 600; color: var(--navy); font-size: 14px; }
.about-tree ul ul { margin: 5px 0 9px; padding-left: 12px; border-left: 2px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; }
.about-tree ul ul a { color: var(--muted); font-size: 13px; }
.about-tree a:hover { color: var(--primary); text-decoration: underline; }
@media (max-width: 620px) { .about-tree > ul { columns: 1; } }
