/* Каркас приложения lAIght.space: остров с разделами и экраны разделов (design/app_shell).
   Токены фирменного слоя — в brand.css; здесь — дополнительные и компоненты. */
:root {
  --lg-surface-2: #141a1c;
  --lg-line-hover: #2a3438;
  --lg-line-strong: #3a464a;
  --lg-green: oklch(0.78 0.14 155);
  --lg-amber: oklch(0.83 0.14 80);
  --lg-accent-soft: oklch(0.82 0.13 205 / 0.12);
  --lg-accent-line: oklch(0.82 0.13 205 / 0.45);
  --lg-danger-text: oklch(0.78 0.12 25);
  --island-w: 240px;
  --island-gap: 16px;
}
.island-collapsed { --island-w: 72px; }

body:not(.page-login) { background: var(--lg-bg); color: var(--lg-text); font-family: var(--lg-font); }
body:not(.page-login) a { color: var(--lg-accent); }
body:not(.page-login) a:hover { color: var(--lg-accent-link-hover); text-decoration: none; }
:focus-visible { outline: 2px solid var(--lg-accent); outline-offset: 2px; }
.mono { font-family: var(--lg-mono); }

/* ---------- Остров ---------- */

.island {
  position: fixed;
  z-index: 20;
  top: var(--island-gap);
  left: var(--island-gap);
  height: calc(100vh - 2 * var(--island-gap));
  width: var(--island-w);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgb(0 0 0 / 0.35);
  overflow: visible;
}
.shell-ready .island { transition: width 200ms var(--lg-ease), transform 220ms var(--lg-ease); }

.island__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 4px;
  border-radius: 8px;
  color: var(--lg-text) !important;
  white-space: nowrap;
  overflow: hidden;
}
.logo-mark { flex: none; }
.island__logotype { font-size: 18px; }

.island__new { width: 100%; height: 40px; }
.island__nav { display: flex; flex-direction: column; gap: 4px; }
.island__spacer { flex: 1; }

.nav-item {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 10px;
  overflow: hidden;
  color: var(--lg-text-2) !important;
  font-size: 15px;
  white-space: nowrap;
}
.nav-item:hover { background: rgb(255 255 255 / 0.04); color: var(--lg-text) !important; }
.nav-item--active, .nav-item--active:hover { background: var(--lg-accent-soft); color: var(--lg-accent) !important; }
.nav-item--active:hover { background: oklch(0.82 0.13 205 / 0.16); }
.nav-item--active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--lg-accent);
}
.nav-item__icon { position: relative; flex: none; display: grid; place-items: center; }
.nav-item__label { flex: 1; }
.nav-item__count { font-family: var(--lg-mono); font-size: 12px; color: var(--lg-text-3); }
.nav-item__count--attention {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: oklch(0.83 0.14 80 / 0.16);
  color: var(--lg-amber);
  font-weight: 500;
  text-align: center;
}
.nav-item__pulse {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lg-accent);
  animation: lg-pulse 1.8s ease-out infinite;
}
@keyframes lg-pulse {
  0% { box-shadow: 0 0 0 0 oklch(0.82 0.13 205 / 0.7); }
  70% { box-shadow: 0 0 0 6px oklch(0.82 0.13 205 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.82 0.13 205 / 0); }
}
@media (prefers-reduced-motion: reduce) { .nav-item__pulse { animation: none; } }
/* Точка-счётчик видна только у свёрнутого острова. */
.nav-item__dot {
  display: none;
  position: absolute;
  top: -3px;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lg-text-3);
  border: 2px solid var(--lg-surface);
}
.nav-item__dot--attention { background: var(--lg-amber); }

