/* ============================================================
   INTERN — компонентный слой. Перенос макета (тема «Минимализм»)
   из инлайн-стилей прототипа в классы. Значения — 1:1 из макета.
   ============================================================ */

body {
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
}

/* .num — цифры интерфейсным шрифтом с табличными знаками (как в макете);
   .mono — то же, но моноширинным (пароли, коды, старые страницы). */
.num {
  font-family: var(--font-sans);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}
.mono {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

.overline {
  font-family: var(--font-classical);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

::selection { background: var(--accent-soft-2); color: var(--text-primary); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

* { scrollbar-width: thin; scrollbar-color: var(--ink-300) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--ink-300); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* ============================================================
   Оболочка
   ============================================================ */
.shell { min-height: 100vh; }
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- сайдбар ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--sb-bg); color: var(--sb-text);
  display: flex; flex-direction: column; z-index: 40;
}
.sb-brand {
  display: flex; align-items: center; gap: 11px; padding: 18px 18px 13px;
  font-family: var(--font-classical); font-weight: var(--fw-bold);
  font-size: 17px; letter-spacing: .18em; color: #F6F1E5;
}
.sb-nav { flex: 1; overflow-y: auto; padding: 2px 12px 12px; }
.sb-group {
  font-family: var(--font-classical); font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--sb-label); padding: 15px 8px 7px;
}
.sb-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  border-radius: 9px; font-size: 13.5px; font-weight: var(--fw-medium);
  color: var(--sb-text); margin-bottom: 2px; text-decoration: none;
  transition: background var(--dur-1) var(--ease-out);
}
.sb-item:hover { background: var(--sb-hover); color: var(--sb-text-on); text-decoration: none; }
.sb-item.on {
  color: var(--sb-text-on); background: var(--sb-active);
  box-shadow: inset 3px 0 0 0 var(--accent);
}
.sb-item svg { flex-shrink: 0; display: block; }
.sb-item span { flex: 1; }
.sb-badge {
  font-family: var(--font-mono); font-size: 10px; background: var(--sb-badge);
  color: var(--sb-badge-t); border-radius: 999px; padding: 1px 7px; flex: 0 0 auto;
}
.sb-foot { padding: 12px 14px 14px; border-top: 1px solid var(--sb-border); position: relative; }
.sb-user { display: flex; align-items: center; gap: 10px; width: 100%; cursor: pointer;
  background: none; border: 0; padding: 0; color: inherit; text-align: left; font: inherit; }
.sb-av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--sb-av);
  color: var(--sb-av-t); display: grid; place-items: center;
  font-size: 11.5px; font-weight: var(--fw-bold); flex: 0 0 auto;
}
.sb-name { display: block; font-size: 13px; font-weight: var(--fw-semibold); color: #F6F1E5; }
.sb-role { display: block; font-size: 11px; color: rgba(246,241,229,.55); }
.sb-sel {
  width: 100%; margin-top: 10px; background: rgba(255,255,255,.08); color: #F6F1E5;
  border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 6px 8px;
  font-family: var(--font-sans); font-size: 12px; cursor: pointer;
}
.sb-sel option { color: var(--text-primary); background: #FFFFFF; }

/* меню профиля */
.um {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px);
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop);
  padding: 6px; display: none; z-index: 60;
}
.um.open { display: block; }
.um a, .um button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px;
  border-radius: 8px; font-size: 13px; color: var(--text-secondary);
  background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit;
}
.um a:hover, .um button:hover { background: var(--surface-hover); text-decoration: none; }
.um .um-danger { color: var(--danger); }
.um-sep { height: 1px; background: var(--divider); margin: 5px 2px; }

