/* ── ИС «Штаб СЦК» — style.css ────────────────────────────────── */
/* Rubik — professional operational dashboard aesthetic   */

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --font: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', 'SF Mono', monospace;

  /* palette — light professional */
  --bg: #f4f6f9;
  --bg-card: #ffffff;
  --bg-hover: #edf0f5;
  --bg-active: #e2e8f0;
  --border: #d0d7de;
  --border-light: #e2e8f0;

  --text: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-dim: #a0aec0;

  /* accents */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --green: #16a34a;
  --green-soft: rgba(22,163,74,.08);
  --yellow: #ca8a04;
  --yellow-soft: rgba(202,138,4,.08);
  --red: #dc2626;
  --red-soft: rgba(220,38,38,.08);
  --purple: #7c3aed;
  --purple-soft: rgba(124,58,237,.08);
  --orange: #d97706;
  --orange-soft: rgba(217,119,6,.08);
  --cyan: #0d9488;
  --cyan-soft: rgba(13,148,136,.08);

  /* media family colors */
  --clr-msg: #2563eb;
  --clr-social: #7c3aed;
  --clr-video: #dc2626;
  --clr-mass: #ca8a04;

  /* shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);

  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
}

/* ── reset ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }
table { border-collapse: collapse; width: 100%; }

/* ── topbar ───────────────────────────────────────── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.brand .title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text);
}
.brand .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.nav { display: flex; gap: 4px; }
.nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.nav a:hover { color: var(--text); background: var(--bg-hover); }
.nav a.active { color: var(--accent); background: var(--bg-active); }

/* ── container ────────────────────────────────────── */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

/* ── card ─────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--border-light);
}
.card-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.card-body { padding: 20px 24px 24px; }

.hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 80ch;
}
.footer-note {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

/* ── KPI strip ────────────────────────────────────── */
.kpi { display: flex; gap: 24px; flex-shrink: 0; }
.kpiItem { text-align: right; }
.kpiLabel { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.kpiVal { font-size: 18px; font-weight: 700; font-family: var(--mono); color: var(--text); }

/* ── controls ─────────────────────────────────────── */
.controls { margin-bottom: 4px; }
.controls-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.control { display: flex; flex-direction: column; gap: 4px; }
.control-label { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.select, .input {
  font-family: var(--font);
  font-size: 13px;
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.select:focus, .input:focus { border-color: var(--accent); }
.select { cursor: pointer; min-width: 160px; }
.input { min-width: 200px; }

.btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { background: var(--bg-active); color: var(--text); }
.btn-accent { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); }

/* ── badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  white-space: nowrap;
}
.badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge.high { background: var(--green-soft); color: var(--green); }
.badge.high .dot { background: var(--green); }
.badge.med { background: var(--yellow-soft); color: var(--yellow); }
.badge.med .dot { background: var(--yellow); }
.badge.low { background: var(--red-soft); color: var(--red); }
.badge.low .dot { background: var(--red); }
.badge.bad { background: var(--red-soft); color: var(--red); }
.badge.warn { background: var(--orange-soft); color: var(--orange); }
.badge.info { background: rgba(88,166,255,.12); color: var(--accent); }

/* ── tiles (strata page) ─────────────────────────── */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}
.tile {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all .15s;
}
.tile:hover { border-color: var(--border); background: var(--bg-hover); }
.tile.selected { border-color: var(--accent); background: var(--bg-active); }
.tile-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tile-code { font-size: 13px; font-weight: 700; font-family: var(--mono); }
.tile-role { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.tile-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tile-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── table ────────────────────────────────────────── */
.table {
  font-size: 12px;
  width: 100%;
}
.table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
}
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: top;
}
.table tr:hover td { background: var(--bg-hover); }
.table .num { text-align: right; font-family: var(--mono); }
.table .muted { color: var(--text-dim); font-size: 11px; }
.table td b { color: var(--text); font-weight: 600; }

/* ── map ──────────────────────────────────────────── */
.map-wrap {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 20px;
  min-height: 480px;
}
.map {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  min-height: 440px;
  position: relative;
  overflow: hidden;
}
.map:not(.leaflet-container) svg { width: 100%; height: 100%; }
.map:not(.leaflet-container) svg path {
  stroke: var(--border);
  stroke-width: .5;
  cursor: pointer;
  transition: fill .15s;
}
.region-info {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  overflow-y: auto;
  max-height: 540px;
}

/* ── modal ────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
.modal.open { display: flex; }
.modal-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border-light);
}
.modal-head .h { font-size: 16px; font-weight: 600; }
.modal-head .s { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  font-size: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  flex: 1;
}

/* ── grid helpers ─────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── sections / chips ─────────────────────────────── */
.section { margin-bottom: 16px; }
.section h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  line-height: 1.4;
}
.chip.do { background: var(--green-soft); color: var(--green); border-color: rgba(63,185,80,.2); }
.chip.dont { background: var(--red-soft); color: var(--red); border-color: rgba(248,81,73,.2); }