.island__footer { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--lg-line); }
.island__user { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lg-line);
  color: var(--lg-text);
  font-size: 14px;
  font-weight: 500;
}
.island__who { min-width: 0; display: flex; flex-direction: column; }
.island__name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.island__email { font-size: 12px; color: var(--lg-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.island__logout { flex: none; margin: 0; }
.island__collapse {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--lg-text-3);
  font: 13px var(--lg-font);
  cursor: pointer;
  white-space: nowrap;
}
.island__collapse:hover { background: rgb(255 255 255 / 0.04); color: var(--lg-text-2); }
.island__chevron { flex: none; transition: transform 200ms; }

/* Свёрнутый остров: только иконки, подписи — в title. */
.island-collapsed .island__label { display: none; }
.island-collapsed .island__brand,
.island-collapsed .nav-item,
.island-collapsed .island__user,
.island-collapsed .island__collapse { justify-content: center; }
.island-collapsed .island__brand { padding: 0; }
.island-collapsed .island__new { padding: 0; }
.btn svg, .nav-item svg { flex: none; }
.island-collapsed .nav-item__dot { display: block; }
.island-collapsed .island__chevron { transform: rotate(180deg); }

.icon-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--lg-line-field);
  border-radius: 10px;
  color: var(--lg-text);
  cursor: pointer;
}
.icon-button--quiet { border: none; border-radius: 8px; color: var(--lg-text-2); }
.icon-button--quiet:hover { background: rgb(255 255 255 / 0.05); color: var(--lg-text); }

/* Мобильная полоса и выезжающий остров */
.mobile-bar, .island-scrim { display: none; }

/* ---------- Контент ---------- */

.shell-main {
  padding: 40px 24px 96px calc(var(--island-w) + var(--island-gap) + 24px);
}
.shell-ready .shell-main { transition: padding-left 200ms var(--lg-ease); }
.shell-page { max-width: 1120px; display: flex; flex-direction: column; gap: 28px; }
/* Экраны задач (мастера на Dash) — прежняя широкая страница, но внутри каркаса. */
.shell-main .page { max-width: 1440px; margin: 0; padding: 0; }
.shell-main .messages { margin: 0; }

@media (max-width: 767px) {
  :root, .island-collapsed { --island-w: 264px; }
  .island-collapsed .island__label { display: revert; }
  .island-collapsed .island__brand, .island-collapsed .nav-item, .island-collapsed .island__user,
  .island-collapsed .island__collapse { justify-content: flex-start; }
  .island-collapsed .nav-item__dot { display: none; }
  .island-collapsed .nav-item__label, .island-collapsed .island__who { display: flex; }

  .island { transform: translateX(-300px); }
  .drawer-open .island { transform: none; }
  .island__collapse { display: none; }
  .island-scrim { position: fixed; inset: 0; z-index: 19; background: rgb(0 0 0 / 0.6); }
  .drawer-open .island-scrim { display: block; }

  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 56px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--lg-bg);
    border-bottom: 1px solid var(--lg-line);
  }
  .mobile-bar__brand { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--lg-text) !important; }
  .mobile-bar__logotype { font-size: 17px; }
  .mobile-bar__menu { width: 44px; height: 44px; }

  .shell-main { padding: 20px 16px 96px; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--lg-text);
  font: 500 14px var(--lg-font);
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn--primary, a.btn--primary { background: var(--lg-accent); color: var(--lg-on-accent) !important; }
.btn--primary:not(:disabled):hover { background: var(--lg-accent-hover); }
.btn--secondary, a.btn--secondary { border-color: var(--lg-accent-line); color: var(--lg-accent) !important; font-weight: 400; }
.btn--secondary:hover { background: oklch(0.82 0.13 205 / 0.1); }
.btn--ghost, a.btn--ghost { border-color: var(--lg-line-field); color: var(--lg-text) !important; font-weight: 400; }
.btn--ghost:hover { border-color: var(--lg-line-strong); }
.btn--muted { color: var(--lg-text-2) !important; }
.btn--muted:hover { color: var(--lg-text) !important; }
.btn--danger-hover:hover { color: var(--lg-danger-text) !important; border-color: oklch(0.7 0.17 25 / 0.5); }
.btn--sm { padding: 7px 14px; border-radius: 8px; font-size: 13px; }
.btn--xs { padding: 6px 12px; border-radius: 8px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--mono { font-family: var(--lg-mono); font-size: 12px; gap: 6px; padding: 7px 12px; border-radius: 8px; }
.link-button { padding: 0; background: none; border: none; color: var(--lg-accent); font: inherit; cursor: pointer; }
.link-button:hover { color: var(--lg-accent-link-hover); }
.inline-form { display: inline; margin: 0; }

/* ---------- Меню ---------- */

.menu-anchor { position: relative; }
.popover {
  position: absolute;
  top: calc(100% + 8px);
  z-index: 40;
  width: 320px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--lg-surface-2);
  border: 1px solid var(--lg-line-field);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.5);
}
.popover[hidden] { display: none; }
.popover--left { left: 0; }
.popover--right { right: 0; }
.popover--up { top: auto; bottom: calc(100% + 8px); }
.popover--narrow { width: 220px; border-radius: 12px; }
.new-task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  color: var(--lg-text) !important;
  text-align: left;
}
.new-task:hover { background: rgb(255 255 255 / 0.05); }
.new-task__icon {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--lg-accent-soft);
  color: var(--lg-accent);
}
.new-task__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.new-task__title { font-size: 14px; font-weight: 500; }
.new-task__description { font-size: 13px; line-height: 1.45; color: var(--lg-text-2); white-space: normal; }
.menu-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--lg-text) !important;
  font: 14px var(--lg-font);
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: rgb(255 255 255 / 0.05); }