/* ---------- топбар ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
}
.topbar-in {
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h); padding: 0 var(--page-pad);
}
.mob-btn {
  display: none; width: 36px; height: 36px; place-items: center;
  border: 1px solid var(--border-default); border-radius: 10px;
  color: var(--text-secondary); background: none; cursor: pointer; flex-shrink: 0;
}
.tb-searchbox { position: relative; flex: 0 0 340px; min-width: 120px; }
.tb-searchbox svg { position: absolute; left: 11px; top: 9px; }
.tb-search {
  width: 100%; background: var(--surface-inset); border: 1px solid var(--border-default);
  border-radius: 10px; padding: 7px 12px 7px 32px;
  font-family: var(--font-sans); font-size: 13px; color: var(--text-primary);
}
.tb-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tb-search:disabled { cursor: default; }
.tb-results {
  position: absolute; top: 38px; left: 0; width: 420px; background: var(--surface-card);
  border: 1px solid var(--border-default); border-radius: 12px;
  box-shadow: var(--shadow-md); overflow: hidden; z-index: 60;
}
.tb-res {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border-bottom: 1px solid var(--divider); cursor: pointer; color: var(--text-primary);
}
.tb-res:hover { background: var(--surface-hover); text-decoration: none; }
.tb-spacer { flex: 1; }
.tb-date {
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
  font-feature-settings: 'tnum' 1;
}
.tb-bell {
  position: relative; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px; color: var(--text-secondary);
}
.tb-bell:hover { background: var(--surface-hover); }
.tb-bell .dot-unread {
  position: absolute; top: 6px; right: 7px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent); border: 1.5px solid var(--surface-card);
}
.tb-user { display: flex; align-items: center; gap: 9px; color: var(--text-primary); }
.tb-user:hover { text-decoration: none; }
.tb-av {
  /* Не --ink-900: в тёмной теме нейтральная шкала переворачивается, и получались
     почти белые буквы на почти белом кружке. Акцент переворачивается вместе с парой
     «фон/текст на акценте», поэтому инициалы читаются в обеих темах. */
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent);
  color: var(--text-on-accent); display: grid; place-items: center;
  font-size: 10.5px; font-weight: var(--fw-bold);
}
.tb-uname { display: block; font-size: 13px; font-weight: var(--fw-medium); }
.tb-urole { display: block; font-size: 11px; color: var(--text-muted); }

/* ---------- контент ---------- */
.content { padding: var(--page-pad); max-width: var(--container-max); width: 100%; }
.page { display: flex; flex-direction: column; gap: var(--gap); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); }
.page-head h1 { font-size: 26px; font-weight: var(--fw-semibold); margin: 0; letter-spacing: -.01em; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   Компоненты
   ============================================================ */
.card {
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-radius: 14px; box-shadow: var(--shadow-xs);
}
.card-pad { padding: var(--card-pad); }
.card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 14px var(--card-pad); border-bottom: 1px solid var(--divider);
}
.card-h h2, .card-h h3 { font-size: 15px; font-weight: var(--fw-semibold); margin: 0; }
.card-h .card-sub { font-size: 11.5px; color: var(--text-muted); }
.card-h .card-link { margin-left: auto; font-size: 12.5px; font-weight: var(--fw-medium); color: var(--accent); }
/* Прижать вправо, не навязывая цвет: кнопка на .card-link получала синий текст
   на синем фоне (специфичность .card-h .card-link выше, чем у .btn). */
.card-h .card-act { margin-left: auto; }
.card-ic {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); flex: 0 0 auto;
}
.card-b { padding: var(--card-pad); }

/* KPI-плитки */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--gap); }
.kpi {
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-radius: 14px; box-shadow: var(--shadow-xs); padding: var(--card-pad);
  display: block; color: inherit;
}
a.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); text-decoration: none; }
.kpi-l { font-size: 11px; color: var(--text-muted); font-weight: var(--fw-medium); }
.kpi-v {
  font-size: 26px; font-weight: var(--fw-semibold); line-height: 1.15; margin-top: 6px;
  font-feature-settings: 'tnum' 1; font-variant-numeric: tabular-nums;
}
.kpi-m { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.kpi-m.up { color: var(--success); }
.kpi-m.down { color: var(--danger); }

/* таблицы */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); font-weight: var(--fw-medium);
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}
.tbl td { padding: var(--cell-pad); border-bottom: 1px solid var(--divider); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-hover); }
.tbl .r { text-align: right; }
.tbl .num { font-feature-settings: 'tnum' 1; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
.tbl-title { font-weight: var(--fw-medium); }
.tbl-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

/* чипы, точки, аватары */
.chip {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px;
  padding: 2px 8px; font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
  background: var(--surface-inset); color: var(--text-secondary);
}
.chip-accent  { background: var(--accent-soft);  color: var(--accent); }
.chip-econ    { background: var(--econ-soft);    color: var(--econ); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-danger  { background: var(--danger-soft);  color: var(--danger); }
.chip-warn    { background: var(--warning-soft); color: var(--warning); }
.chip-info    { background: var(--info-soft);    color: var(--info); }
.chip-muted   { background: var(--surface-inset); color: var(--text-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--ink-400); }
.dot-ok { background: var(--success); }
.dot-warn { background: var(--warning); }
.dot-bad { background: var(--danger); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .4 } }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: var(--fw-semibold); flex: 0 0 auto;
}