/* ── playbook (content page) ──────────────────────── */
.playbook { display: grid; grid-template-columns: 360px 1fr; gap: 0; min-height: 600px; }
.playbook .list {
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}
.listHead {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
}
.listBody {
  flex: 1;
  overflow-y: auto;
  max-height: 600px;
}
.rowItem {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background .12s;
}
.rowItem:hover { background: var(--bg-hover); }
.rowItem.active { background: var(--bg-active); border-left: 3px solid var(--accent); }
.rowTop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.rowTitle { font-size: 13px; font-weight: 600; }
.rowMeta { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.small { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

.pbDetail { padding: 16px 20px; }
.miniCard { border: none; background: transparent; }
.miniHead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.miniTitle { font-size: 16px; font-weight: 700; }
.miniSub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.miniBody { }
.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  text-align: center;
  color: var(--text-dim);
}
.emptyTitle { font-size: 15px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.emptyText { font-size: 12px; max-width: 40ch; line-height: 1.6; }

/* ── media page redesign ──────────────────────── */
.media-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.mkpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mkpi-card .mkpi-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.mkpi-card .mkpi-val {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
  line-height: 1.1;
}
.mkpi-card .mkpi-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.mkpi-card .mkpi-bar {
  height: 3px;
  border-radius: 2px;
  background: var(--bg-hover);
  margin-top: 6px;
  overflow: hidden;
}
.mkpi-card .mkpi-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .4s ease;
}

.media-controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.media-row-1 {
  display: grid;
  grid-template-columns: 1.4fr .6fr;
  gap: 14px;
  margin-bottom: 14px;
}
.media-side-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Penetration mini bars */
.pen-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.pen-row .pen-name {
  font-size: 11px;
  color: var(--text-secondary);
  width: 86px;
  flex-shrink: 0;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pen-row .pen-track {
  flex: 1;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
}
.pen-row .pen-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}
.pen-row .pen-pct {
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--text-muted);
  width: 36px;
  flex-shrink: 0;
}

/* Heatmap */
.heatmap-wrap { overflow-x: auto; padding: 0 0 10px; }
.heatmap-table {
  font-size: 10px;
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}
.heatmap-table th {
  padding: 7px 3px;
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 9px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}
.heatmap-table th.hm-plat {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bg);
  min-width: 100px;
  padding-left: 10px;
}
.heatmap-table td {
  padding: 2px 1px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}
.heatmap-table td.hm-plat-cell {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text);
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 1;
  padding: 5px 10px;
  white-space: nowrap;
}
.hm-cell {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: default;
  transition: transform .1s;
}
.hm-cell:hover { transform: scale(1.4); }
.hm-cell.hm-on { background: var(--accent); opacity: .7; }
.hm-cell.hm-off { background: transparent; }

/* Table penetration bar inline */
.pen-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pen-inline .pen-track {
  width: 60px;
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
}
.pen-inline .pen-fill {
  height: 100%;
  border-radius: 2px;
}
.pen-inline .pen-pct {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Donut legend */
.donut-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}
.donut-legend-row .dl-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.donut-legend-row .dl-val {
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  color: var(--text);
}

@media (max-width: 1024px) {
  .media-kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .media-row-1 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .media-kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ── legend ───────────────────────────────────────── */
.cmp-meta { display: flex; gap: 24px; margin-top: 12px; }
.cmp-legend, .cmp-scale {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.legend-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.legend-row, .scale-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.sw-msg { background: var(--clr-msg); }
.sw-social { background: var(--clr-social); }
.sw-video { background: var(--clr-video); }
.sw-mass { background: var(--clr-mass); }
.dot.dot-s { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.dot.dot-m { width: 14px; height: 14px; border-radius: 50%; background: var(--text-dim); }
.dot.dot-l { width: 22px; height: 22px; border-radius: 50%; background: var(--text-dim); }

/* ── map soft (for compare) ───────────────────────── */
.map-soft path { fill: var(--bg-hover); }
.map-soft path:hover { fill: var(--bg-active); }
.map-soft path.grpA { fill: #d4edda; }
.map-soft path.grpA:hover { fill: #b8dfc5; }
.map-soft path.grpB { fill: #d4e5f7; }
.map-soft path.grpB:hover { fill: #b8d1ec; }
.map-soft path.grpC { fill: #e8d8f8; }
.map-soft path.grpC:hover { fill: #d7bef2; }
.map-soft path.selected { stroke: var(--accent); stroke-width: 2; }

/* ── compare bar (strata page) ────────────────────── */
.compare-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.compare-bar .label { font-size: 12px; color: var(--text-muted); }
.compare-bar .chips { flex: 1; }

/* ── footer ───────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-dim);
  font-size: 11px;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ── responsive ───────────────────────────────────── */
@media (max-width: 1024px) {
  .grid2 { grid-template-columns: 1fr; }
  .map-wrap { grid-template-columns: 1fr; }
  .playbook { grid-template-columns: 1fr; }
  .playbook .list { border-right: none; border-bottom: 1px solid var(--border-light); }
  .listBody { max-height: 300px; }
  .tiles { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar-inner { flex-direction: column; height: auto; padding: 12px; gap: 8px; }
  .nav { flex-wrap: wrap; }
  .container { padding: 12px; }
  .card-header { flex-direction: column; }
  .kpi { justify-content: flex-start; }
}

/* ── scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── print ────────────────────────────────────────── */
@media print {
  .topbar, .controls, .nav, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ddd; }
}
