* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--text-primary);
  font: 13.5px/1.5 -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

/* Мягкое пастельное свечение под стеклом */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(58% 46% at 8% -4%, rgba(146, 183, 247, .5), transparent 62%),
    radial-gradient(48% 42% at 92% 2%, rgba(197, 176, 246, .42), transparent 64%),
    radial-gradient(60% 55% at 42% 104%, rgba(155, 220, 195, .34), transparent 62%),
    linear-gradient(160deg, #f4f7fd 0%, #eaf0f9 55%, #e8edf7 100%);
}

button, input, select, textarea { font: inherit; color: inherit; }

.app { display: flex; flex-direction: column; height: 100vh; min-width: 1180px; }
.spacer { flex: 1; }

/* ------------------------------------------------------------------ стекло */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
}

/* ------------------------------------------------------------------- шапка */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px; height: 56px; flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .5));
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border-bottom: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 1px 12px rgba(88, 108, 145, .08);
  position: relative; z-index: 20;
}
.brand { font-weight: 650; letter-spacing: .1px; white-space: nowrap; }
.brand span { color: var(--accent-blue); }

.tabs { display: flex; gap: 3px; }
.tab {
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--text-secondary);
  transition: background .16s, color .16s, border-color .16s, box-shadow .16s;
}
.tab:hover { background: rgba(255, 255, 255, .7); color: var(--text-primary); }
.tab.active {
  background: linear-gradient(180deg, #ffffff, rgba(255, 255, 255, .74));
  color: var(--text-primary); font-weight: 600;
  border-color: var(--glass-edge);
  box-shadow: 0 2px 8px rgba(88, 108, 145, .16), inset 0 1px 0 #fff;
}

.presence { display: flex; align-items: center; }
.avatar {
  width: 27px; height: 27px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--bg-tertiary); border: 2px solid rgba(255, 255, 255, .9);
  margin-left: -7px; color: #fff; box-shadow: 0 1px 4px rgba(88, 108, 145, .28);
}
.avatar[data-self="true"] { outline: 2px solid var(--accent-blue); outline-offset: -2px; }