/* кнопки */
.btn {
  height: var(--control-md); padding: 0 14px; border: 1px solid transparent;
  border-radius: 9px; background: var(--accent); color: var(--text-on-accent);
  font-family: var(--font-sans); font-size: 13px; font-weight: var(--fw-semibold);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background var(--dur-1) var(--ease-out);
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:disabled { background: var(--ink-300); cursor: default; }
.btn-ghost { background: transparent; border-color: var(--border-default); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.btn-sm { height: var(--control-sm); padding: 0 11px; font-size: 12px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8C1B12; }
.link-btn {
  background: none; border: 0; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: var(--fw-medium); padding: 0;
}
.more-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px; background: none; border: 0; border-top: 1px solid var(--divider);
  color: var(--text-tertiary); font-family: inherit; font-size: 12.5px; cursor: pointer;
}
.more-btn:hover { background: var(--surface-hover); }

/* сегментированный переключатель */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-inset); border-radius: 10px; }
.seg > * {
  padding: 5px 11px; border-radius: 8px; border: 0; background: transparent;
  color: var(--text-tertiary); font-family: inherit; font-size: 12.5px;
  font-weight: var(--fw-medium); cursor: pointer;
}
.seg > .on { background: var(--surface-card); color: var(--accent); box-shadow: var(--shadow-xs); }

/* поля */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .label {
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); font-weight: var(--fw-semibold);
}
.input, select.input, textarea.input {
  width: 100%; height: var(--control-md); border: 1px solid var(--border-default);
  border-radius: 9px; padding: 0 11px; font-size: 13px; font-family: var(--font-sans);
  color: var(--text-primary); background: var(--surface-card);
}
textarea.input { height: auto; padding: 9px 11px; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-disabled); }

/* полоса прогресса */
.bar { height: 6px; border-radius: 999px; background: var(--surface-inset); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }

/* модалка — управляется атрибутом hidden (см. static/js/modal.js) */
.modal {
  position: fixed; inset: 0; background: rgba(16,24,40,.45);
  display: flex; align-items: center; justify-content: center; z-index: 80; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); width: 480px; max-width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--divider);
}
.modal-h h3 { font-size: 16px; font-weight: var(--fw-semibold); margin: 0; }
.modal-b { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 0 18px 18px; }

/* пустые состояния */
.empty {
  padding: var(--space-9); text-align: center; color: var(--text-muted); font-size: 13px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
}

/* ============================================================
   Мобильная раскладка
   ============================================================ */
.nav-scrim { display: none; position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 45; }

