/* ============================================================
   sol-router UI — дизайн-система
   Токены → каркас (сайдбар + контент) → компоненты → канбан → адаптив
   ============================================================ */

:root {
  --bg: #0a0f1a;
  --bg-soft: #0e1526;
  --surface: #111a2b;
  --surface-2: #16223a;
  --surface-3: #1c2b49;
  --border: #223250;
  --border-soft: #1a2740;
  --text: #e7eef9;
  --text-dim: #94a6c3;
  --text-faint: #64748d;
  --accent: #4f8ff7;
  --accent-2: #7aa8ff;
  --accent-soft: rgba(79, 143, 247, 0.14);
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --bad: #f87171;
  --bad-bg: rgba(248, 113, 113, 0.13);
  --radius: 12px;
  --radius-s: 8px;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 16px 44px rgba(0, 0, 0, 0.5);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  font: 14.5px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 85% -15%, rgba(79, 143, 247, 0.07), transparent 60%),
    radial-gradient(900px 700px at -10% 115%, rgba(139, 92, 246, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color-scheme: dark;
}

::selection { background: rgba(79, 143, 247, 0.35); }

* { scrollbar-width: thin; scrollbar-color: var(--border)60 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border)80;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: #33477299; }

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

/* ============ Каркас: сайдбар + контент ============ */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 234px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 12px 16px;
  background: rgba(10, 15, 26, 0.75);
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 1px var(--border); }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: 0.2px; }
.brand-sub { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.3px; }

nav#tabs { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-label {
  padding: 12px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--text-faint);
  user-select: none;
}

.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  filter: none;
}
.tab:hover { background: var(--surface); color: var(--text); box-shadow: none; }
.tab.active {
  background: var(--accent-soft);
  border-color: rgba(79, 143, 247, 0.28);
  color: #d9e6ff;
}
.tab.active .ico { color: var(--accent-2); }

.ico { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.92; }

.sidebar-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }

.build { text-align: center; font-size: 11px; color: var(--text-faint); letter-spacing: 0.02em; }
.build:empty { display: none; }

.ghost-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-dim);
  font-size: 12.5px;
  text-decoration: none;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.ghost-link:hover { color: var(--text); border-color: rgba(79, 143, 247, 0.45); background: var(--accent-soft); }

main { flex: 1; min-width: 0; padding: 0 30px 70px; }

.page-head { padding: 22px 0 4px; display: flex; align-items: flex-start; gap: 14px; }
.page-head h2 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: 0.2px; }
.ph-main { min-width: 0; flex: 1; }
#copy-link { flex: none; margin-top: 2px; white-space: nowrap; }

/* Путь страницы: «Панель / Логи / chat» — адрес виден и его можно переслать */
#crumbs { margin-top: 4px; font-size: 12px; color: var(--text-dim); }
#crumbs:empty { display: none; }
#crumbs a, #crumbs a:visited { color: var(--accent-2); text-decoration: none; }
#crumbs a:hover { text-decoration: underline; }
#crumbs .cur { color: var(--text); }
#crumbs .sep { opacity: 0.5; margin: 0 6px; }

main section { overflow-x: auto; }

/* ============ Заголовки секций ============ */

.h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.h2::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.h3 { margin: 16px 0 6px; font-size: 14px; font-weight: 600; }

/* ============ Таблицы ============ */

table {
  width: 100%;
  margin: 14px 0 4px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  font-size: 13.5px;
  box-shadow: var(--shadow-1);
}

th {
  padding: 9px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(79, 143, 247, 0.045); }

thead th:first-child { border-top-left-radius: calc(var(--radius) - 1px); }
thead th:last-child { border-top-right-radius: calc(var(--radius) - 1px); }
tbody tr:last-child td:first-child { border-bottom-left-radius: calc(var(--radius) - 1px); }
tbody tr:last-child td:last-child { border-bottom-right-radius: calc(var(--radius) - 1px); }