.ws-status { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.ws-status.online { background: var(--accent-green); box-shadow: 0 0 8px rgba(75, 171, 122, .8); }
.ws-status.offline { background: var(--accent-red); }

/* ------------------------------------------------------------------ кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 30px; padding: 5px 11px; border-radius: 9px; cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .66));
  border: 1px solid var(--glass-edge);
  color: var(--text-primary); white-space: nowrap;
  box-shadow: 0 1px 3px rgba(88, 108, 145, .1), inset 0 1px 0 rgba(255, 255, 255, .9);
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s, transform .1s;
}
.btn:hover { border-color: rgba(91, 141, 239, .5); box-shadow: 0 3px 10px rgba(88, 108, 145, .16); }
.btn:active { transform: translateY(1px); }
.btn.icon { width: 32px; padding: 5px; font-size: 15px; }
.btn.primary {
  background: linear-gradient(180deg, #7ba6f5, var(--accent-blue));
  border-color: rgba(64, 108, 199, .6); color: #fff; font-weight: 600;
  box-shadow: 0 3px 10px rgba(91, 141, 239, .35), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--accent-red); }
.btn.danger:hover { border-color: var(--accent-red); background: var(--accent-red-soft); }
.btn.active {
  border-color: var(--accent-blue); color: #3f6ed0; background: var(--accent-blue-soft);
  box-shadow: inset 0 1px 3px rgba(91, 141, 239, .2);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { min-height: 24px; padding: 2px 8px; font-size: 12px; border-radius: 7px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(255, 255, 255, .8); }

select, input[type="text"], input[type="number"], input[type="date"], input[type="time"],
input[type="search"], input[type="url"], textarea {
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--glass-edge);
  border-radius: 9px; padding: 6px 10px; min-width: 0;
  color: var(--text-primary);
  box-shadow: inset 0 1px 2px rgba(88, 108, 145, .07);
}
select:focus, input:focus, textarea:focus {
  outline: none; border-color: var(--accent-blue); background: #fff;
  box-shadow: 0 0 0 3px var(--accent-blue-soft);
}
textarea { resize: vertical; }

.timer {
  font-variant-numeric: tabular-nums; font-weight: 600; padding: 4px 10px;
  border-radius: 9px; background: rgba(255, 255, 255, .8); border: 1px solid var(--glass-edge);
}
.timer.warn { color: var(--accent-orange); border-color: var(--accent-orange); }
.timer.over { color: var(--accent-red); border-color: var(--accent-red); }

/* ------------------------------------------------------- рабочая область */
.workspace { flex: 1 1 auto; min-height: 0; display: flex; }
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* ------------------------------------ левый список: проекты, ТОПы, люди */
.sidebar {
  flex: 0 0 auto; width: var(--sidebar-width); min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .58), rgba(255, 255, 255, .34));
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border-right: 1px solid var(--glass-edge);
  overflow: auto; position: relative; z-index: 14;
}
.sidebar:empty { display: none; }
.side-block { display: grid; gap: 6px; align-content: start; }
.side-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding: 2px 6px;
}
.side-head .spacer { flex: 1; }
.side-list { display: grid; gap: 4px; }
.side-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 11px; cursor: pointer;
  background: rgba(255, 255, 255, .5); border: 1px solid transparent;
  color: var(--text-primary); min-width: 0;
  transition: background .14s, border-color .14s, box-shadow .14s;
}
.side-item:hover { background: #fff; border-color: var(--glass-edge); }
.side-item.active {
  background: linear-gradient(180deg, #fff, rgba(255, 255, 255, .8));
  border-color: rgba(91, 141, 239, .55);
  box-shadow: 0 2px 10px rgba(91, 141, 239, .18), inset 0 1px 0 #fff;
}
.side-item.active::before {
  content: ""; width: 3px; align-self: stretch; border-radius: 3px;
  background: var(--accent-blue); margin: -2px 2px -2px -4px;
}
.side-item .body { min-width: 0; display: grid; gap: 1px; flex: 1; }
.side-item .name {
  font-weight: 600; font-size: 13px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.side-item .sub {
  font-size: 11px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-item .count {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  background: rgba(120, 140, 175, .14); border-radius: 999px; padding: 1px 8px;
}
.side-empty { padding: 10px; font-size: 12px; color: var(--text-muted); }
.side-search input { width: 100%; }

/* --------------------------------------- компактная панель над контентом */
.content-bar {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  padding: 9px 16px; min-height: 52px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, .32));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-edge);
  position: relative; z-index: 15;
}
.content-bar:empty { display: none; }
.content-bar .group { display: flex; align-items: center; gap: 5px; }
.content-bar .sep { width: 1px; height: 22px; background: var(--border-secondary); margin: 0 3px; }
.content-bar label { color: var(--text-secondary); font-size: 12px; }
.bar-title { display: grid; gap: 1px; min-width: 0; margin-right: 4px; max-width: 320px; }
.bar-title b { font-size: 15px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-title span {
  font-size: 11.5px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Кнопка фильтров — заметная, всегда справа */
.filter-btn {
  position: relative; gap: 7px; padding: 6px 14px; font-weight: 600;
  background: linear-gradient(180deg, #ffffff, rgba(238, 243, 253, .9));
  border-color: rgba(91, 141, 239, .45); color: #3f6ed0;
  box-shadow: 0 2px 8px rgba(91, 141, 239, .2), inset 0 1px 0 #fff;
}
.filter-btn:hover { background: #fff; box-shadow: 0 4px 14px rgba(91, 141, 239, .28); }
.filter-btn.on {
  background: linear-gradient(180deg, #7ba6f5, var(--accent-blue));
  color: #fff; border-color: rgba(64, 108, 199, .6);
}
.filter-btn .count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent-blue); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.filter-btn.on .count { background: rgba(255, 255, 255, .32); }

/* --------------------------------------------------- всплывающие панели */
.popover {
  /* Плотнее обычного стекла: сквозь меню не должен просвечивать текст доски */
  background: rgba(255, 255, 255, .93);
  position: fixed; z-index: 90; min-width: 226px; max-width: 340px;
  border-radius: var(--radius); padding: 8px;
  display: grid; gap: 3px; max-height: 70vh; overflow: auto;
  animation: pop-in .13s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.popover .menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 9px; cursor: pointer;
  background: transparent; border: 0; color: var(--text-primary); font: inherit;
}
.popover .menu-item:hover { background: var(--accent-blue-soft); }
.popover .menu-item .ico { width: 18px; text-align: center; opacity: .85; }
.popover .menu-item .tail { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.popover .menu-item.danger { color: var(--accent-red); }
.popover .menu-sep { height: 1px; background: var(--border-secondary); margin: 4px 2px; }
.popover h4 { margin: 2px 4px 4px; font-size: 12px; color: var(--text-secondary); }
.popover .row { display: grid; gap: 4px; padding: 2px 4px; }
.popover .row > span { font-size: 11px; color: var(--text-secondary); }

.filter-panel {
  background: rgba(255, 255, 255, .95);
  position: fixed; z-index: 90; width: 300px;
  border-radius: var(--radius); padding: 13px; display: grid; gap: 11px;
  max-height: 74vh; overflow: auto;
  animation: pop-in .13s ease-out;
}
.filter-panel h4 { margin: 0; font-size: 13px; }
.filter-panel .row { display: grid; gap: 4px; }
.filter-panel .row > span { font-size: 11px; color: var(--text-secondary); }
.filter-panel .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.filter-chip {
  padding: 3px 10px; border-radius: 999px; cursor: pointer; font-size: 12px;
  background: rgba(255, 255, 255, .7); border: 1px solid var(--glass-edge);
  color: var(--text-secondary);
}
.filter-chip.on {
  background: var(--accent-blue-soft); border-color: var(--accent-blue); color: #3f6ed0;
  font-weight: 600;
}
.sticker.filtered-out { opacity: .16; filter: grayscale(1); pointer-events: none; }

/* ----------------------------------------------------------------- контент */
.view { flex: 1 1 auto; min-width: 0; min-height: 0; position: relative; overflow: hidden;
  display: flex; flex-direction: column; }
.empty-state { margin: auto; text-align: center; color: var(--text-secondary); padding: 24px;
  max-width: 460px; }
.empty-state h2 { color: var(--text-primary); font-size: 17px; }

.hint { color: var(--text-muted); font-size: 12px; }

/* ----------------------------------------------------------------- модалка */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(140, 158, 190, .34);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 100;
}
.modal {
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(250, 252, 255, .9));
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); width: min(680px, 94vw); max-height: 88vh; overflow: auto;
  box-shadow: 0 28px 70px rgba(70, 90, 130, .3), inset 0 1px 0 #fff;
}
.modal header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 18px; border-bottom: 1px solid var(--border-secondary);
  position: sticky; top: 0; background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(20px); z-index: 3;
}
.modal header h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.modal .body { padding: 15px 18px; display: grid; gap: 12px; }
.modal footer {
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--border-secondary);
  position: sticky; bottom: 0; background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(20px);
}
.field { display: grid; gap: 4px; }
.field > label { font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }
.letter-preview {
  background: rgba(255, 255, 255, .75); border: 1px solid var(--glass-edge);
  border-radius: var(--radius-sm); padding: 14px; max-height: 46vh; overflow: auto;
}
.letter-preview h2 { font-size: 16px; margin-top: 0; }
.letter-preview h4 { font-size: 13px; color: var(--accent-blue); margin: 10px 0 4px; }

/* Свёрнутый блок: история изменений и прочее «по требованию» */
details.spoiler {
  border: 1px solid var(--border-secondary); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .5); padding: 0 12px;
}
details.spoiler > summary {
  cursor: pointer; padding: 9px 0; font-size: 12.5px; color: var(--text-secondary);
  list-style: none; display: flex; align-items: center; gap: 7px;
}
details.spoiler > summary::-webkit-details-marker { display: none; }
details.spoiler > summary::before { content: "\25B8"; font-size: 11px; }
details.spoiler[open] > summary::before { content: "\25BE"; }
details.spoiler > *:not(summary) { padding-bottom: 12px; }