@media (max-width:880px) {
  .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform var(--dur-2) var(--ease-out); }
  .mob-btn { display: grid; }
  .tb-searchbox { flex: 1 1 auto; }
  .tb-date, .tb-uname, .tb-urole { display: none; }
  .content { padding: 14px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .tb-results { width: min(420px, calc(100vw - 28px)); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-scrim { display: block; }
}

@media (max-width:560px) {
  .kpi-row { grid-template-columns: 1fr; }
}

/* ---------- мелкие табличные помощники ---------- */
.cell-person { display: flex; align-items: center; gap: 10px; }
.inline-form { margin: 0; display: inline-flex; gap: 6px; align-items: center; }
.input-sm { height: var(--control-sm); font-size: 12.5px; padding: 0 8px; width: auto; }
.row-off { opacity: .55; }
.tbl td .chip { margin-right: 4px; }
.alert {
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px;
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid rgba(180,35,24,.25);
}
.alert.ok { background: var(--success-soft); color: var(--success); border-color: rgba(18,128,92,.25); }

/* ---------- страница трат ---------- */
.head-actions { display: flex; gap: 10px; align-items: center; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .seg { margin-left: auto; }
.seg a { text-decoration: none; display: inline-flex; align-items: center; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-cur { font-weight: var(--fw-semibold); font-size: 13px; min-width: 118px; text-align: center; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.cat-list { display: flex; flex-direction: column; gap: 10px; }
.cat-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.cat-row .cat-name { flex: 0 0 170px; display: flex; flex-direction: column; }
.cat-row .bar { flex: 1; }
.cat-row .cat-sum { margin-left: auto; font-weight: var(--fw-medium); white-space: nowrap; }
.kpi-v-sm { font-size: 19px; }
.pair-code { font-size: 28px; letter-spacing: 2px; }
.warn-text { color: var(--warning); }
.field-check { justify-content: center; gap: 6px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); }
@media (max-width:880px) { .cols-2 { grid-template-columns: 1fr; } .toolbar .seg { margin-left: 0; } }

/* ---------- проекты ---------- */
.proj-group { display: flex; flex-direction: column; gap: 10px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.proj-card {
  display: flex; flex-direction: column; gap: 10px; padding: var(--card-pad);
  color: inherit; transition: box-shadow var(--dur-1) var(--ease-out), border-color var(--dur-1);
}
.proj-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); text-decoration: none; }
.proj-card.archived { opacity: .6; }
.pc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pc-name { font-size: 15px; font-weight: var(--fw-semibold); }
.pc-desc { font-size: 12.5px; color: var(--text-tertiary); flex: 1; }
.pc-team { display: flex; align-items: center; gap: 6px; }
.avatar-sm { width: 24px; height: 24px; font-size: 9.5px; }
.pc-team .tbl-sub { margin-left: 4px; }
.pc-budget { display: flex; flex-direction: column; gap: 6px; }
.pc-money { display: flex; justify-content: space-between; font-size: 12.5px; }
.budget-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.team-row { display: flex; flex-wrap: wrap; gap: 8px; }
.team-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 5px;
  border: 1px solid var(--border-default); border-radius: 999px;
  font-size: 12.5px; color: var(--text-primary);
}
.team-chip:hover { background: var(--surface-hover); text-decoration: none; }
.back { display: inline-block; color: var(--text-muted); font-weight: var(--fw-medium); font-size: 13px; }
.link-btn.danger { color: var(--danger); }

/* ---------- базы знаний ---------- */
.bases-layout { display: grid; grid-template-columns: 262px 1fr; gap: var(--gap); align-items: start; }
.tree-panel { padding: 12px; position: sticky; top: calc(var(--topbar-h) + 12px); }
.tree-search { margin-bottom: 8px; }
.tree-list { display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto; }
.tree-project > summary, .tree-branch > summary {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: var(--fw-medium); list-style: none;
}
.tree-project > summary::-webkit-details-marker, .tree-branch > summary::-webkit-details-marker { display: none; }
.tree-project > summary:hover, .tree-branch > summary:hover { background: var(--surface-hover); }
.tree-project > summary span:first-of-type, .tree-branch > summary span:first-of-type { flex: 1; }
.tree-branch { margin-left: 14px; }
.tree-branch > summary { color: var(--text-secondary); font-weight: var(--fw-regular); }
.tree-file {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px 6px 24px;
  border-radius: 8px; font-size: 12.5px; color: var(--text-secondary);
}
.tree-file:hover { background: var(--surface-hover); text-decoration: none; }
.tree-file.on { background: var(--accent-soft); color: var(--accent); font-weight: var(--fw-semibold); }
.tree-file > span:first-of-type, .tree-file > span:nth-of-type(1) { flex: 1; display: block; }
.tree-empty, .tree-del { padding: 4px 8px 4px 24px; font-size: 11.5px; color: var(--text-disabled); }
.file-panel { min-height: 320px; }
.tabbar { display: flex; gap: 4px; padding: 0 var(--card-pad); border-bottom: 1px solid var(--divider); }
.tab {
  padding: 10px 12px; font-size: 13px; font-weight: var(--fw-medium);
  color: var(--text-tertiary); border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.md-body h2 { font-size: 19px; margin: 18px 0 8px; font-weight: var(--fw-semibold); }
.md-body h3 { font-size: 16px; margin: 16px 0 6px; font-weight: var(--fw-semibold); }
.md-body h4 { font-size: 14px; margin: 14px 0 6px; font-weight: var(--fw-semibold); }
.md-body p { margin: 0 0 10px; color: var(--text-secondary); }
.md-body ul { margin: 0 0 12px 18px; color: var(--text-secondary); }
.md-body li { margin-bottom: 4px; }
.md-code {
  background: var(--surface-inset); border-radius: var(--radius-sm); padding: 12px;
  font-family: var(--font-mono); font-size: 12.5px; overflow-x: auto; margin: 0 0 12px;
}
.md-callout {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 10px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px; margin: 0 0 12px;
}
.md-edit { border-top: 1px solid var(--divider); }
.md-area { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; }
.diff { font-family: var(--font-mono); font-size: 12.5px; }
.diff-line { padding: 2px 8px; border-radius: 4px; white-space: pre-wrap; }
.diff-add { background: rgba(18,128,92,.10); color: var(--success); }
.diff-del { background: rgba(180,35,24,.08); color: var(--danger); }
.diff-meta { color: var(--text-muted); }
.diff-sign { display: inline-block; width: 14px; color: var(--text-muted); }
.pdf-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
.pdf-frame { width: 100%; height: 620px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); }
/* Отчёт живёт во фрейме-песочнице: высота фиксированная, потому что документ
   без allow-same-origin не может сообщить свой размер, а спрашивать его
   через postMessage — значит доверять чужому содержимому. */
.page-frame { width: 100%; height: 78vh; min-height: 520px; border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); background: var(--surface); }
.page-actions { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
/* ============ Базы · Хронология: единая ось времени, ветки-дорожки ============ */
.tl { --tl-gutter: 200px; padding: 20px 22px 28px; overflow: visible; }
.tl-head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; }
.tl-legend { display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--text-secondary); }
.tl-legend-cap { color: var(--text-muted); margin-left: 10px; }
.tl-syncdot { display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  background: var(--econ); box-shadow: 0 0 0 3px var(--econ-soft); vertical-align: middle;
  flex: none; }