table.mini {
  width: auto;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.mini td { padding: 2px 10px 2px 0; border-bottom: 0; }
table.mini tr:hover td { background: transparent; }
table.mini tr td:first-child { color: var(--text-dim); white-space: nowrap; }

/* ============ Точки статуса, бейджи ============ */

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 3px rgba(100, 116, 143, 0.14);
  vertical-align: middle;
}
.dot.up { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.14), 0 0 9px rgba(52, 211, 153, 0.55); }
.dot.down { background: var(--bad); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.14), 0 0 9px rgba(248, 113, 113, 0.5); }
.dot.off { background: var(--text-faint); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.ok { background: var(--ok-bg); border-color: rgba(52, 211, 153, 0.28); color: #6ee7b7; }
.badge.bad { background: var(--bad-bg); border-color: rgba(248, 113, 113, 0.32); color: #fca5a5; }
.badge.warn { background: var(--warn-bg); border-color: rgba(251, 191, 36, 0.3); color: #fcd34d; }

/* ============ Кнопки ============ */

button, input, select, textarea { font: inherit; }

button {
  padding: 7px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: linear-gradient(180deg, #508ff7, #3c7be6);
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: filter 0.12s, background 0.12s, border-color 0.12s, color 0.12s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(0.5px); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }

button.danger { background: linear-gradient(180deg, #ef4444, #d92626); }
button.danger:hover { filter: brightness(1.08); }

button.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
  box-shadow: none;
}
button.ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); filter: none; }

button.small { padding: 4px 11px; font-size: 12.5px; border-radius: 8px; }
button.small.ghost { padding: 3px 10px; }

/* ============ Формы ============ */

input, select, textarea {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13.5px;
  caret-color: var(--accent-2);
  transition: border-color 0.12s, box-shadow 0.12s;
  min-width: 0;
}
input:hover, select:hover { border-color: var(--accent); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder { color: var(--text-faint); }
select option { background: var(--bg-soft); color: var(--text); }
input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; padding: 0; }

.form-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin: 14px 0; }

/* ============ Текст, ссылки, код ============ */

.muted { color: var(--text-dim); font-size: 13px; }
.app-desc { display: block; max-width: 540px; font-size: 12.5px; white-space: normal; word-break: break-word; }

a.route-link { color: var(--accent-2); text-decoration: none; }
a.route-link:hover { text-decoration: underline; }

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(79, 143, 247, 0.08);
  border: 1px solid rgba(79, 143, 247, 0.1);
  font-family: var(--mono);
  font-size: 12px;
}

pre.log {
  margin: 0;
  padding: 13px 15px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: #c8d6ee;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 480px;
}

/* ============ Карточки ============ */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 14px; }
.card {
  padding: 15px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: var(--border); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.card .num { font-size: 24px; font-weight: 700; color: var(--accent-2); }
.card .lbl { margin-top: 4px; color: var(--text-dim); font-size: 12px; }

/* ============ Продукты ============ */

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.tb-spacer { flex: 1; }

.empty-note {
  margin-top: 14px;
  padding: 30px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13.5px;
  text-align: center;
}

.prd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.prd-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px 16px 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.prd-card:hover { border-color: var(--border); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.prd-card.prd-new { border-style: dashed; background: rgba(17, 26, 43, 0.5); }

.prd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prd-title { font-size: 14.5px; font-weight: 650; color: var(--text); text-decoration: none; word-break: break-word; }
a.prd-title:hover { color: var(--accent-2); text-decoration: none; }
.prd-head-badges { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.prd-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1em;
  font-size: 12.5px;
}

.prd-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-dim); }
.rev-line { font-size: 11.5px; font-family: var(--mono); margin-top: 4px; }
.rev-line b { color: var(--text); }
.prd-meta b { color: var(--text); }

/* ===== Описание продукта: откуда взято и правка на месте =====
   Правка живёт в панели (showcase_items) и сильнее описания из GitLab, поэтому
   сканирование её не затирает; подпись говорит, какой источник работает сейчас. */
.prd-desc-wrap, .proj-desc-wrap { font-size: 12.5px; line-height: 1.5; }
.proj-desc-wrap { margin-top: 4px; }
.app-desc { display: inline; }
.desc-empty { font-style: italic; color: var(--text-faint); }
.desc-src { margin-left: 6px; font-size: 10.5px; padding: 1px 7px; }
.desc-edit, .desc-reset { margin-left: 6px; }
.desc-editor { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.desc-editor textarea {
  width: 100%;
  min-height: 54px;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.desc-actions { display: flex; gap: 8px; }

/* ===== Ошибка обновления продукта: видно сразу, с местом для подробностей =====
   Раньше провал обновления жил только во всплывающем сообщении и исчезал: владелец
   не мог найти причину (29.09.2026 так не находился упавший тест продукта copy). */
.err-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.err-card {
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-left: 3px solid var(--bad);
  background: var(--bad-bg);
  border-radius: var(--radius-s);
  padding: 12px 14px;
}
.err-card > b { display: block; margin-bottom: 6px; }
.err-body { display: flex; flex-direction: column; gap: 6px; }
.err-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.err-text {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.err-hint { font-size: 12px; max-width: 92ch; }
.err-links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
.err-cell { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
tr.row-failed td { background: rgba(248, 113, 113, 0.06); }

/* ===== Права продукта: уровень смотрящего, GRANT и у кого просить ===== */
.prd-grant, .proj-grant {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  margin-top: 6px;
}
.proj-grant { margin-top: 4px; }
.grant-who { font-size: 11.5px; }
.grant-who b { color: var(--text); font-weight: 600; }
.grant-badge {
  cursor: pointer;
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.12);
  font-weight: 550;
  text-decoration: none;
}
.grant-badge:hover { color: #ddd6fe; border-color: rgba(167, 139, 250, 0.7); text-decoration: none; }

.prd-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.prd-actions select {
  padding: 3px 8px;
  font-size: 12.5px;
  border-radius: 8px;
  max-width: 150px;
}
.prd-deploy { display: flex; gap: 8px; }
.prd-deploy input { flex: 1; min-width: 130px; }
#tab-products table .prd-name-in { min-width: 170px; }
.prd-hl { font-size: 11.5px; white-space: nowrap; }

/* ============ Модальные окна ============ */

.st-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 8, 18, 0.7);
  backdrop-filter: blur(5px);
  animation: fade-in 0.15s ease-out;
}
.st-modal-box {
  width: 100%;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
  box-shadow: var(--shadow-2);
  animation: pop-in 0.16s ease-out;
}
.st-modal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.st-modal-head b { word-break: break-all; }
.st-modal .log { margin: 0; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.97) translateY(6px); } }

/* ============ Хранилище, события ============ */

.crumb { color: var(--accent-2); cursor: pointer; font-size: 13px; }
.crumb:hover { text-decoration: underline; }
.sep { color: var(--text-faint); margin: 0 4px; }
.st-folder, .st-bucket { cursor: pointer; }
.st-folder:hover td, .st-bucket:hover td { color: var(--text); }

.ev-payload { max-height: 200px; overflow: auto; }

/* ============ Тост ============ */

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 300;
  display: none;
  max-width: min(520px, 82vw);
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: rgba(17, 26, 43, 0.94);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: var(--shadow-2);
  animation: toast-in 0.18s ease-out;
}
.toast.error { border-left-color: var(--bad); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ============================================================
   Канбан-доска согласований
   ============================================================ */

.kb-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  margin-top: 12px;
  box-shadow: var(--shadow-1);
}