/* ---------- Шапка раздела ---------- */

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--lg-line);
}
.section-header__text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.section-header__title { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.section-header__lead { margin: 0; color: var(--lg-text-2); text-wrap: pretty; }
.section-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.section-header--stacked { flex-direction: column; align-items: stretch; gap: 14px; }
.section-header--stacked .section-header__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--lg-text-3); }
.crumbs a { color: var(--lg-text-2) !important; }
.crumbs a:hover { color: var(--lg-text) !important; }
.crumbs__current { color: var(--lg-text); }

/* ---------- Вкладки и сегменты ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  align-self: flex-start;
  max-width: 100%;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  border-radius: 12px;
}
.tabs__item { padding: 8px 16px; border-radius: 8px; color: var(--lg-text-2) !important; font-size: 14px; }
.tabs__item:hover { color: var(--lg-text) !important; }
.tabs__item--active { background: var(--lg-line); color: var(--lg-text) !important; }
.tabs__count { margin-left: 6px; font-family: var(--lg-mono); font-size: 12px; color: var(--lg-text-3); }

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--lg-surface);
  border: 1px solid var(--lg-line);
  border-radius: 10px;
}
.seg--sunken { background: var(--lg-bg); }
.seg--fill .seg__item { flex: 1; text-align: center; }
.seg__item { padding: 6px 12px; border-radius: 7px; color: var(--lg-text-2) !important; font-size: 13px; }
.seg__item:hover { color: var(--lg-text) !important; }
.seg__item--active { background: var(--lg-line); color: var(--lg-text) !important; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.search {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  background: var(--lg-bg);
  border: 1px solid var(--lg-line-field);
  border-radius: 10px;
  color: var(--lg-text-3);
}
.search:focus-within { border-color: var(--lg-accent); }
.search input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--lg-text); font: 14px var(--lg-font); }
.search input::placeholder { color: var(--lg-placeholder); }
.select {
  height: 36px;
  padding: 0 10px;
  background: var(--lg-surface);
  color: var(--lg-text-2);
  border: 1px solid var(--lg-line);
  border-radius: 10px;
  font: 13px var(--lg-font);
}

/* ---------- Общие элементы ---------- */

.card { background: var(--lg-surface); border: 1px solid var(--lg-line); border-radius: 14px; min-width: 0; }
.card--pad { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card__title { margin: 0; font-size: 15px; font-weight: 500; }
.card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.muted-note { margin: 0; font-size: 13px; color: var(--lg-text-2); }
.meta-text { font-size: 13px; color: var(--lg-text-3); }

.section { display: flex; flex-direction: column; gap: 14px; }
.section__head { display: flex; align-items: baseline; gap: 10px; }
.section__title { margin: 0; font-size: 17px; font-weight: 500; }
.section__count { font-family: var(--lg-mono); font-size: 13px; color: var(--lg-text-3); }
.section__count--attention { color: var(--lg-amber); }
.stack-lg { display: flex; flex-direction: column; gap: 36px; }

.pchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pchip {
  padding: 3px 8px;
  border: 1px solid var(--lg-line-field);
  border-radius: 6px;
  font-family: var(--lg-mono);
  font-size: 12px;
  color: var(--lg-text-2);
  white-space: nowrap;
}
.pchips--tight .pchip { padding: 2px 7px; }

/* Статус: цвет текста/точки и фон пилюли */
.st--completed { --st-c: var(--lg-green); --st-bg: oklch(0.78 0.14 155 / 0.14); }
.st--running { --st-c: var(--lg-accent); --st-bg: oklch(0.82 0.13 205 / 0.14); }
.st--awaiting_input { --st-c: var(--lg-amber); --st-bg: oklch(0.83 0.14 80 / 0.14); }
.st--failed { --st-c: var(--lg-danger); --st-bg: oklch(0.7 0.17 25 / 0.14); }
.st--queued, .st--cancelling { --st-c: var(--lg-text-2); --st-bg: rgb(255 255 255 / 0.06); }
.st--cancelled, .st--draft { --st-c: var(--lg-text-3); --st-bg: rgb(255 255 255 / 0.04); }
.status-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--st-bg);
  color: var(--st-c);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.status-pill::before, .status-dot { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--st-c); }