.tl-axisrow, .tl-lane { display: grid; grid-template-columns: var(--tl-gutter) 1fr; }
.tl-axisrow { margin: 16px 0 2px; }
.tl-axis-track { grid-column: 2; position: relative; height: 24px; }
.tl-tick { position: absolute; top: 5px; transform: translateX(-50%); font-size: 12px;
  color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-tick.today { top: 1px; color: var(--accent); font-weight: var(--fw-semibold);
  font-size: 10.5px; letter-spacing: .06em; background: var(--accent-soft);
  padding: 3px 9px; border-radius: var(--radius-pill); }

.tl-body { position: relative; display: flex; flex-direction: column; gap: 24px;
  padding-top: 2px; }
.tl-grid-layer { position: absolute; top: 0; bottom: 6px; left: var(--tl-gutter);
  right: 0; pointer-events: none; z-index: 0; }
.tl-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--border-subtle); }
.tl-grid.today { border-left: 1px dashed var(--border-default); }

.tl-project { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; }
.tl-project.dim, .tl-lane.dim { opacity: .4; }
.tl-proot { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.tl-proot .tbl-sub { margin-left: 6px; }

.tl-lane { --branch: var(--accent); align-items: center; min-height: 38px; }
.tl-lane-name { font-size: 13.5px; font-weight: var(--fw-semibold); line-height: 1.25;
  padding-right: 16px; }
.tl-lane-name .tbl-sub { display: block; font-weight: var(--fw-regular); }
.tl-track { grid-column: 2; position: relative; height: 38px; }
.tl-base { position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  transform: translateY(-50%); background: var(--border-subtle); border-radius: 2px; }
.tl-conn { position: absolute; top: 50%; height: 3px; transform: translateY(-50%);
  background: color-mix(in srgb, var(--branch) 45%, transparent); border-radius: 3px; }
.tl-pt { position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 24px; height: 24px; display: grid; place-items: center; cursor: pointer; z-index: 2; }
.tl-pt:focus { outline: none; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--branch);
  box-shadow: 0 0 0 3px var(--surface-card), 0 1px 3px rgba(16,24,40,.28);
  transition: transform var(--dur-1) var(--ease-out); }
.tl-pt:hover .tl-dot, .tl-pt:focus-visible .tl-dot { transform: scale(1.3); }
.tl-pt.synced .tl-dot { background: var(--econ);
  box-shadow: 0 0 0 3px var(--surface-card), 0 0 0 5px var(--econ-soft); }
.tl-pt.hit .tl-dot { box-shadow: 0 0 0 3px var(--surface-card), 0 0 0 6px var(--accent-soft-2); }

.tl-tip { position: absolute; bottom: calc(100% + 9px); left: 50%;
  transform: translateX(-50%) translateY(5px); min-width: 220px; max-width: 320px;
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop); padding: 10px;
  opacity: 0; visibility: hidden; z-index: 30;
  transition: opacity var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.tl-tip::before { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 11px; }