.kb-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-dim);
  font-size: 11px;
  user-select: none;
}
.kb-chip.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.kb-chip.human { border-color: rgba(52, 211, 153, 0.4); color: #86efac; }

.kb-board { display: flex; flex-wrap: nowrap; gap: 12px; align-items: stretch; width: 100%; margin-top: 12px; }

.kb-col {
  flex: 1 1 0;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  max-height: calc(100vh - 235px);
  box-shadow: var(--shadow-1);
}
.kb-col.drag-over { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-1); }
.kb-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
  font-size: 12.5px;
  color: #c6d4ea;
}
.kb-count {
  margin-left: auto;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.6;
}
.dot.kb-open { background: #4a90d9; box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15); }
.dot.kb-agreed { background: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }
.dot.kb-in_review { background: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15); }
.dot.kb-approved { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15); }
.dot.kb-done { background: var(--text-faint); box-shadow: none; }
.dot.kb-rejected { background: var(--bad); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15); }

.kb-cards { flex: 1 1 auto; min-height: 60px; overflow-y: auto; padding: 7px; display: flex; flex-direction: column; gap: 7px; }

.kb-card {
  padding: 9px 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  cursor: grab;
  transition: border-color 0.12s, transform 0.12s;
}
.kb-card:hover { border-color: #33507e; transform: translateY(-1px); }
.kb-card.dragging { opacity: 0.45; }

.kb-topic { font-weight: 600; font-size: 13px; margin-bottom: 2px; word-break: break-word; }
.kb-preview { color: var(--text-dim); font-size: 12px; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.kb-foot { display: flex; align-items: center; gap: 4px; color: var(--text-faint); font-size: 11px; }
.kb-foot .who { font-weight: 600; color: var(--text-dim); }
.kb-msgcount { margin-left: auto; }
.kb-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-faint);
  text-align: center;
  font-size: 12px;
  padding: 16px 8px;
}

.kb-modal { max-width: 760px; }
.kb-modal-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.kb-modal-history {
  max-height: 45vh;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

/* ============ Адаптив ============ */

@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .brand { order: 1; padding: 0; }
  .sidebar-foot { order: 2; margin: 0 0 0 auto; padding: 0; }
  .ghost-link { padding: 6px 11px; }
  nav#tabs {
    order: 3;
    width: 100%;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  nav#tabs::-webkit-scrollbar { display: none; }
  .nav-label { display: none; }
  .tab { width: auto; white-space: nowrap; padding: 6px 11px; }
  .ico { display: none; }
  main { padding: 0 14px 60px; }
  .page-head { padding-top: 14px; }

  .kb-board { flex-direction: column; }
  .kb-col { flex: none; width: 100%; min-width: 0; max-height: none; }
}