/* ---------------------------------------------------------------- таблицы */
.problems { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.problems-table-wrap { flex: 1; overflow: auto; padding: 12px 16px 16px; }
table.problems-table {
  width: 100%; border-collapse: separate; border-spacing: 0 6px;
}
table.problems-table th, table.problems-table td {
  text-align: left; padding: 10px 12px; vertical-align: top;
}
table.problems-table th {
  position: sticky; top: 0; z-index: 2; padding: 8px 12px;
  background: rgba(244, 247, 253, .95); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-edge); cursor: pointer; white-space: nowrap;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary);
}
table.problems-table tbody tr {
  background: rgba(255, 255, 255, .62); box-shadow: var(--glass-shadow-soft);
}
table.problems-table tbody tr:hover { background: #fff; }
table.problems-table tbody td { border-top: 1px solid var(--border-secondary);
  border-bottom: 1px solid var(--border-secondary); }
table.problems-table tbody td:first-child {
  border-left: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
table.problems-table tbody td:last-child {
  border-right: 1px solid var(--border-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.severity { color: var(--accent-orange); white-space: nowrap; letter-spacing: 1px; }
.impact-up { color: var(--accent-green); }
.impact-down { color: var(--accent-red); }
/* Пострадавший показатель красный в любую сторону: он «болит» */
.metric-bad { color: var(--accent-red); font-weight: 600; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px;
  background: rgba(255, 255, 255, .8); border: 1px solid var(--glass-edge);
  color: var(--text-secondary);
}
.chip.rank {
  background: linear-gradient(180deg, #7ba6f5, var(--accent-blue));
  color: #fff; font-weight: 700; border-color: transparent;
}
.attach-list { display: grid; gap: 6px; }
.attach-item {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 8px 11px; background: rgba(255, 255, 255, .68);
  border: 1px solid var(--glass-edge); border-radius: var(--radius-sm);
}
.attach-item.drag-over { border-color: var(--accent-blue); background: var(--accent-blue-soft); }

/* ------------------------------------------------------------------ тосты */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; }
.toast {
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(16px);
  border: 1px solid var(--glass-edge); border-left: 3px solid var(--accent-blue);
  padding: 10px 15px; border-radius: var(--radius-sm);
  box-shadow: 0 10px 26px rgba(88, 108, 145, .22);
  animation: toast-in .18s ease-out;
}
.toast.error { border-left-color: var(--accent-red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------- настройки */
.settings { display: grid; grid-template-columns: 214px 1fr; gap: 18px; min-height: 420px; }
.settings-nav { display: flex; flex-direction: column; gap: 4px; }
.settings-nav .btn { justify-content: flex-start; text-align: left; }
.settings h4 { margin: 0 0 2px; font-size: 14px; }
.settings h4 + .hint { margin: 0 0 10px; display: block; }
.settings > div:last-child { display: grid; gap: 10px; align-content: start; min-width: 0; }

.settings-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.settings-form.column { flex-direction: column; align-items: stretch; }
.settings-form input[type="text"], .settings-form input[type="url"] { flex: 1 1 160px; }
.settings-form input[type="color"] { width: 42px; height: 32px; padding: 2px; }

.member { display: flex; align-items: center; gap: 8px; min-width: 0; }
.member .avatar { margin-left: 0; width: 24px; height: 24px; }
.member-actions { display: flex; align-items: center; gap: 6px; }

.checkbox { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 12px; }
.type-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 5px; border: 1px solid rgba(0, 0, 0, .18);
}
.code-area {
  font: 12px/1.5 "Cascadia Code", Consolas, "SF Mono", monospace;
  min-height: 220px; white-space: pre; overflow: auto;
}

/* ---------------------------------------------------------------- портреты */
.portraits { flex: 1; overflow: auto; padding: 14px 16px 24px; display: grid; gap: 10px;
  align-content: start; }
.team-section { border-radius: var(--radius); overflow: hidden; }
.team-head { display: flex; align-items: center; gap: 8px; padding: 10px 13px;
  border-bottom: 1px solid var(--border-secondary); }
.team-body { padding: 9px 13px 13px; display: grid; gap: 8px; }
.team-chart { display: grid; gap: 4px; }
.people-rows { display: grid; gap: 2px; }
.person-row {
  display: grid; grid-template-columns: 28px minmax(160px, 1.6fr) 54px 60px 60px 66px 1fr;
  align-items: center; gap: 8px; padding: 6px 9px; border-radius: 10px; cursor: pointer;
}
.person-row:hover { background: rgba(255, 255, 255, .8); }
.person-row .avatar { margin: 0; width: 26px; height: 26px; }
.person-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.person-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-name .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-stat { font-variant-numeric: tabular-nums; font-size: 12px; text-align: right;
  color: var(--text-secondary); }
.person-stat.good { color: var(--accent-green); }
.person-stat.warn { color: var(--accent-orange); }
.person-stat.bad { color: var(--accent-red); }
.person-metric { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dossier-head { display: flex; align-items: center; gap: 10px; }
.line-chart { max-width: 100%; }
.portrait { border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.portrait header { display: flex; align-items: center; gap: 10px; }
.portrait header .avatar { width: 40px; height: 40px; font-size: 15px; margin: 0; }
.portrait .who-name { font-weight: 600; }
.portrait .who-role { font-size: 12px; color: var(--text-secondary); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.stat {
  background: rgba(255, 255, 255, .74); border: 1px solid var(--glass-edge);
  border-radius: var(--radius-sm); padding: 8px 9px; text-align: center;
}
.stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10.5px; color: var(--text-secondary); }
.stat.good b { color: var(--accent-green); }
.stat.warn b { color: var(--accent-orange); }
.stat.bad b { color: var(--accent-red); }
.bar { height: 7px; border-radius: 4px; background: rgba(120, 140, 175, .16); overflow: hidden; }
.bar > i { display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-blue)); }
.bar.over > i { background: linear-gradient(90deg, var(--accent-orange), var(--accent-red)); }
.portrait .metrics-list { display: grid; gap: 4px; }
.metric-row {
  display: flex; justify-content: space-between; gap: 8px; font-size: 12px;
  padding: 5px 9px; border-radius: 8px; background: rgba(255, 255, 255, .6);
}
.metric-row .src { color: var(--text-muted); font-size: 10px; }

/* ------------------------------------------------------------ дерево задач */
.tree-wrap { flex: 1; overflow: auto; padding: 14px 16px 40px; position: relative; }
.tree-node { position: relative; padding-left: 22px; }
.tree-children { position: relative; margin-left: 18px; padding-left: 16px;
  border-left: 2px dashed rgba(120, 140, 175, .3); }
.tree-card {
  display: inline-flex; align-items: center; gap: 8px; margin: 5px 0;
  padding: 8px 12px; border-radius: var(--radius-sm); cursor: default;
  background: rgba(255, 255, 255, .78); border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow-soft);
}
.tree-card.external { opacity: .62; border-style: dashed; }
.tree-card .dot { width: 9px; height: 9px; border-radius: 50%; }
.tree-card .where { font-size: 11px; color: var(--text-secondary); }
.tree-card .stars { color: var(--accent-orange); font-size: 11px; }
.tree-edge-label { font-size: 10.5px; color: var(--text-muted); margin-left: 8px; }
.tree-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-secondary); }

/* --------------------------------------------------------- проблемы и ТОПы */
.top-detail { display: grid; gap: 10px; align-content: start; }
.top-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.problem-card { border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; }
.problem-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.problem-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.problem-field { display: grid; gap: 2px; font-size: 13px; }
.problem-field > .hint { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

/* Быстрые ссылки и задачи прямо в реестре — не проваливаясь в детализацию */
.evidence { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.evidence-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; text-decoration: none;
  border: 1px solid var(--glass-edge); color: var(--text-primary);
  background: rgba(255, 255, 255, .8); cursor: pointer;
}
.evidence-chip.link { background: rgba(91, 141, 239, .14); border-color: rgba(91, 141, 239, .38); }
.evidence-chip.file { background: rgba(221, 154, 60, .14); border-color: rgba(221, 154, 60, .4); }
.evidence-chip.task { background: rgba(75, 171, 122, .14); border-color: rgba(75, 171, 122, .4); }
.evidence-chip.solution { background: rgba(155, 127, 224, .14); border-color: rgba(155, 127, 224, .4); }
.evidence-chip:hover { filter: brightness(.97); box-shadow: 0 2px 6px rgba(88, 108, 145, .18); }
.evidence-chip .state {
  font-size: 10px; color: var(--text-secondary); border-left: 1px solid var(--glass-edge);
  padding-left: 5px; margin-left: 1px;
}

/* Детализация проблемы: общая шапка и три колонки */
.problem-detail { display: grid; gap: 12px; }
.problem-common {
  display: grid; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .66); border: 1px solid var(--glass-edge);
}
.problem-common .line { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.problem-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.problem-col {
  display: grid; gap: 9px; align-content: start; padding: 12px;
  border-radius: var(--radius); background: rgba(255, 255, 255, .6);
  border: 1px solid var(--glass-edge); min-width: 0;
}
.problem-col > h4 {
  margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary); padding-bottom: 6px; border-bottom: 1px solid var(--border-secondary);
}
.stars-input { display: inline-flex; gap: 2px; }
.stars-input button {
  background: none; border: 0; cursor: pointer; font-size: 19px; line-height: 1;
  color: var(--border-primary); padding: 0 1px;
}
.stars-input button.on { color: var(--accent-orange); }
.mini-row {
  display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center;
  padding: 7px 9px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .8); border: 1px solid var(--glass-edge);
}
.mini-grid { display: grid; gap: 6px; }
.task-row { display: grid; gap: 6px; padding: 9px 10px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .82); border: 1px solid var(--glass-edge); }
.task-row .line { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.task-row .line.wide { grid-template-columns: 1fr; }

/* --------------------------------------------------------------------- Гант */
.gantt-wrap { flex: 1; overflow: auto; padding: 12px 16px 24px; }
.gantt { display: block; }

/* ---------------------------------------------------------------- инциденты */
.incidents { flex: 1; overflow: auto; padding: 14px 16px 24px; display: grid; gap: 10px;
  align-content: start; }
.incident-card { border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 7px;
  border-left: 3px solid var(--border-primary); }
.incident-card.sev-1 { border-left-color: var(--accent-red); }
.incident-card.sev-2 { border-left-color: #e58447; }
.incident-card.sev-3 { border-left-color: var(--accent-orange); }
.incident-card.sev-4 { border-left-color: var(--accent-blue); }
.incident-card.sev-5 { border-left-color: var(--text-muted); }
.incident-card.closed { opacity: .74; }
.incident-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.incident-badge {
  font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 7px;
  background: rgba(255, 255, 255, .8); border: 1px solid var(--glass-edge);
}
.incident-badge.sev-1 { background: var(--accent-red-soft); color: #a8382f; }
.incident-badge.sev-2 { background: rgba(229, 132, 71, .18); color: #a1541f; }
.chip.status-open { color: var(--accent-red); border-color: rgba(224, 104, 95, .5); }
.chip.status-mitigated { color: var(--accent-orange); border-color: rgba(221, 154, 60, .5); }
.chip.status-closed { color: var(--accent-green); border-color: rgba(75, 171, 122, .5); }

/* -------------------------------------------------------- WIP-лимит строки */
.row-head .wip { font-size: 10.5px; color: var(--text-muted); }
.row-head .wip.over { color: var(--accent-red); font-weight: 600; }
.row-head.over-wip { box-shadow: inset 3px 0 0 var(--accent-red); }

/* ---------------------------------------------------- личный план по часам */
.day-panel {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 9px 16px; border-bottom: 1px solid var(--glass-edge);
  background: rgba(255, 255, 255, .42); flex: 0 0 auto;
}
.day-panel .metric { display: grid; gap: 1px; }
.day-panel .metric b { font-size: 15px; font-variant-numeric: tabular-nums; }
.day-panel .metric b.bad { color: var(--accent-red); }
.day-panel .metric b.good { color: var(--accent-green); }
.day-panel .metric span { font-size: 10.5px; color: var(--text-muted); }
.day-panel .load { flex: 1 1 200px; min-width: 150px; display: grid; gap: 3px; }
.day-panel .load .bar { height: 8px; }
.quadrant-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.quadrant-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .74);
  border: 1px solid var(--glass-edge);
}
.quadrant-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.quadrant-chip.over { border-color: var(--accent-red); color: var(--accent-red); }

/* Ширины колонок реестра ТОПа: суть проблемы должна читаться, а не переноситься */
table.problems-table { table-layout: fixed; }
table.problems-table th:nth-child(1), table.problems-table td:nth-child(1) { width: 46px; }
table.problems-table th:nth-child(2), table.problems-table td:nth-child(2) { width: 86px; }
table.problems-table th:nth-child(3), table.problems-table td:nth-child(3) { width: 30%; }
table.problems-table th:nth-child(4), table.problems-table td:nth-child(4) { width: 15%; }
table.problems-table th:nth-child(5), table.problems-table td:nth-child(5) { width: 26%; }
table.problems-table th:nth-child(6), table.problems-table td:nth-child(6) { width: 140px; }
table.problems-table .chip { white-space: nowrap; }
table.problems-table th:nth-child(7), table.problems-table td:nth-child(7) { width: 92px; }
table.problems-table td:last-child { width: 118px; }
table.problems-table td { word-break: break-word; }

/* ============================================ досье сотрудника: две вкладки */
.dossier { display: grid; gap: 12px; }
.dossier .editor-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.dossier .editor-tabs .btn.active {
  border-color: var(--accent-blue); color: #3f6ed0; background: var(--accent-blue-soft);
}
.dossier-pane { min-height: 260px; }
.dossier-footer-extra { display: inline-flex; gap: 8px; }

/* Вкладка КПИ: таблица «дата × показатель» */
.kpi-table-wrap { overflow-x: auto; }
table.kpi-table { table-layout: auto; }
table.kpi-table th:first-child, table.kpi-table td:first-child {
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
table.kpi-table td { font-variant-numeric: tabular-nums; }
.kpi-chart-head { display: flex; align-items: center; gap: 10px; }
.kpi-chart { min-height: 60px; }

/* -------------------------------------------------- вкладка «Развитие» */
.dev-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dev-cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dev-block {
  display: grid; gap: 9px; align-content: start; padding: 12px;
  border-radius: var(--radius); background: rgba(255, 255, 255, .6);
  border: 1px solid var(--glass-edge); min-width: 0;
}
.dev-block.wide { grid-column: 1 / -1; }
.dev-block > h4 {
  margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary); padding-bottom: 6px;
  border-bottom: 1px solid var(--border-secondary);
}
.dev-block > h5 { margin: 0; font-size: 12.5px; }

/* Матрица 9-box: результативность → , потенциал ↑ */
.nine-box {
  display: grid; grid-template-columns: 92px repeat(3, minmax(0, 1fr)); gap: 4px;
  font-size: 11px;
}
.nine-box .axis-label {
  display: flex; align-items: center; color: var(--text-muted); font-size: 10.5px;
}
.nine-box .axis-label.side { justify-content: flex-end; text-align: right; padding-right: 4px; }
.nine-box .axis-label.corner { color: var(--text-secondary); font-weight: 600; }
.box-cell {
  min-height: 46px; border-radius: 10px; cursor: pointer; padding: 5px 6px;
  border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .74);
  color: var(--text-secondary); font: inherit; font-size: 10.5px; text-align: left;
  display: flex; align-items: flex-start;
  transition: background .14s, border-color .14s, box-shadow .14s;
}
.box-cell:hover { background: #fff; border-color: rgba(91, 141, 239, .5); }
/* Верхний правый угол матрицы — сильные, нижний левый — зона риска */
.box-cell.p33, .box-cell.p32, .box-cell.p23 { background: rgba(75, 171, 122, .16); }
.box-cell.p11, .box-cell.p12, .box-cell.p21 { background: rgba(224, 104, 95, .14); }
.box-cell.on {
  border-color: var(--accent-blue); color: var(--text-primary); font-weight: 600;
  box-shadow: 0 0 0 2px var(--accent-blue-soft), 0 3px 10px rgba(91, 141, 239, .22);
}

/* Шкала уровня компетенции: закрашено до текущего, целевой в рамке */
.level-scale { display: inline-flex; gap: 4px; }
.level-scale .pip {
  width: 26px; height: 24px; border-radius: 7px; cursor: pointer; font-size: 11px;
  border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .8);
  color: var(--text-muted);
}
.level-scale .pip.on { background: var(--accent-blue-soft); border-color: rgba(91, 141, 239, .5);
  color: #3f6ed0; font-weight: 600; }
.level-scale .pip.target { border: 2px dashed var(--accent-green); color: var(--accent-green); }
.chip.gap { color: var(--accent-orange); border-color: rgba(221, 154, 60, .5); }

/* ИПР 70-20-10 */
.idp-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.idp-col {
  display: grid; gap: 7px; align-content: start; padding: 10px;
  border-radius: var(--radius-sm); background: rgba(255, 255, 255, .78);
  border: 1px solid var(--glass-edge);
}
.idp-col h5 { margin: 0; display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.idp-col .share {
  font-size: 11px; font-weight: 700; color: #3f6ed0;
  background: var(--accent-blue-soft); border-radius: 999px; padding: 1px 8px;
}
.idp-item { display: grid; grid-template-columns: auto 1fr 128px auto; gap: 6px; align-items: center; }
.idp-item input[type="text"] { min-width: 0; }
/* Строка, где второй элемент — компактный: чип, кнопка, статус */
.task-row .line.compact { grid-template-columns: 1fr auto; align-items: center; }
.task-row .line.compact > .chip { justify-self: start; }
/* Шаг ИПР в узкой колонке: срок уезжает во вторую строку, кнопка держит обе */
.idp-item { grid-template-columns: auto 1fr auto; row-gap: 4px; align-items: center; }
.idp-item > label.checkbox { grid-area: 1 / 1; }
.idp-item > input[type="text"] { grid-area: 1 / 2; }
.idp-item > input[type="date"] { grid-area: 2 / 2; }
.idp-item > .btn { grid-area: 1 / 3 / span 2; align-self: center; }