.tl-tip::after { content: ""; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--surface-card); }
.tl-pt:hover .tl-tip, .tl-pt:focus-within .tl-tip {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.tl-pt.flip .tl-tip { left: auto; right: 50%; transform: translateX(50%) translateY(5px); }
.tl-pt.flip .tl-tip::after { left: auto; right: 50%; transform: translateX(50%); }
.tl-pt.flip:hover .tl-tip, .tl-pt.flip:focus-within .tl-tip { transform: translateX(50%) translateY(0); }
.tl-tip-h { display: block; font-size: 12px; font-weight: var(--fw-semibold);
  color: var(--text-secondary); padding: 0 4px 8px; border-bottom: 1px solid var(--divider);
  margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.tl-tip-f { display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary); text-decoration: none; }
.tl-tip-f > span:first-of-type { flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.tl-tip-f:hover { background: var(--surface-hover); }
.tl-tip-f.hit { background: var(--accent-soft); color: var(--accent); }
.tl-none { position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-size: 12px; }

/* ============ Базы · Схема: проект → ветка → файл (граф) ============ */
.scheme { padding: 16px 20px 22px; }
.scheme-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--divider); }
.scheme-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.scheme-pill { padding: 8px 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-default); background: var(--surface-card);
  color: var(--text-secondary); font-weight: var(--fw-semibold); font-size: 14px;
  cursor: pointer; transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1); }
.scheme-pill:hover { background: var(--surface-hover); }
.scheme-hint { margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted); }