@media (max-width: 600px) {
  th, td { padding: 8px 9px; }
  main { padding: 0 10px 56px; }
  .st-modal { padding: 10px; }
}

/* Кто вошёл (единый вход) — в сайдбаре под брендом */
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 12px 12px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.who-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.who-out {
  flex: none;
  padding: 4px 10px;
  font-size: 12px;
  color: inherit;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  cursor: pointer;
}
.who-out:hover { background: rgba(255, 255, 255, 0.08); }

/* ===== Права доступа: матрица ресурсов, чипы, карточки ===== */
.az-tabs { margin-bottom: 10px; }
.az-wrap { overflow-x: auto; }
table.az-matrix { min-width: 900px; }
table.az-matrix th { white-space: nowrap; }
table.az-matrix tr.az-plugin td { border-top: 1px solid var(--border); }
.az-res { min-width: 260px; }
.az-title { font-size: 13.5px; }
.az-path { font-size: 12px; }
.az-cell { vertical-align: top; min-width: 150px; }
.az-chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 4px 4px 0; padding: 2px 8px;
  border: 1px solid rgba(79, 143, 247, 0.35); border-radius: 999px;
  background: var(--accent-soft); font-size: 12px; white-space: nowrap;
}
.az-chip b[data-az-del] { cursor: pointer; color: var(--text-dim); font-weight: 600; }
.az-chip b[data-az-del]:hover { color: #fca5a5; }
.az-chip-deny { border-color: rgba(248, 113, 113, 0.45); background: var(--bad-bg); }
.az-chip[data-az-inherited] { opacity: 0.6; border-style: dashed; background: transparent; }
.az-from { font-size: 11px; color: var(--text-dim); }
.az-plus { padding: 1px 7px; font-size: 12px; }
.az-locked { opacity: 0.45; font-size: 11px; cursor: not-allowed; }
/* Значение выданного токена: показывается один раз, должно легко копироваться. */
.az-token-value { margin: 6px 0 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); font-size: 13px;
  white-space: pre-wrap; word-break: break-all; user-select: all; }
/* Справка «как читать эту страницу»: аккордеон, открытый всем, кто вошёл в панель. */
.az-help { margin: 10px 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.az-help > summary { cursor: pointer; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.az-help > summary:hover { color: var(--accent-2); }
.az-help-body { padding: 2px 14px 14px; font-size: 13px; line-height: 1.5; }
.az-help-body .h3 { margin: 14px 0 6px; }
.az-help-body ol, .az-help-body ul { margin: 6px 0; padding-left: 22px; }
.az-help-body li { margin: 3px 0; }
.az-help-body table.mini { width: 100%; }
.az-help-body table.mini th { text-align: left; white-space: nowrap; }
.az-form { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.az-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.az-pick-item { padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 12.5px; }
.az-pick-item:hover { background: var(--accent-soft); border-color: rgba(79, 143, 247, 0.45); }
.az-browse { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.az-clickable { cursor: pointer; }
.az-clickable:hover { color: var(--accent); }
.az-anchor { text-decoration: none; opacity: 0.45; font-size: 11px; margin-left: 4px; }
.az-anchor:hover { opacity: 1; }

/* --- маршрутизация панели: адрес — это страница (см. static/js/router.js) ---
   Вкладки, подвкладки, крошки и карточки стали ссылками: убираем браузерное
   подчёркивание и приводим ссылки к тому же виду, что был у кнопок. */
a.tab, a.tab:hover, a.tab:visited { text-decoration: none; color: var(--text-dim); }
a.tab.active, a.tab.active:visited { color: #d9e6ff; }
a.az-pick-item, a.crumb, a.az-chip { text-decoration: none; color: inherit; }
a.az-pick-item:hover, a.crumb:hover { text-decoration: none; }
a.tab-link {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  padding: 3px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 12.5px;
}
a.tab-link.ghost { background: transparent; color: var(--text-dim); }
a.tab-link:hover { border-color: rgba(79, 143, 247, 0.45); background: var(--accent-soft); color: var(--text); }
a.ghost.small, a.ghost-link.small, a.ghost.small:visited {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  padding: 3px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--text-dim); font-size: 12.5px; cursor: pointer;
}
a.ghost.small:hover { background: var(--surface-2); color: var(--text); }

/* Продукт, открытый по ссылке /route/products/<имя> */
.prd-card.prd-focus { border-color: rgba(79, 143, 247, 0.6); box-shadow: 0 0 0 2px rgba(79, 143, 247, 0.18); }
.prd-missing { font-size: 11.5px; margin: 2px 0 6px; }
.prd-anchor { text-decoration: none; opacity: 0.55; font-size: 12px; }
.prd-anchor:hover { opacity: 1; }

/* Ссылка «наверх» в хранилище вместо строки-папки */
.st-folder-link { text-decoration: none; }