.status-dot { display: block; width: 8px; height: 8px; }

.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-track { flex: 1; height: 4px; border-radius: 4px; background: var(--lg-line); overflow: hidden; }
.progress-track--mini { flex: none; width: 44px; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--lg-accent); transition: width 0.4s ease; }
.progress-value { width: 38px; text-align: right; font-family: var(--lg-mono); font-size: 12px; }

.error-box {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: oklch(0.7 0.17 25 / 0.08);
  color: var(--lg-danger-text);
  font-family: var(--lg-mono);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty {
  padding: 72px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  background: var(--lg-surface);
  border: 1px dashed var(--lg-line-field);
  border-radius: 16px;
  color: var(--lg-text-3);
}
.empty__title { margin: 0; font-size: 18px; font-weight: 500; color: var(--lg-text); }
.empty__text { margin: 0; max-width: 420px; color: var(--lg-text-2); line-height: 1.55; }
.empty .btn { margin-top: 6px; }

.table-wrap { overflow-x: auto; background: var(--lg-surface); border: 1px solid var(--lg-line); border-radius: 14px; }
.data-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 14px; }
.data-table--narrow { min-width: 820px; }
.data-table th { height: 40px; padding: 0 12px; font-size: 12px; font-weight: 400; color: var(--lg-text-3); text-align: left; white-space: nowrap; }
.data-table td { height: 44px; padding: 0 12px; border-top: 1px solid var(--lg-line); }
.data-table tr:hover td { background: rgb(255 255 255 / 0.02); }
.data-table th:first-child, .data-table td:first-child { padding-left: 18px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 18px; }
.data-table .cell-dot { width: 36px; padding-right: 0; }
.data-table .cell-name { min-width: 220px; padding-top: 10px; padding-bottom: 10px; overflow-wrap: anywhere; }
.data-table .cell-name a { color: var(--lg-text) !important; }
.data-table .cell-name a:hover { color: var(--lg-accent) !important; }
.data-table .cell-muted { color: var(--lg-text-2); white-space: nowrap; }
.data-table .cell-mono { font-family: var(--lg-mono); font-size: 12.5px; color: var(--lg-text-2); white-space: nowrap; }
.data-table .cell-action { text-align: right; white-space: nowrap; font-size: 13px; }
.table-empty { margin: 0; padding: 32px; text-align: center; color: var(--lg-text-3); font-size: 14px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; color: var(--lg-text-3); }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.two-col { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.two-col__main { flex: 2 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.two-col__side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--lg-line);
  border: 1px solid var(--lg-line);
  border-radius: 14px;
  overflow: hidden;
}
.facts__item { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--lg-surface); }
.facts__item dt { font-size: 12px; color: var(--lg-text-3); }
.facts__item dd { margin: 0; font-family: var(--lg-mono); font-size: 17px; }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--lg-text-2); }
.legend__item { display: flex; align-items: center; gap: 6px; }
.legend__item::before { content: ""; width: 14px; border-top: 2px solid var(--lg-accent); }
.legend__item--amber::before { border-top-color: var(--lg-amber); }
.legend__item--dashed::before { border-top-style: dashed; }
.chart { display: block; width: 100%; height: auto; }
.chart text { font-family: var(--lg-mono); font-size: 11px; fill: var(--lg-text-3); }
.chart .chart__grid { stroke: var(--lg-line); }
.chart .chart__axis { stroke: var(--lg-line-strong); fill: none; }
.chart .chart__main { stroke: var(--lg-accent); stroke-width: 2; fill: none; }
.chart .chart__second { stroke: var(--lg-amber); stroke-width: 1.6; fill: none; }
.chart .chart__second--dashed { stroke-dasharray: 5 4; }
.chart .chart__n { fill: var(--lg-accent); }
.chart .chart__k { fill: var(--lg-amber); }