.scheme-panel { display: none; }
.scheme-root { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  border-radius: var(--radius-lg); background: var(--ink-900); color: #fff;
  margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.scheme-root .tbl-sub { color: rgba(255,255,255,.62); }

.scheme-branches { position: relative; padding-left: 30px; display: flex;
  flex-direction: column; gap: 14px; }
.scheme-branches::before { content: ""; position: absolute; left: 14px; top: -14px;
  height: calc(100% - 18px); border-left: 2px solid var(--border-default); }
.scheme-branch { --branch: var(--accent); position: relative; display: flex;
  align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.scheme-branch::before { content: ""; position: absolute; left: -16px; top: 17px;
  width: 16px; height: 2px; background: var(--border-default); border-radius: 2px; }
.scheme-bpill { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px;
  border-radius: var(--radius-pill); background: var(--surface-sunken);
  font-weight: var(--fw-semibold); font-size: 14px; white-space: nowrap; flex: none; }
.scheme-bdot { width: 9px; height: 9px; border-radius: 50%; background: var(--branch); flex: none; }
.scheme-files { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 3px; }
.scheme-file { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--surface-card); box-shadow: var(--shadow-xs); text-decoration: none;
  color: var(--text-primary); font-size: 13.5px; font-weight: var(--fw-medium);
  transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.scheme-file:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.scheme-fname { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scheme-nofiles { padding-top: 8px; }

/* переключение проектов «Схемы» без JS: n-й включённый radio открывает n-ю панель и красит n-ю таблетку */
.scheme-radio:nth-of-type(1):checked ~ .scheme-stage > .scheme-panel:nth-of-type(1),
.scheme-radio:nth-of-type(2):checked ~ .scheme-stage > .scheme-panel:nth-of-type(2),
.scheme-radio:nth-of-type(3):checked ~ .scheme-stage > .scheme-panel:nth-of-type(3),
.scheme-radio:nth-of-type(4):checked ~ .scheme-stage > .scheme-panel:nth-of-type(4),
.scheme-radio:nth-of-type(5):checked ~ .scheme-stage > .scheme-panel:nth-of-type(5),
.scheme-radio:nth-of-type(6):checked ~ .scheme-stage > .scheme-panel:nth-of-type(6),
.scheme-radio:nth-of-type(7):checked ~ .scheme-stage > .scheme-panel:nth-of-type(7),
.scheme-radio:nth-of-type(8):checked ~ .scheme-stage > .scheme-panel:nth-of-type(8) { display: block; }
.scheme-radio:nth-of-type(1):checked ~ .scheme-bar .scheme-pill:nth-of-type(1),
.scheme-radio:nth-of-type(2):checked ~ .scheme-bar .scheme-pill:nth-of-type(2),
.scheme-radio:nth-of-type(3):checked ~ .scheme-bar .scheme-pill:nth-of-type(3),
.scheme-radio:nth-of-type(4):checked ~ .scheme-bar .scheme-pill:nth-of-type(4),
.scheme-radio:nth-of-type(5):checked ~ .scheme-bar .scheme-pill:nth-of-type(5),
.scheme-radio:nth-of-type(6):checked ~ .scheme-bar .scheme-pill:nth-of-type(6),
.scheme-radio:nth-of-type(7):checked ~ .scheme-bar .scheme-pill:nth-of-type(7),
.scheme-radio:nth-of-type(8):checked ~ .scheme-bar .scheme-pill:nth-of-type(8) {
  background: var(--accent-soft); border-color: var(--border-accent); color: var(--accent); }

@media (max-width:880px) {
  .bases-layout { grid-template-columns: 1fr; }
  .tree-panel { position: static; }
  .tl { --tl-gutter: 116px; }
  .tl-legend-cap { display: none; }
}

/* ---------- дашборд, уведомления, схема ---------- */
.weeks { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.week { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.week-v { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.week-bar { width: 100%; border-radius: 6px 6px 0 0; background: var(--series-1); min-height: 4px; }
.week-l { font-size: 11px; color: var(--text-muted); }
.total-row { border-top: 1px solid var(--divider); padding-top: 8px; font-weight: var(--fw-semibold); }
a.cat-row { color: inherit; }
a.cat-row:hover { text-decoration: none; background: var(--surface-hover); border-radius: 8px; }
.notif-list { display: flex; flex-direction: column; gap: 2px; }
.notif { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 9px; margin: 0; }
.notif:hover { background: var(--surface-hover); }
.notif.unread { background: var(--surface-card-2); }
.notif-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.notif-body { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit; padding: 0; }
.notif-title { font-size: 13px; color: var(--text-primary); }
.notif.unread .notif-title { font-weight: var(--fw-semibold); }
.dot-unread-mark { background: var(--accent); }
.flow-row { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 12px; align-items: center; }
.flow-arrow { color: var(--text-disabled); display: grid; place-items: center; }
.flow-step { align-self: stretch; }
.flow-file { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--border-default); border-radius: 9px; font-size: 12.5px; }
.flow-kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0;
  border-bottom: 1px solid var(--divider); font-size: 12.5px; }
.flow-kv span:first-child { color: var(--text-muted); }
.flow-views { display: flex; flex-direction: column; gap: 10px; }
.flow-view { color: inherit; }
.flow-view:hover { text-decoration: none; border-color: var(--border-strong); }
.flow-view-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.flow-view-h .card-link { margin-left: auto; }
.rules { display: flex; flex-direction: column; gap: 10px; }
.rule { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-secondary); }
.rule svg { flex: 0 0 auto; margin-top: 2px; color: var(--accent); }
@media (max-width:880px) {
  .flow-row { grid-template-columns: 1fr; }
  .flow-arrow { transform: rotate(90deg); }
}
.tb-res-t { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-res-s { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.tb-empty { padding: 4px; font-size: 12.5px; color: var(--text-muted); }

/* ---------- диалог подтверждения ---------- */
.confirm-card { width: 420px; }
.confirm-card .modal-b { gap: 8px; }
.confirm-ic {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; background: var(--accent-soft); color: var(--accent);
}
.confirm-ic.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-title { font-size: 16px; font-weight: var(--fw-semibold); margin: 4px 0 0; }
.confirm-text { margin: 0; color: var(--text-secondary); font-size: 13.5px; }

/* ---------- генератор паролей ---------- */
.pw-layout { display: grid; grid-template-columns: minmax(0, 460px) 1fr; gap: var(--gap); align-items: start; }
.pw-quick .card-b { display: flex; flex-direction: column; gap: 12px; }
.pw-out { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px;
  background: var(--accent-soft); border-radius: var(--radius-sm); }
.pw-value { font-size: 18px; letter-spacing: .04em; color: var(--accent); word-break: break-all; user-select: all; }
.pw-err { color: var(--danger); font-size: 13px; }
.icon-x { border: none; background: transparent; color: var(--text-muted); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 6px; border-radius: var(--radius-sm); }
.icon-x:hover { color: var(--danger); background: var(--danger-soft); }
.edit-inline { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
@media (max-width:880px) { .pw-layout { grid-template-columns: 1fr; } }
.check-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 8px; }
.check-grid .check { flex: 0 0 auto; }

/* ---------- выбор файла ---------- */
/* Нативный input[type=file] со стилями обычного поля выглядит зажатым: высота 34px
   не вмещает кнопку «Обзор…». Даём ему своё оформление. */
.input[type="file"] {
  height: auto; padding: 7px 10px; line-height: 1.5;
  font-size: 12.5px; color: var(--text-secondary); cursor: pointer;
}
.input[type="file"]::file-selector-button {
  margin: 0 10px 0 0; padding: 5px 12px; border: 1px solid var(--border-default);
  border-radius: 8px; background: var(--surface-card); color: var(--text-secondary);
  font-family: inherit; font-size: 12.5px; font-weight: var(--fw-medium); cursor: pointer;
}
.input[type="file"]::file-selector-button:hover {
  background: var(--surface-hover); border-color: var(--border-strong); color: var(--text-primary);
}
.md-body .md-table { margin: 0 0 14px; }
.md-body .md-table th { font-family: var(--font-sans); font-size: 12px; text-transform: none; letter-spacing: 0; }
.md-hr { border: 0; border-top: 1px solid var(--divider); margin: 16px 0; }
.md-body code {
  font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-inset);
  padding: 1px 5px; border-radius: 5px;
}
.md-body b { font-weight: var(--fw-semibold); color: var(--text-primary); }
.md-body ol { margin: 0 0 12px 20px; color: var(--text-secondary); }
.md-body a { text-decoration: underline; }
.upload-version { border-bottom: 1px solid var(--divider); }

/* ============================================================
   Расписание
   Неделя — список карточек-дней; с 1000px раскладывается в семь колонок,
   потому что вся неделя на одном экране читается быстрее, чем длинный столбец.
   ============================================================ */
.sch-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-5); margin: var(--space-6) 0 var(--space-5);
  flex-wrap: wrap;
}
.sch-nav { display: inline-flex; gap: var(--space-2); margin-left: auto; }
.sch-nav .btn { min-width: 38px; justify-content: center; }

.sch-week { display: grid; gap: var(--space-4); grid-template-columns: 1fr; align-items: start; }
.sch-day { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.sch-day.is-today { border-color: var(--border-accent); box-shadow: var(--shadow-sm); }
.sch-day.is-weekend .sch-day-name { color: var(--text-muted); }
.sch-day-h { display: flex; align-items: baseline; gap: var(--space-4); }
.sch-day-name { font-size: 14px; font-weight: var(--fw-semibold); color: var(--text-primary); }
.sch-day-date { font-size: 12.5px; color: var(--text-muted); margin-left: auto; }

.sch-list { display: flex; flex-direction: column; gap: var(--space-2); }
.sch-ev {
  display: flex; gap: var(--space-5); align-items: flex-start;
  padding: var(--space-4) var(--space-4) var(--space-4) 0;
  border-top: 1px solid var(--divider);
}
.sch-list > .sch-ev:first-child { border-top: none; padding-top: 0; }
.sch-ev-time { flex: 0 0 58px; display: flex; flex-direction: column; line-height: 1.25; }
.sch-t1 { font-size: 15px; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.sch-t2 { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sch-allday { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.sch-ev-body { flex: 1 1 auto; min-width: 0; }
.sch-ev-title { font-size: 14.5px; font-weight: var(--fw-medium); color: var(--text-primary); }
.sch-ev-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.sch-ev-note { font-size: 12.5px; color: var(--text-tertiary); margin-top: var(--space-2); }
.sch-ev-act { flex: 0 0 auto; }
.sch-ev-act .icon-x:hover { color: var(--accent); background: var(--accent-soft); }
.sch-free { font-size: 12.5px; color: var(--text-disabled); }
.sch-del { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-5);
  padding-top: var(--space-5); border-top: 1px solid var(--divider); }
.sel-sm select { font-size: 12.5px; padding: 4px 24px 4px 8px; }

@media (min-width: 1000px) {
  .sch-week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-3);
              align-items: stretch; }
  .sch-day { padding: var(--space-4); min-height: 132px; }
  .sch-day-h { flex-direction: column; align-items: flex-start; gap: 0; }
  .sch-day-date { margin-left: 0; }
  .sch-ev { flex-direction: column; gap: var(--space-1); padding-right: 0; }
  .sch-ev-time { flex: none; flex-direction: row; gap: var(--space-2); align-items: baseline; }
  .sch-t1 { font-size: 13px; }
  .sch-ev-act { position: absolute; right: 6px; opacity: 0; }
  .sch-ev:hover .sch-ev-act, .sch-ev:focus-within .sch-ev-act { opacity: 1; }
  .sch-ev { position: relative; }
}