/* ---------- Задачи ---------- */

.attn-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 24px;
  padding: 22px 24px 22px 28px;
}
.attn-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--st-c); }
.attn-card:hover, .run-card:hover { border-color: var(--lg-line-hover); }
.attn-card__body { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.attn-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.attn-card__title { margin: 0; font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.task-link { color: var(--lg-text) !important; }
.task-link:hover { color: var(--lg-accent) !important; }
.attn-card__sub { font-size: 13px; color: var(--lg-text-2); }
.attn-card__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.run-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
@media (max-width: 400px) { .run-grid { grid-template-columns: minmax(0, 1fr); } }
.run-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.run-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.run-card__title { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.run-card__type { margin-top: 8px; font-size: 13px; color: var(--lg-text-3); }
.run-card__stage { font-size: 13px; color: var(--lg-text-2); }
.run-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--lg-line); margin-top: auto; }
.run-card__time { font-size: 12px; color: var(--lg-text-3); }

.recent { margin: 0; font-size: 14px; color: var(--lg-text-2); }

.row-list { overflow: hidden; }
.row-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--lg-line);
}
.row-list__item:last-child { border-bottom: none; }
.row-list__item:hover { background: rgb(255 255 255 / 0.02); }
.row-list__body { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.row-list__title { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.row-list__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--lg-text-3); }
.row-list__hint { color: var(--lg-text-2); }
.row-list__actions { display: flex; gap: 8px; }

/* ---------- Библиотеки ---------- */

.lib-card { position: relative; display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.lib-card:hover { border-color: #2e393c; }
.lib-card__open { color: var(--lg-text) !important; }
/* Вся карточка кликабельна; кнопки внизу — поверх ссылки. */
.lib-card__open::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
.lib-card__open:focus-visible { outline: none; }
.lib-card__open:focus-visible::after { outline: 2px solid var(--lg-accent); outline-offset: 2px; }
.lib-card__head { display: flex; flex-direction: column; gap: 6px; }
.lib-card__title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lib-card__title { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.tag { flex: none; padding: 2px 8px; border-radius: 999px; background: rgb(255 255 255 / 0.06); color: var(--lg-text-2); font-size: 12px; }
.lib-card__author { font-size: 12px; color: var(--lg-text-3); }
.lambda { font-family: var(--lg-mono); font-size: 28px; letter-spacing: -0.02em; }
.lambda__sym { color: var(--lg-text-3); }
.lambda__unit { font-size: 16px; color: var(--lg-text-2); }
.shape-list { display: flex; flex-wrap: wrap; gap: 14px; }
.shape-list__item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--lg-text-2); }
.shape-icon { flex: none; color: var(--lg-accent); }
.lib-card__meta { font-size: 13px; line-height: 1.55; color: var(--lg-text-3); text-wrap: pretty; }
.conv { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--lg-text-3); }
.conv--ok { color: var(--lg-green); }
.conv--running { color: var(--lg-accent); }
.lib-card__foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--lg-line);
  margin-top: auto;
}
.more-button { width: 34px; height: 34px; border-radius: 8px; color: var(--lg-text-2); font-size: 16px; letter-spacing: 1px; }
.more-button:hover { color: var(--lg-text); border-color: var(--lg-line-strong); }

.stack-diagram { display: flex; flex-direction: column; gap: 3px; }
.stack-layer { display: flex; align-items: stretch; gap: 14px; }
.stack-layer__block {
  flex: none;
  width: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--layer-color);
  overflow: hidden;
}
.stack-layer__block--ambient { background: transparent; border: 1px dashed var(--lg-line-strong); }
.stack-layer__block--patterned { background: transparent; border: 1px solid var(--lg-line); }
.stack-layer__pillar { height: 100%; background: var(--layer-color); border-radius: 2px 2px 0 0; }
.stack-layer__text { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; }
.stack-layer__name { font-size: 13px; }
.stack-layer__meta { font-family: var(--lg-mono); font-size: 12px; color: var(--lg-text-3); }
.small-mono { font-family: var(--lg-mono); font-size: 12px; color: var(--lg-text-3); }

.shape-row { display: flex; align-items: flex-start; gap: 12px; padding-top: 12px; border-top: 1px solid var(--lg-line); }
.shape-row__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.shape-row__title { font-size: 14px; }
.shape-row__ranges { font-family: var(--lg-mono); font-size: 12px; line-height: 1.5; color: var(--lg-text-2); }

.test-row { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--lg-line); }
.test-row__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.test-row__date { font-family: var(--lg-mono); font-size: 12.5px; color: var(--lg-text-2); }
.test-row__result { font-size: 12px; font-weight: 500; color: var(--st-c); }
.test-row__detail { font-family: var(--lg-mono); font-size: 12.5px; }
.test-row__link { font-size: 13px; }

.file-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--lg-line-field);
  border-radius: 10px;
  color: var(--lg-text) !important;
}
.file-link:hover { border-color: var(--lg-line-strong); }
.file-link__name { font-family: var(--lg-mono); font-size: 13px; }
.file-link__size { display: flex; align-items: center; gap: 8px; font-family: var(--lg-mono); font-size: 12px; color: var(--lg-text-3); }
.file-link__size svg { color: var(--lg-accent); }

.link-list { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }

/* ---------- Металинзы ---------- */

.lens-tile { display: flex; flex-direction: column; overflow: hidden; }
.lens-tile:hover { border-color: #2e393c; }
.lens-tile__preview { position: relative; aspect-ratio: 16 / 10; background: var(--lg-bg); border-bottom: 1px solid var(--lg-line); }
.lens-tile__preview svg { display: block; width: 100%; height: 100%; }
.lens-tile__ir {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 118px;
  padding: 6px 8px 4px;
  background: rgb(10 12 13 / 0.88);
  border: 1px solid var(--lg-line);
  border-radius: 8px;
}
.lens-tile__ir-label { font-family: var(--lg-mono); font-size: 10px; color: var(--lg-text-2); }
.lens-tile__ir svg { display: block; width: 100%; height: auto; }
.lens-tile__body { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; flex: 1; }
.lens-tile__title { margin: 0; font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.lens-tile__foot { display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--lg-line); margin-top: auto; }
.lens-tile__spacer { flex: 1; }

/* ---------- Материалы ---------- */

.materials { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.mat-list { flex: 1 1 280px; max-width: 320px; display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.mat-list__items { display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 320px); min-height: 200px; overflow-y: auto; }
.mat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--lg-text) !important;
}
.mat-item:hover { background: rgb(255 255 255 / 0.04); }
.mat-item--active, .mat-item--active:hover { background: var(--lg-accent-soft); }
.mat-item--active .mat-item__name { color: var(--lg-accent); }
.mat-item__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mat-item__name { font-size: 14px; overflow-wrap: anywhere; }
.mat-item__range { font-family: var(--lg-mono); font-size: 11.5px; color: var(--lg-text-3); }
.mat-item__kind { flex: none; font-size: 12px; color: var(--lg-text-3); }
.is-formula { font-family: var(--lg-mono); }

.mat-detail { flex: 1 1 460px; display: flex; flex-direction: column; gap: 20px; padding: 24px; }
.mat-detail__back { display: none; font-size: 14px; }
.mat-detail__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.mat-detail__name { margin: 0; font-size: 26px; font-weight: 500; }
.props { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px 24px; margin: 0; padding-top: 18px; border-top: 1px solid var(--lg-line); }
.props__item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.props__item dt { font-size: 12px; color: var(--lg-text-3); }
.props__item dd { margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.props__item dd.mono { font-size: 14px; }
.props__item .link-list { gap: 6px; }

@media (max-width: 767px) {
  .mat-list { max-width: none; }
  .mat-list__items { max-height: none; }
  .materials--picked .mat-list { display: none; }
  .materials:not(.materials--picked) .mat-detail { display: none; }
  .mat-detail__back { display: inline; }
  .section-header__title { font-size: 24px; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lib-stack { flex: 1 1 280px; gap: 16px; }
.lib-shapes { flex: 1 1 240px; }
.seg--start { align-self: flex-start; }
