@font-face {
  font-family: "AgentOS Display";
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url("/static/fonts/exo2-500.ttf") format("truetype");
}

@font-face {
  font-family: "AgentOS Display";
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url("/static/fonts/exo2-600.ttf") format("truetype");
}

@font-face {
  font-family: "AgentOS Display";
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url("/static/fonts/exo2-700.ttf") format("truetype");
}

@font-face {
  font-family: "AgentOS Mono";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/static/fonts/jetbrains-mono-400.ttf") format("truetype");
}

@font-face {
  font-family: "AgentOS Mono";
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url("/static/fonts/jetbrains-mono-600.ttf") format("truetype");
}

@font-face {
  font-family: "AgentOS Mono";
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url("/static/fonts/jetbrains-mono-700.ttf") format("truetype");
}

:root {
  color-scheme: dark;
  --bg: #050506;
  --bg-soft: #0b0b0d;
  --panel: #111114;
  --panel-2: #16161a;
  --line: #29292f;
  --line-soft: #1d1d22;
  --text: #f3f0e8;
  --muted: #918b80;
  --muted-2: #5e5a52;
  --accent: #d7a85f;
  --accent-2: #5ea0ff;
  --success: #6fcf97;
  --danger: #e05d5d;
  --warning: #e0b75d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "AgentOS Display", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "AgentOS Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  /* --- Phase 1: design system foundation (tokens) --- */
  /* spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  /* type scale */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;
  /* radius scale */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  /* accent alpha tokens */
  --accent-a08: rgba(215, 168, 95, 0.08);
  --accent-a12: rgba(215, 168, 95, 0.12);
  --accent-a16: rgba(215, 168, 95, 0.16);
  --accent-a24: rgba(215, 168, 95, 0.24);
  --accent-a42: rgba(215, 168, 95, 0.42);
  --danger-a12: rgba(224, 93, 93, 0.12);
  --danger-a40: rgba(224, 93, 93, 0.40);
  /* motion */
  --t-fast: 140ms ease;
  --t-med: 180ms ease;
  /* density (UX-4) — comfortable = текущие значения, дефолт не меняется */
  --pad-shell-y: 24px;
  --pad-shell-x: 32px;
  --pad-panel: 18px;
  --pad-metric: 16px;
  --pad-card: 14px;
}

html[data-density="compact"] {
  --pad-shell-y: 14px;
  --pad-shell-x: 22px;
  --pad-panel: 12px;
  --pad-metric: 11px;
  --pad-card: 10px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #e8edf2;
  --bg-soft: #dde4eb;
  --panel: #fbfcfd;
  --panel-2: #f3f6f9;
  --line: #a7b1c0;
  --line-soft: #c1c9d5;
  --text: #171a1f;
  --muted: #434d5a;
  --muted-2: #56606e;
  --accent: #ad761f;
  --accent-2: #2368b7;
  --success: #23764d;
  --danger: #b12e31;
  --warning: #a76712;
  --shadow: 0 18px 46px rgba(30, 42, 58, 0.13), 0 1px 0 rgba(255, 255, 255, 0.72) inset;
  /* accent alpha tokens (light gold) */
  --accent-a08: rgba(173, 118, 31, 0.08);
  --accent-a12: rgba(173, 118, 31, 0.12);
  --accent-a16: rgba(173, 118, 31, 0.14);
  --accent-a24: rgba(173, 118, 31, 0.20);
  --accent-a42: rgba(173, 118, 31, 0.34);
  --danger-a12: rgba(179, 45, 45, 0.10);
  --danger-a40: rgba(179, 45, 45, 0.34);
}

.hidden {
  display: none !important;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

*.is-scrolling,
*:hover {
  scrollbar-color: rgba(215, 168, 95, 0.45) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: transparent;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

*.is-scrolling::-webkit-scrollbar-thumb,
*:hover::-webkit-scrollbar-thumb {
  background-color: rgba(215, 168, 95, 0.42);
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(215, 168, 95, 0.68);
}

html,
body {
  height: 100%;
}

html[data-theme="light"] body {
  /* UX-5b: один тонкий золотой акцент сверху-справа вместо 5 слоёв (сетка + белый фейд) */
  background:
    radial-gradient(circle at 80% -8%, rgba(173, 118, 31, 0.06), transparent 32rem),
    var(--bg);
}

html[data-theme="light"] body::before {
  /* UX-5b: overlay с mix-blend: multiply убран — давал шум и «вымытость» */
  content: none;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 70% 0%, rgba(215, 168, 95, 0.12), transparent 34rem),
    linear-gradient(135deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 14px),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  letter-spacing: 0;
  overflow: hidden;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  background: rgba(13, 13, 16, 0.92);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  z-index: 5;
}

html[data-theme="light"] .sidebar {
  /* UX-5b: без диагональной сетки — чистый вертикальный фон */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(231, 236, 242, 0.94));
  border-right-color: rgba(101, 112, 126, 0.42);
  box-shadow: 14px 0 36px rgba(38, 50, 66, 0.08);
}

.brand {
  padding: 22px 16px 18px;
}

.brand-mark-wrap {
  width: 56px;
  height: 56px;
  display: block;
  position: relative;
  margin-bottom: 12px;
}

.brand-mark {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-mark-wrap .brand-mark {
  position: absolute;
  inset: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.brand-mark-light {
  opacity: 0;
}

html[data-theme="light"] .brand-mark-wrap {
  filter: drop-shadow(0 8px 18px rgba(48, 58, 70, 0.14));
}

html[data-theme="light"] .brand-mark-dark {
  opacity: 0;
  transform: scale(0.98);
}

html[data-theme="light"] .brand-mark-light {
  opacity: 1;
  transform: scale(1);
}

.kicker,
.section-label {
  display: block;
  color: var(--accent);
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.nav {
  display: grid;
  gap: 5px;
  padding: 4px 10px;
}

.sidebar-section {
  padding: 4px 10px 14px;
}

.sidebar-label {
  display: block;
  margin: 0 8px 8px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
}

.agent-nav-list {
  display: grid;
  gap: 7px;
}

.agent-nav-item {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.1);
  border-radius: 7px;
  padding: 8px;
  text-align: left;
  cursor: pointer;
}

.agent-nav-item:hover,
.agent-nav-item.active {
  background: rgba(215, 168, 95, 0.13);
  border-color: rgba(215, 168, 95, 0.55);
}

.agent-nav-item small,
.agent-nav-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-nav-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.agent-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  background: rgba(94, 160, 255, 0.18);
  border: 1px solid rgba(94, 160, 255, 0.3);
  font-weight: 700;
}

.agent-avatar.running {
  background: rgba(111, 207, 151, 0.16);
  border-color: rgba(111, 207, 151, 0.34);
  /* UX-7: "жив" — статичное мягкое зелёное свечение (без пульса; healthy = static) */
  box-shadow: 0 0 0 1px rgba(111, 207, 151, 0.1), 0 0 10px rgba(111, 207, 151, 0.18);
}

/* UX-5: на светлой теме — заметнее (тёмно-зелёный ring вместо мягкого свечения) */
html[data-theme="light"] .agent-avatar.running {
  background: rgba(35, 118, 77, 0.12);
  border-color: rgba(35, 118, 77, 0.5);
  box-shadow: 0 0 0 1px rgba(35, 118, 77, 0.25), 0 0 8px rgba(35, 118, 77, 0.3);
}

.self-nav {
  margin-top: 8px;
}

.nav-item {
  min-height: 42px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  background: #19191e;
  border-color: var(--line);
}

html[data-theme="light"] .nav-item.active,
html[data-theme="light"] .nav-item:hover {
  background: rgba(168, 116, 40, 0.12);
  border-color: rgba(168, 116, 40, 0.32);
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  /* UX-6d: dev-деталь (адрес бэкенда) приглушена — статус-точку оставляем */
  color: var(--muted-2);
  font-size: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 18px var(--success);
}

.shell {
  position: relative;
  z-index: 1;
  margin-left: 248px;
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  padding: var(--pad-shell-y) var(--pad-shell-x);
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}

.topbar-title {
  min-width: 0;
}

.compact-heading-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.compact-header-meta {
  display: none;
}

body.compact-header-view .topbar {
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(215, 168, 95, 0.12);
}

body.compact-header-view .section-label {
  font-size: 12px;
}

body.compact-header-view .topbar h1 {
  margin-top: 3px;
  font-size: clamp(21px, 1.45vw, 28px);
  line-height: 1.05;
  letter-spacing: 0;
  white-space: nowrap;
}

body.compact-header-view .compact-header-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: min(980px, 68vw);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.35;
}

body.compact-header-view .compact-header-meta span {
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.compact-header-view .compact-header-meta span:not(:first-child)::before {
  content: "·";
  margin-right: 8px;
  color: rgba(215, 168, 95, 0.64);
}

body.compact-header-view .top-actions {
  flex-shrink: 0;
}

body.compact-header-view .top-actions .ghost {
  padding: 8px 11px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chrome-switches {
  display: flex;
  align-items: center;
  gap: 7px;
}

.chrome-language-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chrome-language-switch button,
.chrome-theme-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(215, 168, 95, 0.18);
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.chrome-language-switch button.active,
.chrome-language-switch button:hover,
.chrome-language-switch button:focus-visible,
.chrome-theme-toggle:hover,
.chrome-theme-toggle:focus-visible {
  color: var(--text);
  background: rgba(215, 168, 95, 0.17);
  box-shadow: inset 0 0 0 1px rgba(215, 168, 95, 0.34);
  transform: translateY(-1px);
}

.chrome-theme-toggle {
  position: relative;
  overflow: hidden;
}

.theme-icon {
  position: absolute;
  width: 19px;
  height: 19px;
  color: currentColor;
  opacity: 0;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: scale(0.72) rotate(-18deg);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.theme-icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.chrome-theme-toggle.light-active .theme-icon-sun {
  opacity: 0;
  transform: scale(0.72) rotate(18deg);
}

.chrome-theme-toggle.light-active .theme-icon-moon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

html[data-theme="light"] .chrome-language-switch button,
html[data-theme="light"] .chrome-theme-toggle {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(121, 132, 146, 0.3);
  color: #3b3f46;
}

html[data-theme="light"] .chrome-language-switch button.active,
html[data-theme="light"] .chrome-language-switch button:hover,
html[data-theme="light"] .chrome-language-switch button:focus-visible,
html[data-theme="light"] .chrome-theme-toggle:hover,
html[data-theme="light"] .chrome-theme-toggle:focus-visible {
  background: rgba(173, 118, 31, 0.12);
  border-color: rgba(173, 118, 31, 0.36);
  box-shadow: inset 0 0 0 1px rgba(173, 118, 31, 0.18), 0 8px 18px rgba(30, 42, 58, 0.08);
}

html[data-theme="light"] .chrome-theme-toggle {
  color: #20242a;
}

/* UX-6a: единый вид кнопок шапки (chrome-пилюли). Только внутри .top-actions — глобальный .ghost не трогаем. */

/* Кнопка плотности — пилюля как тема; в compact-режиме «нажата» (золотая подсветка) */
.chrome-density-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(215, 168, 95, 0.18);
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.chrome-density-toggle .chrome-icon {
  width: 18px;
  height: 18px;
}

.chrome-density-toggle:hover,
.chrome-density-toggle:focus-visible,
.chrome-density-toggle.compact-active {
  color: var(--text);
  background: rgba(215, 168, 95, 0.17);
  border-color: rgba(215, 168, 95, 0.34);
  box-shadow: inset 0 0 0 1px rgba(215, 168, 95, 0.34);
  transform: translateY(-1px);
}

html[data-theme="light"] .chrome-density-toggle {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(121, 132, 146, 0.3);
  color: #3b3f46;
}

html[data-theme="light"] .chrome-density-toggle:hover,
html[data-theme="light"] .chrome-density-toggle:focus-visible,
html[data-theme="light"] .chrome-density-toggle.compact-active {
  background: rgba(173, 118, 31, 0.12);
  border-color: rgba(173, 118, 31, 0.36);
  box-shadow: inset 0 0 0 1px rgba(173, 118, 31, 0.18), 0 8px 18px rgba(30, 42, 58, 0.08);
}

/* Log out / Refresh — выровнять под ту же семью (высота/радиус/фон/границы), только в шапке */
.top-actions > .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(215, 168, 95, 0.18);
}

.top-actions > .ghost.icon-only {
  width: 38px;
  min-width: 38px;
}

.top-actions > .ghost:hover,
.top-actions > .ghost:focus-visible {
  color: var(--text);
  background: rgba(215, 168, 95, 0.17);
  border-color: rgba(215, 168, 95, 0.34);
  box-shadow: inset 0 0 0 1px rgba(215, 168, 95, 0.34);
  transform: translateY(-1px);
}

html[data-theme="light"] .top-actions > .ghost {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(121, 132, 146, 0.3);
  color: #3b3f46;
}

html[data-theme="light"] .top-actions > .ghost:hover,
html[data-theme="light"] .top-actions > .ghost:focus-visible {
  background: rgba(173, 118, 31, 0.12);
  border-color: rgba(173, 118, 31, 0.36);
  box-shadow: inset 0 0 0 1px rgba(173, 118, 31, 0.18), 0 8px 18px rgba(30, 42, 58, 0.08);
}

.mode-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 12px;
  overflow-x: auto;
  overflow-y: hidden;
}

.mode-tab {
  flex: 0 0 auto;
  min-height: 40px;
  color: var(--muted);
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: var(--radius-pill);
  padding: 0 15px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

html[data-theme="light"] .mode-tab,
html[data-theme="light"] .agent-nav-item,
html[data-theme="light"] .night-stat,
html[data-theme="light"] .night-source-pill {
  background: rgba(255, 255, 255, 0.66);
  border-color: rgba(168, 116, 40, 0.2);
}

html[data-theme="light"] .mode-tab.active,
html[data-theme="light"] .mode-tab:hover,
html[data-theme="light"] .agent-nav-item:hover,
html[data-theme="light"] .agent-nav-item.active {
  background: rgba(168, 116, 40, 0.13);
  border-color: rgba(168, 116, 40, 0.44);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5), 0 12px 28px rgba(30, 38, 50, 0.08);
}

.mode-tab.active,
.mode-tab:hover {
  color: var(--text);
  border-color: rgba(215, 168, 95, 0.72);
  background: rgba(215, 168, 95, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 0 24px rgba(215, 168, 95, 0.08);
}

/* UX-6b: вторичные (диагностические) вкладки приглушены и отделены разделителем */
.mode-tabs-divider {
  flex: 0 0 auto;
  align-self: center;
  width: 1px;
  height: 22px;
  background: var(--line);
}

.mode-tab-secondary {
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(215, 168, 95, 0.06);
  opacity: 0.7;
}

.mode-tab-secondary:hover,
.mode-tab-secondary.active {
  opacity: 1;
}

.agent-control-strip {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-control-main,
.agent-control-actions {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}

.agent-control-main > div {
  display: grid;
  gap: 3px;
  margin-right: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(26px, 1.4vw, 32px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.ghost,
.primary,
.mini {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: #151519;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.ghost:hover,
.mini:hover {
  border-color: var(--accent-a42);
  background: var(--accent-a08);
}

.ghost:active,
.primary:active,
.mini:active {
  transform: translateY(1px);
}

.ghost:disabled,
.mini:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ghost:disabled:hover,
.mini:disabled:hover {
  border-color: var(--line);
  background: #151519;
  transform: none;
}

button:disabled:active {
  transform: none;
}

html[data-theme="light"] .ghost,
html[data-theme="light"] .mini {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(120, 128, 140, 0.38);
}

html[data-theme="light"] .ghost:hover,
html[data-theme="light"] .mini:hover {
  background: rgba(168, 116, 40, 0.1);
  border-color: rgba(168, 116, 40, 0.34);
}

.primary {
  background: var(--accent);
  color: #090806;
  border-color: var(--accent);
  font-weight: 700;
}

.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #ffffff);
  border-color: color-mix(in srgb, var(--accent) 88%, #ffffff);
  box-shadow: 0 0 0 3px var(--accent-a16);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.62;
}

.primary:disabled:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}

.mini {
  padding: 7px 10px;
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon-only > .action-label:not(.sr-only) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
}

.icon-action.icon-only {
  width: 34px;
  min-width: 34px;
  padding-inline: 0;
}

.action-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  min-width: 16px;
  height: 16px;
  font-size: 15px;
  line-height: 1;
}

.mini.warning {
  border-color: rgba(215, 168, 95, 0.34);
  background: rgba(215, 168, 95, 0.1);
  color: #f3d9a6;
}

html[data-theme="light"] .mini.warning {
  border-color: rgba(166, 108, 18, 0.32);
  background: rgba(166, 108, 18, 0.1);
  color: #6f4708;
}

.mini.danger {
  border-color: rgba(224, 93, 93, 0.38);
  background: rgba(224, 93, 93, 0.11);
  color: #ffb7b7;
}

html[data-theme="light"] .mini.danger {
  border-color: rgba(179, 45, 45, 0.28);
  background: rgba(179, 45, 45, 0.09);
  color: #7e1f1f;
}

.action-risk {
  --risk-color: var(--muted);
  --risk-bg: transparent;
  --risk-border: var(--line);
}

.action-risk::after {
  display: none;
}

.action-risk-agent {
  --risk-color: var(--accent-2);
  --risk-bg: rgba(94, 160, 255, 0.08);
  --risk-border: rgba(94, 160, 255, 0.28);
  border-color: var(--risk-border);
}

.action-risk-prepared {
  --risk-color: var(--warning);
  --risk-bg: rgba(224, 183, 93, 0.095);
  --risk-border: rgba(224, 183, 93, 0.34);
  border-color: var(--risk-border);
  background: var(--risk-bg);
  color: #f1d18e;
}

.action-risk-dangerous {
  --risk-color: var(--danger);
  --risk-bg: rgba(224, 93, 93, 0.11);
  --risk-border: rgba(224, 93, 93, 0.42);
  border-color: var(--risk-border);
  background: var(--risk-bg);
  color: #ffb7b7;
}

.primary.action-risk-agent {
  background: var(--accent);
  color: #090806;
  border-color: var(--accent);
}

.primary.action-risk-agent:hover,
.primary.action-risk-agent:focus-visible {
  background: #efc77a;
  border-color: rgba(239, 199, 122, 0.72);
}

.mini.action-risk-agent:not(.primary) {
  background: rgba(94, 160, 255, 0.08);
  color: #c8ddff;
}

.action-risk-agent:hover,
.action-risk-agent:focus-visible,
.action-risk-prepared:hover,
.action-risk-prepared:focus-visible,
.action-risk-dangerous:hover,
.action-risk-dangerous:focus-visible {
  border-color: color-mix(in srgb, var(--risk-color) 62%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--risk-color) 18%, transparent);
}

.kanban-plus.action-risk-agent {
  border-color: rgba(94, 160, 255, 0.34);
  box-shadow: inset 0 0 0 1px rgba(94, 160, 255, 0.12);
}

html[data-theme="light"] .action-risk-agent {
  --risk-color: #2368b7;
  --risk-bg: rgba(35, 104, 183, 0.075);
  --risk-border: rgba(35, 104, 183, 0.3);
}

html[data-theme="light"] .action-risk-prepared {
  --risk-color: #a76712;
  --risk-bg: rgba(167, 103, 18, 0.09);
  --risk-border: rgba(167, 103, 18, 0.34);
  color: #6f4708;
}

html[data-theme="light"] .action-risk-dangerous {
  --risk-color: #b12e31;
  --risk-bg: rgba(177, 46, 49, 0.085);
  --risk-border: rgba(177, 46, 49, 0.34);
  color: #7e1f1f;
}

html[data-theme="light"] .primary.action-risk-agent {
  background: var(--accent);
  color: #090806;
}

html[data-theme="light"] .mini.action-risk-agent:not(.primary) {
  background: rgba(35, 104, 183, 0.075);
  color: #164c8a;
}

.mini:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  background: rgba(255,255,255,0.025);
}

.view {
  display: none;
}

.view.active {
  display: block;
  min-height: 0;
}

body[data-view="chat"] .shell {
  overflow: hidden;
}

body[data-view="workspace"] .shell,
body[data-view="missions"] .shell,
body[data-view="kanban"] .shell,
body[data-view="pipeline"] .shell,
body[data-view="executor-debug"] .shell,
body[data-view="agents"] .shell,
body[data-view="night-failures"] .shell,
body[data-view="doctor"] .shell,
body[data-view="knowledge"] .shell {
  overflow: hidden;
}

body[data-view="chat"]:not(.compact-header-view) .topbar,
body[data-view="missions"]:not(.compact-header-view) .topbar {
  margin-bottom: 18px;
}

body.compact-header-view .mode-tabs {
  margin-bottom: 8px;
}

body.compact-header-view .mode-tab {
  min-height: 34px;
  padding: 0 13px;
}

body.compact-header-view .agent-control-strip {
  min-height: 50px;
  margin-bottom: 10px;
  padding: 9px 12px;
}

body[data-view="chat"] #chat,
body[data-view="workspace"] #workspace,
body[data-view="missions"] #missions,
body[data-view="kanban"] #kanban,
body[data-view="pipeline"] #pipeline,
body[data-view="executor-debug"] #executor-debug,
body[data-view="agents"] #agents,
body[data-view="night-failures"] #night-failures,
body[data-view="doctor"] #doctor,
body[data-view="knowledge"] #knowledge {
  height: 100%;
  overflow: hidden;
}

body[data-view="agents"] .shell {
  padding-top: 18px;
  padding-bottom: 26px;
}

body[data-view="agents"] .topbar {
  align-items: flex-end;
  margin-bottom: 10px;
}

body[data-view="agents"] h1 {
  margin-top: 4px;
  font-size: clamp(26px, 1.5vw, 32px);
}

body.compact-header-view[data-view="agents"] .topbar {
  align-items: center;
}

body.compact-header-view[data-view="agents"] .topbar h1 {
  margin-top: 3px;
  font-size: clamp(21px, 1.45vw, 28px);
}

body[data-view="agents"] .mode-tabs {
  margin-bottom: 8px;
}

body[data-view="agents"] .agent-control-strip {
  min-height: 50px;
  margin-bottom: 10px;
  padding: 9px 12px;
}

body[data-view="agents"] .agent-control-main {
  gap: 7px;
}

body[data-view="agents"] .agent-control-main > div {
  margin-right: 2px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.night-summary-panel {
  margin-bottom: 16px;
}

.night-summary {
  display: grid;
  gap: 12px;
}

.night-status-strip,
.night-source-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.night-stat {
  min-width: 150px;
  min-height: 58px;
  display: grid;
  gap: 5px;
  color: var(--text);
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 7px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.night-stat span {
  color: var(--muted);
  font-size: 12px;
}

.night-stat strong {
  font-size: 24px;
}

.night-stat.success strong {
  color: var(--success);
}

.night-stat.warning strong {
  color: var(--warning);
}

.night-stat.failed strong {
  color: var(--danger);
}

.night-source-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 999px;
  padding: 0 12px;
  cursor: pointer;
}

.night-source-pill b {
  color: var(--accent);
}

.status-light {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  /* UX-7: healthy = static green с лёгким "живым" свечением (без анимации) */
  box-shadow: 0 0 5px rgba(111, 207, 151, 0.35);
}

/* UX-7: degraded/warning — медленный янтарный pulse свечения */
.status-light.warning {
  background: var(--warning);
  box-shadow: 0 0 6px rgba(224, 183, 93, 0.45);
  animation: aos-status-amber 2.6s ease-in-out infinite;
}

/* UX-7: alert/failed — устойчивое красное свечение + мягкий медленный pulse (не строб, безопасно при авто-refresh) */
.status-light.failed {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(224, 93, 93, 0.5);
  animation: aos-status-red 2.2s ease-in-out infinite;
}

/* UX-7: history — статичный приглушённый золотой, без анимации */
.status-light.history {
  background: var(--accent);
  opacity: 0.78;
  box-shadow: 0 0 5px rgba(215, 168, 95, 0.3);
}

/* UX-5: на светлой теме glow усиливаем кольцом — мягкое свечение на белом не видно */
html[data-theme="light"] .status-light {
  box-shadow: 0 0 0 1.5px rgba(35, 118, 77, 0.28), 0 0 5px rgba(35, 118, 77, 0.4);
}

html[data-theme="light"] .status-light.history {
  box-shadow: 0 0 0 1.5px rgba(173, 118, 31, 0.28), 0 0 5px rgba(173, 118, 31, 0.4);
}

.metric,
.panel,
.report-tile {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

html[data-theme="light"] .metric,
html[data-theme="light"] .panel,
html[data-theme="light"] .report-tile {
  /* UX-5b: чистая белая карточка с чёткой границей вместо тинт-градиентов */
  background: linear-gradient(180deg, #ffffff, #f6f9fc);
  border-color: rgba(121, 132, 146, 0.42);
}

html[data-theme="light"] .panel-head {
  border-bottom-color: rgba(121, 132, 146, 0.18);
}

html[data-theme="light"] body.compact-header-view .topbar {
  border-bottom-color: rgba(173, 118, 31, 0.18);
}

.metric {
  padding: var(--pad-metric);
}

button.metric {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

button.metric:hover,
button.metric:focus {
  outline: none;
  border-color: rgba(215, 168, 95, 0.42);
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.075), rgba(255,255,255,0.018)), var(--panel);
}

.metric span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
}

.missions-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.42fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.kanban-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
  transition: grid-template-columns 0.16s ease;
}

.kanban-layout.create-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.night-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
  transition: grid-template-columns 0.16s ease;
}

.night-layout.summary-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.doctor-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
  transition: grid-template-columns 0.16s ease;
}

.doctor-layout.summary-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.control-room-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1fr) minmax(360px, 1.05fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
}

.control-room-status-panel,
.control-room-work-panel,
.control-room-events-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

.control-room-events-panel {
  overflow: hidden;
}

.control-room-agent-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.control-room-agent-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.control-room-agent-head strong,
.control-room-agent-head span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.control-room-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.control-room-stat-grid .metric {
  min-width: 0;
  padding: 12px;
}

.control-room-stat-grid .metric strong {
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.control-room-paths {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.control-room-paths div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  background: rgba(255,255,255,0.026);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

.control-room-paths span {
  color: var(--muted);
  font-size: 12px;
}

.control-room-paths code {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.control-room-work {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.control-room-summary {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(215, 168, 95, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.08), rgba(255,255,255,0.018));
}

.control-room-summary strong {
  font-family: var(--font-display);
  font-size: 18px;
}

.control-room-summary p,
.control-room-summary .mono {
  overflow-wrap: anywhere;
}

.control-room-summary.running {
  border-color: rgba(111, 207, 151, 0.28);
  background: linear-gradient(180deg, rgba(111, 207, 151, 0.08), rgba(255,255,255,0.018));
}

.control-room-summary.attention {
  border-color: rgba(224, 93, 93, 0.38);
  background: linear-gradient(180deg, rgba(224, 93, 93, 0.12), rgba(255,255,255,0.018));
  box-shadow: inset 3px 0 0 rgba(224, 93, 93, 0.74);
}

.control-room-summary.request {
  border-color: rgba(215, 168, 95, 0.44);
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.12), rgba(255,255,255,0.018));
  box-shadow: inset 3px 0 0 rgba(215, 168, 95, 0.72);
}

.control-room-summary.idle {
  border-color: var(--line-soft);
  background: rgba(255,255,255,0.024);
}

.control-room-work-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  background: rgba(255,255,255,0.028);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.control-room-work-card.failed {
  border-color: rgba(224, 93, 93, 0.36);
  background: linear-gradient(180deg, rgba(224, 93, 93, 0.08), rgba(255,255,255,0.018));
}

.control-room-work-card[data-control-event-key],
.control-room-work-card[data-control-event-id] {
  cursor: pointer;
}

.control-room-work-card[data-control-event-key]:hover,
.control-room-work-card[data-control-event-id]:hover {
  border-color: rgba(215, 168, 95, 0.34);
  background: rgba(215, 168, 95, 0.055);
}

.control-room-work-card.selected {
  border-color: rgba(215, 168, 95, 0.58);
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.12), rgba(255,255,255,0.026));
  box-shadow: inset 3px 0 0 rgba(215, 168, 95, 0.75), 0 0 0 1px rgba(215, 168, 95, 0.12);
}

.control-room-work-card.failed.selected {
  border-color: rgba(224, 93, 93, 0.58);
  background: linear-gradient(180deg, rgba(224, 93, 93, 0.12), rgba(255,255,255,0.026));
  box-shadow: inset 3px 0 0 rgba(224, 93, 93, 0.78), 0 0 0 1px rgba(224, 93, 93, 0.12);
}

.control-room-work-card.request-card.active {
  border-color: rgba(215, 168, 95, 0.42);
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.1), rgba(255,255,255,0.02));
  box-shadow: inset 3px 0 0 rgba(215, 168, 95, 0.72);
}

.control-room-work-card strong,
.control-room-work-card .mono {
  overflow-wrap: anywhere;
}

.request-card-head,
.request-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.request-card-head > div,
.request-item-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.request-list {
  display: grid;
  gap: 10px;
}

.request-item {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.17);
}

.request-item.approval {
  border-color: rgba(215, 168, 95, 0.28);
}

.request-item.clarify {
  border-color: rgba(111, 207, 151, 0.22);
}

.request-item span,
.request-item p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.request-item p {
  margin: 0;
  white-space: pre-wrap;
}

.request-response-input {
  min-height: 70px;
  resize: vertical;
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-room-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-room-events {
  display: grid;
  grid-template-rows: minmax(120px, auto) auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.control-room-timeline {
  padding-right: 2px;
  overflow: auto;
  min-height: 0;
}

.control-event-detail {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-height: min(44vh, 520px);
  overflow: auto;
  padding: 13px;
  border: 1px solid rgba(215, 168, 95, 0.18);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.control-event-detail.failed,
.control-event-detail.interrupted {
  border-color: rgba(224, 93, 93, 0.36);
  background: linear-gradient(180deg, rgba(224, 93, 93, 0.08), rgba(255,255,255,0.018));
}

.control-event-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.control-event-detail-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.control-event-detail-head strong,
.control-event-detail p {
  overflow-wrap: anywhere;
}

.control-event-summary {
  white-space: pre-wrap;
}

.control-event-detail time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.control-event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.control-event-json {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.control-event-json summary {
  cursor: pointer;
}

.control-event-json pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #070708;
  color: #d9d2c3;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
}

.control-event-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 6px 0 4px;
  background: linear-gradient(180deg, rgba(17, 17, 20, 0.98), rgba(17, 17, 20, 0.9));
}

.control-event-filterbar .mini {
  gap: 7px;
}

.control-event-filterbar .mini.active {
  border-color: rgba(215, 168, 95, 0.54);
  background: rgba(215, 168, 95, 0.16);
  color: var(--text);
}

.control-event-filterbar .mini span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.control-event-tail {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.16);
}

.control-tail-row {
  display: grid;
  grid-template-columns: auto minmax(90px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  font-size: 12px;
}

.control-tail-row span {
  color: var(--muted);
  font-family: var(--font-mono);
}

.control-tail-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.control-event-popover {
  position: fixed;
  z-index: 80;
  display: none;
  width: min(380px, calc(100vw - 24px));
  padding: 12px 13px;
  border: 1px solid rgba(215, 168, 95, 0.32);
  border-radius: 8px;
  background: rgba(22, 21, 22, 0.96);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.035) inset;
  color: var(--text);
  pointer-events: none;
}

.control-event-popover.active {
  display: grid;
  gap: 7px;
}

.control-popover-title {
  font-weight: 800;
}

.control-popover-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.control-popover-pill {
  justify-self: start;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(94, 160, 255, 0.25);
  border-radius: 999px;
  background: rgba(94, 160, 255, 0.12);
  color: var(--accent-2);
  font-size: 12px;
}

.control-event-popover p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.service-action-table {
  margin-top: 2px;
}

.service-action-table .table-row {
  grid-template-columns: minmax(0, 1fr) auto auto auto auto auto;
  gap: 8px;
}

.service-action-table .table-row > * {
  min-width: 0;
}

.doctor-summary-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

#doctorRefreshBtn {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  justify-self: start;
  padding-inline: 0;
}

.doctor-summary-panel .panel-head {
  gap: 8px;
}

.doctor-summary-toggle {
  min-width: 44px;
  padding-inline: 8px;
  justify-self: end;
}

.doctor-layout.summary-collapsed .doctor-summary-panel {
  padding: 12px 9px;
  gap: 10px;
}

.doctor-layout.summary-collapsed .doctor-summary-panel .panel-head {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.doctor-layout.summary-collapsed #doctorSummaryTitle {
  font-size: 15px;
  line-height: 1;
}

.doctor-layout.summary-collapsed #doctorGenerated {
  display: none;
}

.doctor-layout.summary-collapsed .doctor-summary-toggle {
  width: 100%;
  min-width: 0;
  padding-inline: 0;
}

.doctor-checks-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.doctor-verdict-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255,255,255,0.025);
}

.doctor-verdict-card strong,
.doctor-verdict-card span:last-child {
  display: block;
}

.doctor-verdict-card > span:last-child {
  grid-column: 2;
}

.doctor-verdict-card.ok {
  border-color: rgba(75, 214, 133, 0.35);
  background: rgba(75, 214, 133, 0.08);
}

.doctor-verdict-card.warning {
  border-color: rgba(224, 177, 93, 0.45);
  background: rgba(224, 177, 93, 0.09);
}

.doctor-verdict-card.failed {
  border-color: rgba(242, 95, 92, 0.45);
  background: rgba(242, 95, 92, 0.08);
}

.doctor-compact-verdict {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 6px;
  background: rgba(255,255,255,0.025);
}

.doctor-compact-verdict .doctor-orb {
  width: 10px;
  height: 10px;
}

.doctor-compact-verdict strong {
  font-size: 13px;
  line-height: 1;
}

.doctor-compact-verdict small {
  max-width: 100%;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.doctor-compact-verdict.ok {
  border-color: rgba(75, 214, 133, 0.3);
  background: rgba(75, 214, 133, 0.07);
}

.doctor-compact-verdict.warning {
  border-color: rgba(224, 177, 93, 0.38);
  background: rgba(224, 177, 93, 0.08);
}

.doctor-compact-verdict.failed {
  border-color: rgba(242, 95, 92, 0.4);
  background: rgba(242, 95, 92, 0.08);
}

.doctor-level-grid {
  display: grid;
  gap: 7px;
}

.doctor-level-stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.025);
}

.doctor-level-stat span,
.doctor-level-stat small {
  color: var(--muted);
}

.doctor-level-stat strong {
  font-size: 14px;
}

.doctor-level-stat.ok strong {
  color: var(--success);
}

.doctor-level-stat.warning strong {
  color: var(--warning);
}

.doctor-level-stat.failed strong {
  color: var(--danger);
}

.doctor-level-stat small {
  grid-column: 1 / -1;
  font-size: 12px;
}

.doctor-overview {
  display: grid;
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 9px;
  min-width: 0;
}

.doctor-overview-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 86px;
  min-width: 0;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(255,255,255,0.026);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.doctor-overview-card:hover,
.doctor-overview-card:focus {
  outline: none;
  border-color: rgba(215, 168, 95, 0.34);
  background: rgba(215, 168, 95, 0.045);
}

.doctor-overview-card.active {
  border-color: rgba(215, 168, 95, 0.58);
  background: rgba(215, 168, 95, 0.075);
}

.doctor-overview-card.ok {
  border-color: rgba(75, 214, 133, 0.22);
}

.doctor-overview-card.warning {
  border-color: rgba(224, 177, 93, 0.36);
}

.doctor-overview-card.failed {
  border-color: rgba(242, 95, 92, 0.42);
}

.doctor-overview-label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.doctor-overview-label .doctor-orb {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
}

.doctor-overview-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 22px;
  line-height: 1.05;
}

.doctor-overview-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.doctor-checks {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
}

.doctor-level-section {
  display: grid;
  gap: 9px;
}

.doctor-level-head {
  position: sticky;
  top: 4px;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 2px;
  padding: 9px 10px 8px;
  border: 1px solid rgba(255,255,255,0.045);
  border-radius: 8px;
  background: rgba(13, 13, 15, 0.84);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(6px);
}

.doctor-level-head strong,
.doctor-level-head span {
  display: block;
}

.doctor-level-head strong {
  color: var(--text);
}

.doctor-level-head span {
  color: var(--muted);
  font-size: 12px;
}

html[data-theme="light"] .doctor-level-head {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 248, 251, 0.94)),
    repeating-linear-gradient(135deg, rgba(173, 118, 31, 0.05) 0 1px, transparent 1px 14px);
  border-color: rgba(120, 128, 140, 0.28);
  box-shadow: 0 10px 22px rgba(38, 50, 66, 0.07);
}

html[data-theme="light"] .doctor-level-head strong {
  color: var(--text);
}

html[data-theme="light"] .doctor-level-head span {
  color: var(--muted);
}

.doctor-level-checks {
  display: grid;
  gap: 9px;
}

.doctor-ok-section {
  display: grid;
  gap: 9px;
}

.doctor-ok-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 2px 2px 0;
}

.doctor-ok-section-head strong,
.doctor-ok-section-head span {
  display: block;
}

.doctor-ok-section-head strong {
  color: var(--text);
}

.doctor-ok-section-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.doctor-ok-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  min-width: 0;
}

.doctor-ok-group {
  min-width: 0;
  border: 1px solid rgba(75, 214, 133, 0.18);
  border-radius: 8px;
  background: rgba(75, 214, 133, 0.035);
}

.doctor-ok-group[open] {
  border-color: rgba(75, 214, 133, 0.28);
  background: rgba(75, 214, 133, 0.055);
}

.doctor-ok-group > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 9px;
  align-items: center;
  min-height: 58px;
  padding: 9px 11px;
  cursor: pointer;
  list-style: none;
}

.doctor-ok-group > summary::-webkit-details-marker {
  display: none;
}

.doctor-ok-group > summary strong,
.doctor-ok-group > summary span,
.doctor-ok-group > summary small {
  min-width: 0;
}

.doctor-ok-group > summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.doctor-ok-group > summary span {
  color: var(--success);
  font-size: 12px;
  white-space: nowrap;
}

.doctor-ok-group > summary small {
  grid-column: 2 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.doctor-ok-list {
  display: grid;
  gap: 6px;
  border-top: 1px solid rgba(75, 214, 133, 0.13);
  padding: 8px;
}

.doctor-ok-row {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.045);
  border-radius: 7px;
  padding: 8px 9px;
  background: rgba(0,0,0,0.08);
}

.doctor-ok-row-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.doctor-ok-row-main strong,
.doctor-ok-row-main span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doctor-ok-row-main strong {
  color: var(--text);
  font-size: 13px;
}

.doctor-ok-row-main span {
  color: var(--muted);
  font-size: 12px;
}

.doctor-ok-row-details {
  display: grid;
  gap: 6px;
}

html[data-theme="light"] .doctor-ok-group {
  border-color: rgba(42, 143, 85, 0.22);
  background: rgba(42, 143, 85, 0.045);
}

html[data-theme="light"] .doctor-ok-group[open] {
  border-color: rgba(42, 143, 85, 0.34);
  background: rgba(42, 143, 85, 0.065);
}

html[data-theme="light"] .doctor-ok-list {
  border-top-color: rgba(42, 143, 85, 0.17);
}

html[data-theme="light"] .doctor-ok-row {
  border-color: rgba(120, 128, 140, 0.2);
  background: rgba(255, 255, 255, 0.55);
}

.doctor-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.026);
}

.doctor-card.ok {
  border-color: rgba(75, 214, 133, 0.2);
}

.doctor-card.warning {
  border-color: rgba(224, 177, 93, 0.32);
}

.doctor-card.failed {
  border-color: rgba(242, 95, 92, 0.36);
}

.doctor-card.stale {
  border-color: rgba(75, 214, 133, 0.16);
  opacity: 0.88;
}

.doctor-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.doctor-card-head strong,
.doctor-card-head span {
  display: block;
}

.doctor-card-head span {
  color: var(--muted);
}

.doctor-orb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 14px rgba(75, 214, 133, 0.55);
}

.doctor-orb.warning {
  background: var(--warning);
  box-shadow: 0 0 14px rgba(224, 177, 93, 0.55);
}

.doctor-orb.failed {
  background: var(--danger);
  box-shadow: 0 0 14px rgba(242, 95, 92, 0.55);
}

.doctor-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 22px;
}

.doctor-chip-row:empty {
  display: none;
}

.doctor-chip-row span {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.doctor-hints {
  display: grid;
  gap: 6px;
}

.doctor-hint {
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 7px;
  background: rgba(255,255,255,0.012);
}

.doctor-hint summary {
  cursor: pointer;
  padding: 6px 8px;
  color: var(--accent);
  font-size: 12px;
}

.doctor-hint pre {
  max-height: 140px;
  overflow: auto;
  margin: 0;
  border-top: 1px solid rgba(255,255,255,0.045);
  padding: 8px 10px;
  color: #c9c1b2;
  background: rgba(255,255,255,0.012);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.doctor-hint.command pre {
  position: relative;
  font-family: var(--font-mono);
  color: #d6cec0;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.doctor-hint.command pre:hover,
.doctor-hint.command pre:focus {
  outline: none;
  border-color: rgba(215, 168, 95, 0.22);
  background: rgba(215, 168, 95, 0.045);
  color: #e1d8c9;
}

.doctor-hint.command pre.copied::after {
  content: "скопировано";
  position: absolute;
  top: 6px;
  right: 8px;
  color: var(--success);
  font-family: var(--font-ui);
  font-size: 12px;
  background: rgba(75, 214, 133, 0.1);
  border: 1px solid rgba(75, 214, 133, 0.22);
  border-radius: 999px;
  padding: 2px 7px;
}

.doctor-hint.repair pre,
.doctor-hint.rollback pre {
  font-family: var(--font-ui);
  color: #bdb4a6;
}

.doctor-hint.repair summary {
  color: var(--warning);
}

.doctor-hint.rollback summary {
  color: var(--muted);
}

.doctor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.doctor-analyze-btn,
.doctor-repair-btn {
  justify-self: end;
  min-width: 128px;
}

.doctor-stat-card {
  min-height: 52px;
  display: grid;
  align-content: center;
  gap: 3px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px 11px;
  background: rgba(255,255,255,0.025);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.doctor-stat-card:hover,
.doctor-stat-card:focus {
  outline: none;
  border-color: rgba(215, 168, 95, 0.28);
  background: rgba(215, 168, 95, 0.045);
}

.doctor-stat-card.active {
  border-color: rgba(215, 168, 95, 0.52);
  background: rgba(215, 168, 95, 0.075);
}

.doctor-stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.doctor-stat-card strong {
  font-size: 18px;
}

.doctor-stat-card.ok strong {
  color: var(--success);
}

.doctor-stat-card.warning strong {
  color: var(--warning);
}

.doctor-stat-card.failed strong {
  color: var(--danger);
}

.doctor-layout.summary-collapsed #doctorStats {
  margin-bottom: 0;
}

.doctor-compact-grid {
  display: grid;
  gap: 7px;
}

.doctor-compact-stat {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 48px;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 7px 5px;
  color: var(--text);
  background: rgba(255,255,255,0.025);
  cursor: pointer;
}

.doctor-compact-stat:hover,
.doctor-compact-stat:focus {
  outline: none;
  border-color: rgba(215, 168, 95, 0.34);
  background: rgba(215, 168, 95, 0.045);
}

.doctor-compact-stat.active {
  border-color: rgba(215, 168, 95, 0.56);
  background: rgba(215, 168, 95, 0.075);
}

.doctor-compact-stat span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.doctor-compact-stat strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.1;
}

.doctor-compact-stat.ok strong {
  color: var(--success);
}

.doctor-compact-stat.warning strong {
  color: var(--warning);
}

.doctor-compact-stat.failed strong {
  color: var(--danger);
}

.doctor-meta-details {
  color: var(--muted);
}

.doctor-meta-details summary {
  width: max-content;
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
}

.doctor-meta {
  max-height: 150px;
  overflow: auto;
  margin: 8px 0 0;
  color: #e3d9c8;
  background: #070708;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 10px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 300px minmax(540px, 1fr) 300px;
  gap: 16px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.chat-side {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.thread-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.thread-row {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 58px;
  text-align: left;
  text-decoration: none;
  color: var(--text);
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 11px 12px;
  cursor: pointer;
}

.thread-row span {
  color: var(--muted);
  font-size: 12px;
}

.thread-row.active,
.thread-row:hover {
  border-color: var(--accent-2);
  background: rgba(94, 160, 255, 0.08);
}

.thread-row.archived {
  opacity: 0.72;
  border-style: dashed;
}

.inline-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.inline-check input {
  width: auto;
}

.chat-main {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  padding: 14px;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-bottom: 10px;
}

.chat-context {
  min-height: 0;
  overflow: auto;
}

.chat-statusbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-messages-wrap {
  position: relative;
  min-height: 0;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(0,0,0,0.34);
}

.chat-jump-bottom {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(215, 168, 95, 0.42);
  border-radius: 999px;
  background: rgba(18, 18, 20, 0.94);
  color: var(--accent);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.36);
}

.chat-jump-bottom:hover,
.chat-jump-bottom:focus-visible {
  color: #fff4bd;
  border-color: rgba(215, 168, 95, 0.7);
  transform: translateY(-1px);
}

#chat.chat-drop-active .chat-messages {
  border-color: rgba(215, 168, 95, 0.7);
  background: rgba(215, 168, 95, 0.08);
  box-shadow: inset 0 0 0 1px rgba(215, 168, 95, 0.16);
}

.chat-message {
  display: grid;
  gap: 5px;
  max-width: min(860px, 78%);
  user-select: text;
}

.chat-message.user {
  align-self: end;
}

.chat-message.user .message-actions {
  justify-content: flex-end;
}

.chat-role {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.chat-message.user .chat-role {
  text-align: right;
}

.chat-bubble {
  white-space: pre-wrap;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151519;
  line-height: 1.55;
  user-select: text;
  cursor: text;
}

.chat-bubble-markdown {
  display: grid;
  gap: 12px;
  white-space: normal;
}

.chat-text-fragment {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.chat-text-fragment > * {
  margin: 0;
}

.chat-text-fragment p,
.chat-text-fragment li,
.chat-text-fragment blockquote {
  white-space: normal;
}

.chat-text-fragment ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
}

.chat-text-fragment code {
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffe1a3;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.chat-text-fragment h2,
.chat-text-fragment h3,
.chat-text-fragment h4,
.chat-text-fragment h5 {
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.chat-code-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #242426;
}

.chat-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: #c7c1b8;
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--font-mono);
  font-size: 12px;
}

.chat-code-copy {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  line-height: 1;
}

.chat-code-copy:hover,
.chat-code-copy:focus-visible,
.chat-code-copy.copied {
  color: var(--accent);
  border-color: rgba(215, 168, 95, 0.28);
  background: rgba(215, 168, 95, 0.09);
  outline: none;
}

.chat-code-copy.copied {
  color: var(--success);
  border-color: rgba(111, 207, 151, 0.45);
}

.chat-code-block pre {
  margin: 0;
  overflow: auto;
  padding: 13px 14px 15px;
  scrollbar-width: thin;
}

.chat-code-block code {
  display: block;
  min-width: max-content;
  color: #f4f0e8;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

.quote-popover {
  position: fixed;
  z-index: 1000;
  display: none;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(215, 168, 95, 0.42);
  border-radius: 7px;
  background: #18140d;
  color: var(--accent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
  font-size: 12px;
}

.quote-popover.active {
  display: inline-flex;
  align-items: center;
}

.tool-activity {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 10px 56px 10px 12px;
  border: 1px solid rgba(215, 168, 95, 0.16);
  border-radius: 8px;
  background: rgba(19, 25, 34, 0.82);
  box-shadow: inset 0 0 0 1px rgba(94, 160, 255, 0.04);
}

.tool-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: #e8f1ff;
  font-size: 13px;
}

.tool-activity time {
  position: absolute;
  right: 12px;
  bottom: 9px;
  color: #8aa0bd;
  font-size: 12px;
  font-family: var(--font-mono);
}

.tool-row span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-inline-events {
  display: grid;
  gap: 5px;
}

.chat-inline-event {
  display: grid;
  grid-template-columns: 10px minmax(82px, auto) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font: inherit;
  text-align: left;
}

button.chat-inline-event {
  cursor: pointer;
}

button.chat-inline-event:hover,
button.chat-inline-event:focus-visible {
  border-color: rgba(215, 168, 95, 0.28);
  background: rgba(215, 168, 95, 0.07);
  outline: none;
}

.chat-inline-event strong,
.chat-inline-event small,
.chat-inline-event time {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-inline-event strong {
  color: var(--text);
  font-size: 12px;
}

.chat-inline-event small,
.chat-inline-event time {
  font-size: 12px;
}

.chat-inline-event.done .activity-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(111, 207, 151, 0.12);
}

.chat-inline-event.running .activity-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(215, 168, 95, 0.13);
}

.chat-inline-event.failed .activity-dot,
.chat-inline-event.interrupted .activity-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 93, 93, 0.13);
}

.chat-approval-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(215, 168, 95, 0.28);
  border-radius: 7px;
  background: rgba(215, 168, 95, 0.07);
}

.chat-approval-card > div:first-child {
  display: grid;
  gap: 3px;
}

.chat-approval-card strong {
  color: var(--text);
  font-size: 12px;
}

.chat-approval-card span {
  color: var(--muted);
  font-size: 12px;
}

.chat-approval-card pre {
  max-height: 180px;
  margin: 0;
  padding: 8px;
  overflow: auto;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-size: 12px;
  white-space: pre-wrap;
}

.chat-approval-card.resolved {
  border-color: rgba(111, 207, 151, 0.2);
  background: rgba(111, 207, 151, 0.055);
}

.tool-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--text);
}

.tool-icon::before {
  content: "⚙";
}

.tool-icon.clock::before {
  content: "◷";
}

.tool-icon.search::before {
  content: "⌕";
}

.tool-icon.file::before {
  content: "▤";
}

.context-activity {
  gap: 10px;
}

.activity-timeline {
  display: grid;
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.activity-timeline.compact {
  margin-top: 8px;
}

.activity-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(94, 160, 255, 0.12);
}

.activity-row.running .activity-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(215, 168, 95, 0.13);
}

.activity-row.done .activity-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(111, 207, 151, 0.12);
}

.activity-row.failed .activity-dot,
.activity-row.interrupted .activity-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 93, 93, 0.13);
}

.activity-row strong,
.activity-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-row strong {
  color: var(--text);
  font-size: 12px;
}

.activity-row small,
.activity-row time {
  color: var(--muted);
  font-size: 12px;
}

.activity-row time {
  white-space: nowrap;
}

button.activity-row {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.control-event-row {
  padding: 9px 8px;
  border-radius: 7px;
}

.control-event-row:hover,
.control-event-row.active {
  background: rgba(215, 168, 95, 0.08);
}

.control-event-row.active {
  box-shadow: inset 0 0 0 1px rgba(215, 168, 95, 0.22);
}

.activity-panel-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) minmax(340px, 0.42fr);
  gap: 16px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.activity-panel-layout > .panel {
  min-height: 0;
  overflow: hidden;
}

.activity-controls-panel,
.activity-feed-panel,
.activity-detail-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.activity-controls-panel {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.activity-filter-stack {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.activity-filter-stack label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.activity-filter-stack input,
.activity-filter-stack select {
  width: 100%;
}

.activity-filterbar {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.activity-summary {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.activity-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.activity-summary-grid .metric {
  padding: 10px;
  box-shadow: none;
}

.activity-summary-grid .metric strong {
  margin-top: 4px;
  font-size: 20px;
}

.activity-summary-tail {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding-top: 4px;
}

.activity-summary-tail strong,
.activity-summary-tail small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-feed {
  min-height: 0;
  overflow: auto;
  padding: 8px 10px 12px;
}

.activity-feed-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  width: 100%;
  min-width: 0;
  padding: 11px 9px;
  color: inherit;
  font: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  cursor: pointer;
}

.activity-feed-row:hover,
.activity-feed-row:focus,
.activity-feed-row.active {
  outline: none;
  background: rgba(215, 168, 95, 0.075);
}

.activity-feed-row.active {
  box-shadow: inset 0 0 0 1px rgba(215, 168, 95, 0.24);
}

.activity-feed-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.activity-feed-main > div {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.activity-feed-main strong,
.activity-feed-main span,
.activity-feed-main small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-feed-main strong {
  color: var(--text);
  font-size: 13px;
}

.activity-feed-main span,
.activity-feed-main small,
.activity-feed-row time {
  color: var(--muted);
  font-size: 12px;
}

.activity-feed-row time {
  white-space: nowrap;
}

.activity-detail {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.mission-activity {
  margin: 10px 0;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.18);
}

.kanban-activity {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.14);
}

.chat-message.user .chat-bubble {
  background: rgba(215, 168, 95, 0.14);
  border-color: rgba(215, 168, 95, 0.38);
}

.chat-message.failed .chat-bubble {
  border-color: rgba(224, 93, 93, 0.45);
  color: #ffd3d3;
}

.message-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  min-height: 30px;
  opacity: 0.62;
  transition: opacity 0.16s ease;
}

.chat-message:hover .message-actions,
.chat-message:focus-within .message-actions {
  opacity: 1;
}

.message-action-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-family: var(--font-mono);
  line-height: 1;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.message-action-icon span {
  display: block;
  font-size: 17px;
  transform: translateY(-1px);
}

.message-action-icon.branch span {
  font-size: 16px;
}

.message-action-icon:hover,
.message-action-icon:focus-visible {
  color: var(--text);
  border-color: rgba(215, 168, 95, 0.24);
  background: rgba(215, 168, 95, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.message-action-icon.branch:hover,
.message-action-icon.branch:focus-visible {
  color: var(--accent);
}

.message-action-icon.copied {
  color: var(--success);
  border-color: rgba(111, 207, 151, 0.45);
  background: rgba(111, 207, 151, 0.1);
}

.typing-cursor {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 5px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.chat-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 10px;
}

.chat-composer textarea {
  grid-column: 2;
  grid-row: 1;
  min-height: 42px;
  max-height: 132px;
  resize: none;
  overflow-y: auto;
}

.chat-actions {
  display: contents;
}

.chat-actions .attach-btn {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  justify-self: start;
}

#chatSendBtn {
  grid-column: 3;
  grid-row: 1;
  align-self: end;
  min-height: 38px;
}

#chatSendBtn.stop-mode {
  min-width: 72px;
  font-size: 18px;
  line-height: 1;
  color: #0d0d10;
  background: #e0b15d;
  border-color: rgba(224, 177, 93, 0.78);
}

#chatSendBtn.stop-mode:hover {
  background: #efc77a;
}

.attach-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: #151519;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
}

.attach-btn input {
  display: none;
}

.attachment-status {
  min-height: 22px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.attachment-status.active {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--accent);
}

.attachment-chip {
  min-height: 28px;
  max-width: 260px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  background: rgba(215, 168, 95, 0.1);
  border: 1px solid rgba(215, 168, 95, 0.25);
  border-radius: 999px;
  padding: 0 10px;
  overflow: hidden;
  pointer-events: none;
}

.attachment-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-remove {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.attachment-remove:hover {
  color: var(--text);
  border-color: rgba(215, 168, 95, 0.45);
  background: rgba(215, 168, 95, 0.18);
}

.context-block {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.context-block span,
.context-note {
  color: var(--muted);
  font-size: 12px;
}

.context-block code {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.context-note {
  line-height: 1.5;
}

.context-artifacts {
  border-bottom: 0;
}

.artifact-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.artifact-row {
  width: 100%;
  display: grid;
  gap: 5px;
  color: var(--text);
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(215, 168, 95, 0.1);
  border-radius: 7px;
  padding: 9px;
  text-align: left;
  cursor: pointer;
}

.artifact-row:hover {
  background: rgba(215, 168, 95, 0.12);
  border-color: rgba(215, 168, 95, 0.45);
}

.artifact-row span,
.artifact-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-row small {
  color: var(--muted);
  font-size: 12px;
}

.workspace-preview-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: min(720px, 100%);
  margin-top: 8px;
}

.workspace-preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 9px;
  color: var(--text-soft);
  background: rgba(215, 168, 95, 0.075);
  border: 1px solid rgba(215, 168, 95, 0.18);
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
}

.workspace-preview-chip:hover,
.workspace-preview-chip:focus-visible {
  color: var(--text);
  background: rgba(215, 168, 95, 0.14);
  border-color: rgba(215, 168, 95, 0.5);
}

.workspace-preview-chip span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
}

.panel {
  min-width: 0;
  padding: var(--pad-panel);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.agent-list,
.mission-list,
.file-list {
  display: grid;
  gap: 10px;
  align-content: start;
  grid-auto-rows: max-content;
}

body[data-view="workspace"] .file-list,
body[data-view="missions"] .mission-list {
  min-height: 0;
  overflow: auto;
}

body[data-view="workspace"] .file-list {
  overflow-x: hidden;
}

.agent-card,
.mission-card,
.file-row,
.table-row {
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 7px;
  padding: var(--pad-card);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.mission-card.focus,
.kanban-card.focus {
  border-color: rgba(215, 168, 95, 0.62);
  box-shadow: 0 0 0 1px rgba(215, 168, 95, 0.18) inset, 0 0 0 3px rgba(215, 168, 95, 0.08);
  background: rgba(215, 168, 95, 0.055);
}

.agent-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.agent-title {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(94, 160, 255, 0.12);
  color: var(--accent-2);
  border: 1px solid rgba(94, 160, 255, 0.25);
  font-size: 12px;
}

.pill.running {
  background: rgba(111, 207, 151, 0.12);
  color: var(--success);
  border-color: rgba(111, 207, 151, 0.28);
}

.pill.done {
  background: rgba(215, 168, 95, 0.1);
  color: var(--accent);
  border-color: rgba(215, 168, 95, 0.24);
}

.pill.warning {
  background: rgba(224, 183, 93, 0.1);
  color: var(--warning);
  border-color: rgba(224, 183, 93, 0.28);
}

.pill.failed,
.pill.inactive {
  background: rgba(224, 93, 93, 0.12);
  color: var(--danger);
  border-color: rgba(224, 93, 93, 0.28);
}

/* UX-6c: статус кодируется не только цветом, но и фигурным глифом (дальтоники / быстрый скан) */
.pill.running::before,
.pill.done::before,
.pill.warning::before,
.pill.failed::before,
.pill.inactive::before {
  margin-right: 5px;
  font-size: 0.82em;
  line-height: 1;
}

.pill.running::before { content: "\25B6"; }   /* ▶ */
.pill.done::before { content: "\2713"; }       /* ✓ */
.pill.warning::before { content: "\25B2"; }    /* ▲ */
.pill.failed::before { content: "\2715"; }     /* ✕ */
.pill.inactive::before { content: "\25A0"; }   /* ■ */

.mono {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.mission-form {
  display: grid;
  gap: 12px;
}

.mission-form-inline {
  position: sticky;
  top: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
}

.inline-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

input:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled) {
  border-color: var(--accent-a42);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"],
input.invalid,
textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-a12);
}

select {
  color-scheme: dark;
}

select option {
  color: #efe8d8;
  background: #151519;
}

select option:checked {
  color: #0f1115;
  background: var(--accent);
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  background: #ffffff;
  border-color: rgba(120, 128, 140, 0.42);
}

html[data-theme="light"] select {
  color-scheme: light;
}

html[data-theme="light"] select option {
  color: #252a31;
  background: #ffffff;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(215, 168, 95, 0.14);
}

.table {
  display: grid;
  gap: 10px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(4, minmax(90px, auto));
  gap: 12px;
  align-items: center;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 280px 380px minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
}

.kanban-create-panel,
.kanban-board-panel {
  min-height: 0;
  overflow: hidden;
}

.night-sidebar,
.night-detail-panel {
  min-height: 0;
  overflow: hidden;
}

.night-sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.night-sidebar .panel-head {
  gap: 8px;
}

.night-summary-toggle {
  min-width: 44px;
  padding-inline: 8px;
  justify-self: end;
}

.night-layout.summary-collapsed .night-sidebar {
  padding: 12px 9px;
  gap: 10px;
}

.night-layout.summary-collapsed .night-sidebar .panel-head {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.night-layout.summary-collapsed #nightSummaryTitle {
  font-size: 15px;
  line-height: 1;
}

.night-layout.summary-collapsed #nightWindow {
  display: none;
}

.night-layout.summary-collapsed .night-summary-toggle {
  width: 100%;
  min-width: 0;
  padding-inline: 0;
}

.night-detail-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.night-stat-grid {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
}

.night-layout.summary-collapsed .night-stat-grid,
.night-layout.summary-collapsed #nightStats {
  margin-bottom: 0;
}

.night-compact-verdict {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 6px;
  background: rgba(255,255,255,0.025);
}

.night-compact-verdict strong {
  font-size: 13px;
  line-height: 1;
}

.night-compact-verdict small {
  max-width: 100%;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.night-compact-verdict.success {
  border-color: rgba(111, 207, 151, 0.28);
  background: rgba(111, 207, 151, 0.07);
}

.night-compact-verdict.warning {
  border-color: rgba(224, 183, 93, 0.34);
  background: rgba(224, 183, 93, 0.075);
}

.night-compact-verdict.failed {
  border-color: rgba(224, 93, 93, 0.34);
  background: rgba(224, 93, 93, 0.075);
}

.night-compact-grid {
  display: grid;
  gap: 7px;
}

.night-compact-stat {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 48px;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 7px 5px;
  color: var(--text);
  background: rgba(255,255,255,0.025);
  cursor: pointer;
}

.night-compact-stat:hover,
.night-compact-stat:focus,
.night-compact-stat.active {
  outline: none;
  border-color: rgba(215, 168, 95, 0.34);
  background: rgba(215, 168, 95, 0.045);
}

.night-compact-stat span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.night-compact-stat strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.1;
}

.night-compact-stat.warning strong {
  color: var(--warning);
}

.night-compact-stat.failed strong {
  color: var(--danger);
}

.night-compact-stat.history strong {
  color: var(--accent);
}

.night-metric {
  border-left: 3px solid rgba(215, 168, 95, 0.4);
}

.night-metric.success {
  border-color: rgba(111, 207, 151, 0.52);
  background: linear-gradient(90deg, rgba(111, 207, 151, 0.09), rgba(255,255,255,0.026));
}

.night-metric.warning {
  border-color: rgba(224, 183, 93, 0.58);
  background: linear-gradient(90deg, rgba(224, 183, 93, 0.1), rgba(255,255,255,0.026));
}

.night-metric.failed {
  border-color: rgba(224, 93, 93, 0.58);
  background: linear-gradient(90deg, rgba(224, 93, 93, 0.1), rgba(255,255,255,0.026));
}

.night-metric.history {
  border-color: rgba(215, 168, 95, 0.42);
  background: linear-gradient(90deg, rgba(215, 168, 95, 0.07), rgba(255,255,255,0.026));
}

.night-metric.success strong {
  color: var(--success);
}

.night-metric.warning strong {
  color: var(--warning);
}

.night-metric.failed strong {
  color: var(--danger);
}

.night-metric.history strong {
  color: var(--accent);
}

.night-filter-metric {
  min-height: 76px;
}

.night-filter-metric.active {
  border-color: rgba(215, 168, 95, 0.62);
  box-shadow: inset 0 0 0 1px rgba(215, 168, 95, 0.2), 0 0 0 1px rgba(215, 168, 95, 0.06);
}

.night-filter-metric.success.active {
  border-color: rgba(111, 207, 151, 0.68);
  background: linear-gradient(90deg, rgba(111, 207, 151, 0.13), rgba(255,255,255,0.026));
}

.night-filter-metric.warning.active {
  border-color: rgba(224, 183, 93, 0.72);
  background: linear-gradient(90deg, rgba(224, 183, 93, 0.14), rgba(255,255,255,0.026));
}

.night-filter-metric.failed.active {
  border-color: rgba(224, 93, 93, 0.72);
  background: linear-gradient(90deg, rgba(224, 93, 93, 0.14), rgba(255,255,255,0.026));
}

.night-status-strip .night-stat.active,
.night-status-strip .night-stat:hover,
.night-status-strip .night-stat:focus {
  outline: none;
  border-color: rgba(215, 168, 95, 0.48);
  transform: translateY(-1px);
}

.night-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 7px 9px 7px 12px;
  border: 1px solid rgba(215, 168, 95, 0.22);
  border-radius: 8px;
  background: rgba(215, 168, 95, 0.055);
  color: var(--muted);
  font-size: 12px;
}

.night-filter-banner span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.night-groups,
.night-items {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}

.night-group-row {
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.1);
  border-radius: 7px;
  padding: 0 12px;
  cursor: pointer;
}

.night-group-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.night-group-row em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.night-group-row.success {
  border-color: rgba(111, 207, 151, 0.2);
}

.night-group-row.warning {
  border-color: rgba(224, 183, 93, 0.28);
  background: linear-gradient(90deg, rgba(224, 183, 93, 0.055), rgba(255,255,255,0.028));
}

.night-group-row.failed {
  border-color: rgba(224, 93, 93, 0.34);
  background: linear-gradient(90deg, rgba(224, 93, 93, 0.07), rgba(255,255,255,0.028));
}

.night-group-row.history {
  border-color: rgba(215, 168, 95, 0.22);
  background: linear-gradient(90deg, rgba(215, 168, 95, 0.045), rgba(255,255,255,0.026));
}

.night-group-row:hover,
.night-group-row.active {
  background: rgba(215, 168, 95, 0.12);
  border-color: rgba(215, 168, 95, 0.42);
}

.night-group-row b {
  color: var(--accent);
}

.night-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 2px 2px 0;
  color: var(--text);
}

.night-section-head strong {
  font-size: 13px;
}

.night-section-head span {
  color: var(--muted);
  font-size: 12px;
}

.night-reason-head {
  margin-top: 2px;
}

.night-reason-groups {
  display: grid;
  gap: 10px;
}

.night-reason-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(224, 183, 93, 0.26);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(224, 183, 93, 0.07), rgba(255,255,255,0.018)), var(--panel-2);
}

.night-reason-card.failed {
  border-color: rgba(224, 93, 93, 0.36);
  background: linear-gradient(180deg, rgba(224, 93, 93, 0.08), rgba(255,255,255,0.018)), var(--panel-2);
}

.night-reason-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.night-reason-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.night-reason-top b {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 16px;
}

.night-reason-card p,
.night-summary-first p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.night-reason-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.night-reason-meta span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255,255,255,0.028);
}

.night-affected-projects {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.night-layout.summary-collapsed .night-groups {
  gap: 7px;
}

.night-layout.summary-collapsed .night-groups .empty {
  display: none;
}

.night-layout.summary-collapsed .night-group-row {
  min-height: 46px;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 7px 5px;
}

.night-layout.summary-collapsed .night-group-row span {
  justify-content: center;
}

.night-layout.summary-collapsed .night-group-row em {
  display: none;
}

.night-layout.summary-collapsed .night-group-row b {
  font-family: var(--mono);
  font-size: 13px;
}

.night-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.014)), var(--panel-2);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 8px;
}

.night-card.history {
  border-color: rgba(224, 183, 93, 0.18);
  background: linear-gradient(180deg, rgba(224, 183, 93, 0.045), rgba(255,255,255,0.014)), var(--panel-2);
}

.night-card-head,
.night-meta-row,
.night-history-row,
.night-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.night-card-head {
  justify-content: space-between;
}

.night-card-head strong,
.night-card-head span {
  display: block;
}

.night-summary-first {
  display: grid;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.026);
}

.night-error {
  max-height: 150px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  color: #e3d9c8;
  background: #070708;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  white-space: pre-wrap;
}

.night-raw-details {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255,255,255,0.018);
}

.night-raw-details summary {
  cursor: pointer;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 12px;
}

.night-raw-details summary:hover,
.night-raw-details[open] summary {
  color: var(--accent);
}

.night-raw-details .night-error {
  max-height: 260px;
  border-width: 1px 0 0;
  border-radius: 0 0 7px 7px;
}

.night-meta-row {
  color: var(--muted);
  font-size: 12px;
}

.night-history-row {
  gap: 8px;
}

.night-history-row span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 28px;
  padding: 4px 8px;
  color: var(--muted);
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  font-size: 12px;
}

.night-history-row b {
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}

.night-history-row small {
  font-size: 12px;
}

.kanban-create-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  overflow: hidden;
}

.kanban-create-panel .panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
}

.kanban-create-panel .panel-head h2 {
  grid-column: 1;
  margin: 0;
}

.kanban-create-panel .panel-head .muted {
  grid-column: 1;
  min-width: 0;
}

.kanban-create-toggle {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-width: 38px;
  align-self: center;
  color: var(--accent);
  border-color: rgba(215, 168, 95, 0.32);
}

.kanban-create-panel .primary {
  align-self: start;
  min-height: 44px;
  padding: 11px 14px;
}

#kanbanForm {
  align-content: start;
  grid-auto-rows: max-content;
}

.kanban-create-stats {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.kanban-create-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #b9b1a4;
  font-size: 12px;
}

.kanban-create-hint span {
  padding: 4px 7px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 999px;
}

.kanban-layout.create-collapsed .kanban-create-panel {
  align-content: start;
}

.kanban-layout.create-collapsed .kanban-create-panel .panel-head {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 4px 6px 8px;
}

.kanban-layout.create-collapsed #kanbanCreateTitle {
  display: none;
}

.kanban-layout.create-collapsed #kanbanCreateMeta,
.kanban-layout.create-collapsed #kanbanForm {
  display: none;
}

.kanban-layout.create-collapsed .kanban-create-toggle {
  grid-row: auto;
  grid-column: auto;
  width: 42px;
  min-width: 42px;
  padding: 7px 0;
}

.kanban-layout.create-collapsed .kanban-create-stats {
  justify-items: center;
  margin: 0;
  padding: 4px 0;
}

.kanban-create-plus {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #050506;
  background: linear-gradient(135deg, var(--accent), #efc77a);
  border: 1px solid rgba(239, 199, 122, 0.62);
  border-radius: 999px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.kanban-compact-stat {
  width: 46px;
  min-height: 48px;
  display: grid;
  place-items: center;
  gap: 2px;
  color: #d9d5ca;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-radius: 8px;
}

.kanban-compact-stat span {
  color: #9d9588;
  font-size: 12px;
  line-height: 1;
}

.kanban-compact-stat strong {
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
}

.kanban-compact-stat.doing strong {
  color: var(--warning);
}

.kanban-compact-stat.blocked strong {
  color: var(--danger);
}

.kanban-compact-stat.done strong {
  color: var(--success);
}

.kanban-link-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.kanban-link-fields label {
  min-width: 0;
}

.kanban-board-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.kanban-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.kanban-quick-form,
.kanban-toolbar-actions {
  display: grid;
  gap: 8px;
  align-items: center;
}

.kanban-quick-form {
  grid-template-columns: 34px minmax(220px, 1fr) minmax(150px, 210px) auto auto;
  min-height: 52px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 8px;
}

.kanban-toolbar-actions {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) auto auto auto;
}

.kanban-quick-form input,
.kanban-quick-form select,
.kanban-toolbar-actions input,
.kanban-toolbar-actions select {
  min-height: 38px;
  padding: 8px 10px;
}

.kanban-plus {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid rgba(215, 168, 95, 0.28);
  border-radius: 999px;
  background: rgba(215, 168, 95, 0.08);
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.kanban-plus:hover,
.kanban-plus:focus {
  color: #050506;
  background: var(--accent);
  border-color: rgba(239, 199, 122, 0.65);
}

.kanban-plus:disabled {
  opacity: 0.45;
  cursor: wait;
}

.kanban-toolbar .inline-check {
  min-height: 38px;
  padding: 0 8px;
  color: #cfc7b8;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(0,0,0,0.14);
}

html[data-theme="light"] .kanban-toolbar .inline-check {
  color: #394554;
  border-color: rgba(164, 135, 86, 0.24);
  background: rgba(255,255,255,0.78);
}

html[data-theme="light"] .kanban-toolbar .inline-check input:checked + span {
  color: #805812;
  font-weight: 700;
}

.kanban-sd-quick-toggle {
  border-color: rgba(215, 168, 95, 0.28);
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.12), rgba(93, 201, 194, 0.06)),
    rgba(0,0,0,0.14);
}

.kanban-sd-quick-toggle span {
  color: #efe8d8;
  font-weight: 700;
}

.kanban-sd-quick-toggle input:checked + span {
  color: var(--accent);
}

html[data-theme="light"] .kanban-sd-quick-toggle {
  border-color: rgba(184, 123, 22, 0.34);
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.16), rgba(255,255,255,0.74)),
    #fffefa;
}

html[data-theme="light"] .kanban-sd-quick-toggle span {
  color: #57483a;
}

html[data-theme="light"] .kanban-sd-quick-toggle input:checked + span {
  color: #805812;
}

.mini.accent {
  color: #071007;
  background: linear-gradient(135deg, var(--accent), #efc77a);
  border-color: rgba(239, 199, 122, 0.55);
  font-weight: 700;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 3px 2px 8px;
}

.kanban-column {
  --kanban-accent: var(--accent);
  --kanban-glow: rgba(215, 168, 95, 0.16);
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, var(--kanban-glow), transparent 120px),
    rgba(255,255,255,0.025);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-top: 2px solid var(--kanban-accent);
  border-radius: 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.kanban-column[data-kanban-column="backlog"] {
  --kanban-accent: #5dc9c2;
  --kanban-glow: rgba(93, 201, 194, 0.12);
}

.kanban-column[data-kanban-column="todo"] {
  --kanban-accent: #d9d5ca;
  --kanban-glow: rgba(217, 213, 202, 0.08);
}

.kanban-column[data-kanban-column="doing"] {
  --kanban-accent: #e0b75d;
  --kanban-glow: rgba(224, 183, 93, 0.14);
}

.kanban-column[data-kanban-column="blocked"] {
  --kanban-accent: #e05d5d;
  --kanban-glow: rgba(224, 93, 93, 0.12);
}

.kanban-column[data-kanban-column="done"] {
  --kanban-accent: #6fcf97;
  --kanban-glow: rgba(111, 207, 151, 0.12);
}

.kanban-column.drop-target {
  background:
    linear-gradient(180deg, rgba(215, 168, 95, 0.16), transparent 130px),
    rgba(215, 168, 95, 0.05);
  border-color: rgba(215, 168, 95, 0.62);
}

.kanban-column-head {
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.kanban-column-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kanban-status-dot {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 67% 28%, rgba(255,255,255,0.9) 0 7%, transparent 18%),
    radial-gradient(circle at 38% 38%, color-mix(in srgb, var(--kanban-accent) 92%, white 16%) 0 25%, var(--kanban-accent) 58%, color-mix(in srgb, var(--kanban-accent) 55%, black 45%) 100%);
  box-shadow:
    inset -5px -6px 12px rgba(0,0,0,0.45),
    0 0 16px color-mix(in srgb, var(--kanban-accent) 56%, transparent);
}

.kanban-column[data-kanban-column="doing"] .kanban-status-dot::after,
.kanban-card[data-kanban-card-status="doing"]::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid color-mix(in srgb, var(--kanban-accent) 56%, transparent);
  border-radius: 50%;
  animation: aos-pulse 1.8s ease-out infinite;
}

.kanban-column-head .kanban-count {
  min-width: 28px;
  min-height: 24px;
  display: grid;
  place-items: center;
  color: var(--kanban-accent);
  background: rgba(255,255,255,0.035);
  border: 1px solid color-mix(in srgb, var(--kanban-accent) 34%, transparent);
  border-radius: 999px;
  font-size: 12px;
}

@keyframes aos-pulse {
  0% {
    opacity: 0.8;
    transform: scale(0.72);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

/* UX-7: мягкое дыхание свечения статус-точек (box-shadow, без scale-строба) */
@keyframes aos-status-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 183, 93, 0), 0 0 6px rgba(224, 183, 93, 0.4); }
  50% { box-shadow: 0 0 0 3px rgba(224, 183, 93, 0.1), 0 0 11px rgba(224, 183, 93, 0.65); }
}

@keyframes aos-status-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 93, 93, 0), 0 0 7px rgba(224, 93, 93, 0.45); }
  50% { box-shadow: 0 0 0 3px rgba(224, 93, 93, 0.14), 0 0 13px rgba(224, 93, 93, 0.72); }
}

/* UX-10: frosted confirm modal */
.aos-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 5, 6, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: aos-modal-fade var(--t-fast);
}

html[data-theme="light"] .aos-modal-overlay {
  background: rgba(40, 48, 60, 0.42);
}

.aos-modal {
  width: 420px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: aos-modal-pop var(--t-med);
}

.aos-modal.danger {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-a24);
}

.aos-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.aos-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  background: var(--accent-a12);
  color: var(--accent);
  font-weight: 700;
}

.aos-modal-title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.aos-modal-body {
  padding: 14px 18px 4px;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text);
}

.aos-modal-meta {
  padding: 10px 18px 4px;
  display: grid;
  gap: 4px;
}

.aos-modal-meta-line {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.aos-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 18px 18px;
}

@keyframes aos-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes aos-modal-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* UX-9: command palette (Ctrl+K) */
.aos-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 24px 24px;
  background: rgba(5, 5, 6, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: aos-modal-fade var(--t-fast);
}

html[data-theme="light"] .aos-palette-overlay {
  background: rgba(40, 48, 60, 0.4);
}

.aos-palette {
  width: 560px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: aos-modal-pop var(--t-med);
}

.aos-palette-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.aos-palette-prompt {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-md);
}

.aos-palette-input input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--text-md);
  padding: 2px 0;
}

.aos-palette-input input:focus {
  border: 0;
  box-shadow: none;
}

.aos-palette-kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.aos-palette-list {
  max-height: 50vh;
  overflow-y: auto;
  padding: 6px 0;
}

.aos-palette-group-title {
  padding: 8px 16px 4px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.aos-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  cursor: pointer;
}

.aos-palette-item.active,
.aos-palette-item:hover {
  background: var(--accent-a08);
  box-shadow: inset 2px 0 0 var(--accent);
}

.aos-palette-label {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text);
}

.aos-palette-hint {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.aos-palette-hint.danger {
  color: var(--danger);
}

.aos-palette-empty {
  padding: 18px 16px;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* UX-11: единый loader — анимированный AOS-знак (SVG со встроенной анимацией). 3 размера. */
.aos-loader {
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
  object-fit: contain;
}

.aos-loader-sm {
  width: 18px;
  height: 18px;
  margin-left: 6px;
}

/* inline-«курсор» думания/ответа в чате — крупнее, чтобы анимация была видна */
.aos-loader-cursor {
  width: 26px;
  height: 26px;
  margin-left: 4px;
  margin-bottom: -6px;
}

.aos-loader-md {
  width: 40px;
  height: 40px;
}

/* UX-11b: единый плейсхолдер загрузки (знак + подпись) */
.aos-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* крупная «думающая» иконка в чате вместо текста «Думаю» */
.aos-loader-think {
  width: 60px;
  height: 60px;
}

.chat-bubble.chat-thinking {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
  min-width: 92px;
  padding: 8px 14px;
}

.aos-loader-lg {
  width: 84px;
  height: 84px;
}

.kanban-column-body {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.kanban-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 12px 13px;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.014)), #151519;
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-radius: 7px;
  cursor: grab;
  transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.kanban-card[data-kanban-card-status="doing"] {
  border-color: color-mix(in srgb, var(--warning) 48%, rgba(215, 168, 95, 0.2));
}

.kanban-card[data-kanban-card-status="doing"]::before {
  inset: 9px auto auto 9px;
  width: 8px;
  height: 8px;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .kanban-column[data-kanban-column="doing"] .kanban-status-dot::after,
  .kanban-card[data-kanban-card-status="doing"]::before,
  .status-light.warning,
  .status-light.failed,
  .aos-modal-overlay,
  .aos-modal,
  .aos-palette-overlay,
  .aos-palette {
    animation: none;
  }
  .ghost,
  .primary,
  .mini,
  .nav-item,
  .mode-tab,
  .agent-card,
  .mission-card,
  .file-row,
  .table-row,
  input,
  select,
  textarea {
    transition: none;
  }
  .ghost:active,
  .primary:active,
  .mini:active {
    transform: none;
  }
}

.kanban-card:hover {
  border-color: color-mix(in srgb, var(--kanban-accent) 55%, rgba(215, 168, 95, 0.2));
  background: linear-gradient(180deg, var(--kanban-glow), rgba(255,255,255,0.018)), #151519;
}

.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.kanban-card-meta .mono {
  flex: 1 1 130px;
  min-width: 0;
}

.kanban-card-select {
  flex: 1 1 88px;
  min-width: 82px;
  min-height: 30px;
  padding: 5px 7px;
  color: #efe8d8;
  color-scheme: dark;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(0,0,0,0.22)), #101114;
  border: 1px solid rgba(215, 168, 95, 0.28);
  border-radius: 7px;
  font-size: 12px;
}

.kanban-card-select:hover,
.kanban-card-select:focus {
  background: #11151a;
  border-color: rgba(215, 168, 95, 0.55);
}

.kanban-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kanban-link-chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 7px;
  color: #d9d5ca;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-radius: 999px;
  font-size: 12px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.kanban-link-chip:hover,
.kanban-link-chip:focus {
  color: #050506;
  background: var(--accent);
  border-color: rgba(239, 199, 122, 0.62);
}

.kanban-card.dragging {
  opacity: 0.45;
  transform: scale(0.985);
  cursor: grabbing;
}

.kanban-card p {
  color: #cfc7b8;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.kanban-sd-block {
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  color: #d9d5ca;
  background: rgba(7, 10, 12, 0.32);
  border: 1px solid rgba(215, 168, 95, 0.16);
  border-left: 3px solid var(--accent);
  border-radius: 7px;
}

.kanban-sd-block.gate-pending {
  border-left-color: var(--warning);
}

.kanban-sd-block.gate-approved {
  border-left-color: var(--success);
}

.kanban-sd-block.gate-needs_changes {
  border-left-color: var(--danger);
}

.kanban-sd-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}

.kanban-sd-chip {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  color: #efe8d8;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.kanban-sd-chip.risk-medium {
  color: var(--warning);
}

.kanban-sd-chip.risk-high,
.kanban-sd-chip.risk-urgent {
  color: var(--danger);
}

.kanban-sd-artifacts {
  color: #cfc7b8;
  font-size: 12px;
  line-height: 1.45;
}

.kanban-sd-block pre {
  max-height: 210px;
  overflow: auto;
  margin: 0;
  padding: 8px;
  color: #e9dfcb;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.kanban-plan-editor {
  display: grid;
  gap: 7px;
}

.kanban-plan-editor label {
  display: grid;
  gap: 4px;
  color: #cfc7b8;
  font-size: 12px;
  font-weight: 700;
}

.kanban-plan-editor input,
.kanban-plan-editor textarea {
  width: 100%;
  min-width: 0;
  color: #e9dfcb;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.kanban-plan-editor textarea {
  min-height: 132px;
  resize: vertical;
}

.kanban-self-check summary {
  cursor: pointer;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.kanban-self-check p {
  margin: 6px 0 0;
  font-size: 12px;
}

.kanban-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.knowledge-list-panel,
.knowledge-preview-panel {
  min-height: 0;
  overflow: hidden;
}

.knowledge-list-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.knowledge-preview-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
}

.knowledge-list {
  display: grid;
  gap: 9px;
  min-height: 0;
  overflow: auto;
}

.knowledge-row {
  width: 100%;
  display: grid;
  gap: 5px;
  color: var(--text);
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.1);
  border-radius: 7px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.knowledge-row-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.knowledge-badge {
  flex: 0 0 auto;
  color: #15100a;
  background: #d7a85f;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.knowledge-row:hover,
.knowledge-row.active {
  background: rgba(215, 168, 95, 0.13);
  border-color: rgba(215, 168, 95, 0.52);
}

.knowledge-row strong,
.knowledge-row span,
.knowledge-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-row span,
.knowledge-row small {
  color: var(--muted);
  font-size: 12px;
}

.knowledge-row .knowledge-badge {
  color: #15100a;
  font-size: 12px;
}

.knowledge-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255,255,255,0.035);
}

.segmented .mini {
  border-color: transparent;
  background: transparent;
}

.segmented .mini.active {
  color: #101014;
  background: var(--accent);
  border-color: rgba(224, 177, 93, 0.72);
}

.knowledge-links {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.knowledge-links > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.knowledge-link-chip {
  max-width: 320px;
  min-height: 27px;
  color: var(--text);
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.16);
  border-radius: 6px;
  padding: 4px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.knowledge-link-chip:hover,
.knowledge-link-chip:focus-visible {
  border-color: rgba(215, 168, 95, 0.55);
  background: rgba(215, 168, 95, 0.12);
}

.knowledge-preview {
  white-space: normal;
}

.knowledge-preview.markdown-preview {
  font-family: var(--font-body);
  font-size: 14px;
}

.knowledge-preview.source-preview {
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
}

.knowledge-preview h2,
.knowledge-preview h3,
.knowledge-preview h4,
.knowledge-preview h5 {
  margin: 0 0 10px;
  color: #f1d7a3;
  line-height: 1.2;
  letter-spacing: 0;
}

.knowledge-preview p,
.knowledge-preview li,
.knowledge-preview blockquote {
  max-width: 980px;
  color: #d9d2c3;
  line-height: 1.65;
}

.knowledge-preview p {
  margin: 0 0 12px;
}

.knowledge-preview ul {
  display: grid;
  gap: 5px;
  margin: 0 0 14px;
  padding-left: 20px;
}

.knowledge-preview blockquote {
  margin: 0 0 14px;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(215, 168, 95, 0.06);
}

.knowledge-preview code {
  color: #ffe2a7;
  font-family: var(--font-mono);
}

.knowledge-preview pre {
  margin: 0 0 14px;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #050506;
  white-space: pre-wrap;
}

.knowledge-snippets {
  display: grid;
  gap: 9px;
}

.knowledge-snippet {
  display: grid;
  gap: 6px;
  width: 100%;
  color: var(--text);
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-radius: 7px;
  padding: 11px;
  text-align: left;
  cursor: pointer;
}

.knowledge-snippet.active,
.knowledge-snippet:hover {
  border-color: rgba(215, 168, 95, 0.58);
  background: rgba(215, 168, 95, 0.1);
}

.knowledge-snippet span {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.workspace-layout > .panel,
.missions-layout > .panel,
.kanban-layout > .panel {
  min-height: 0;
  overflow: hidden;
}

.workspace-buckets-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.workspace-files-panel,
.missions-layout > .panel:nth-child(2) {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  min-width: 0;
}

.missions-layout > .panel:nth-child(2) {
  grid-template-rows: auto minmax(0, 1fr);
}

.crumbs {
  min-height: 30px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.workspace-path-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.workspace-path-form .mini {
  min-height: 38px;
}

.workspace-path-form input {
  min-height: 38px;
  padding: 8px 10px;
}

.workspace-upload-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.bucket-list {
  display: grid;
  gap: 9px;
  min-height: 0;
  overflow: auto;
}

.bucket-card {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  color: var(--text);
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.1);
  border-radius: 7px;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.bucket-card:hover,
.bucket-card.active {
  background: rgba(215, 168, 95, 0.13);
  border-color: rgba(215, 168, 95, 0.52);
}

.bucket-card strong,
.bucket-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bucket-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.bucket-card b {
  min-width: 32px;
  min-height: 26px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(215, 168, 95, 0.08);
  border: 1px solid rgba(215, 168, 95, 0.18);
  border-radius: 999px;
  font-size: 12px;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
}

.crumb-btn {
  min-height: 28px;
  color: #c9c1b3;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 6px;
  padding: 0 9px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
}

.crumb-btn.active,
.crumb-btn:hover {
  color: var(--text);
  background: rgba(215, 168, 95, 0.14);
  border-color: rgba(215, 168, 95, 0.48);
}

.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 58px;
  cursor: pointer;
}

.file-row > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row > .mono {
  flex: 0 1 42%;
  min-width: 72px;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 22px;
  margin-right: 8px;
  border: 1px solid rgba(215, 168, 95, 0.22);
  border-radius: 5px;
  color: var(--accent);
  background: rgba(215, 168, 95, 0.08);
  font-family: var(--font-mono);
  font-size: 12px;
}

.file-row:hover {
  border-color: var(--accent-2);
}

.file-row.active {
  background: rgba(215, 168, 95, 0.1);
  border-color: rgba(215, 168, 95, 0.45);
}

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.preview-mode-controls.hidden {
  display: none;
}

.preview-open-link {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  color: var(--text);
  text-decoration: none;
}

.preview-open-link.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.file-preview,
.logs {
  min-height: 0;
  max-height: none;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #070708;
  color: #d9d2c3;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

html[data-theme="light"] .file-preview,
html[data-theme="light"] .logs {
  background: #f4f6f8;
  color: #20242a;
  border-color: rgba(120, 128, 140, 0.34);
}

/* UX-8 fix: базовый/INFO текст строки на светлой теме был светло-серым (под тёмный фон) → нечитаем на белом */
html[data-theme="light"] .log-line {
  color: #3a4049;
}

html[data-theme="light"] .chat-messages {
  background: #f2f5f8;
  border-color: rgba(120, 128, 140, 0.34);
}

html[data-theme="light"] .chat-bubble,
html[data-theme="light"] .tool-activity,
html[data-theme="light"] .chat-inline-event,
html[data-theme="light"] .mission-activity,
html[data-theme="light"] .kanban-activity,
html[data-theme="light"] .request-item,
html[data-theme="light"] .control-event-detail,
html[data-theme="light"] .control-room-work-card,
html[data-theme="light"] .control-room-paths div {
  background: #ffffff;
  color: var(--text);
  border-color: rgba(120, 128, 140, 0.26);
}

html[data-theme="light"] .chat-code-block {
  background: #f4f6f8;
  border-color: rgba(120, 128, 140, 0.28);
}

html[data-theme="light"] .chat-code-head {
  color: #5d6876;
  background: rgba(30, 42, 58, 0.045);
  border-bottom-color: rgba(120, 128, 140, 0.22);
}

html[data-theme="light"] .chat-code-block code {
  color: #20242a;
}

html[data-theme="light"] .chat-text-fragment code {
  color: #6f4a10;
  background: rgba(173, 118, 31, 0.1);
  border-color: rgba(173, 118, 31, 0.2);
}

html[data-theme="light"] .chat-message.user .chat-bubble {
  background: rgba(168, 116, 40, 0.12);
  border-color: rgba(168, 116, 40, 0.34);
}

html[data-theme="light"] .chat-message.failed .chat-bubble,
html[data-theme="light"] .control-event-detail.failed,
html[data-theme="light"] .control-event-detail.interrupted,
html[data-theme="light"] .control-room-work-card.failed {
  color: var(--text);
  background: linear-gradient(180deg, rgba(179, 45, 45, 0.08), #ffffff);
  border-color: rgba(179, 45, 45, 0.28);
}

html[data-theme="light"] .tool-row,
html[data-theme="light"] .tool-activity time,
html[data-theme="light"] .kanban-link-chip,
html[data-theme="light"] .kanban-card p,
html[data-theme="light"] .kanban-card-select {
  color: var(--text);
}

html[data-theme="light"] .activity-row,
html[data-theme="light"] button.activity-row,
html[data-theme="light"] .activity-feed-row {
  border-bottom-color: rgba(120, 128, 140, 0.22);
}

html[data-theme="light"] .control-event-row:hover,
html[data-theme="light"] .control-event-row.active,
html[data-theme="light"] .activity-feed-row:hover,
html[data-theme="light"] .activity-feed-row:focus,
html[data-theme="light"] .activity-feed-row.active,
html[data-theme="light"] .control-event-tail,
html[data-theme="light"] .control-event-filterbar .mini.active {
  background: rgba(168, 116, 40, 0.1);
}

html[data-theme="light"] .control-event-json pre {
  background: #f1f4f7;
  color: #20242a;
  border-color: rgba(120, 128, 140, 0.3);
}

html[data-theme="light"] .quote-popover,
html[data-theme="light"] .chat-jump-bottom {
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent);
  box-shadow: 0 12px 30px rgba(30, 38, 50, 0.14);
}

html[data-theme="light"] .attach-btn,
html[data-theme="light"] .segmented,
html[data-theme="light"] .control-event-filterbar,
html[data-theme="light"] .context-actions .mini,
html[data-theme="light"] .reports-actions .mini,
html[data-theme="light"] .preview-actions .mini,
html[data-theme="light"] .service-action-table .mini,
html[data-theme="light"] .request-actions .mini,
html[data-theme="light"] .message-action-icon,
html[data-theme="light"] .chat-code-copy,
html[data-theme="light"] .report-kind,
html[data-theme="light"] .knowledge-link-chip,
html[data-theme="light"] .knowledge-snippet {
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  border-color: rgba(120, 128, 140, 0.28);
}

html[data-theme="light"] .attach-btn:hover,
html[data-theme="light"] .attach-btn:focus-within,
html[data-theme="light"] .context-actions .mini:hover,
html[data-theme="light"] .reports-actions .mini:hover,
html[data-theme="light"] .preview-actions .mini:hover,
html[data-theme="light"] .service-action-table .mini:hover,
html[data-theme="light"] .request-actions .mini:hover,
html[data-theme="light"] .message-action-icon:hover,
html[data-theme="light"] .message-action-icon:focus-visible,
html[data-theme="light"] .chat-code-copy:hover,
html[data-theme="light"] .chat-code-copy:focus-visible,
html[data-theme="light"] .report-kind:hover,
html[data-theme="light"] .knowledge-link-chip:hover,
html[data-theme="light"] .knowledge-snippet:hover {
  background: rgba(173, 118, 31, 0.1);
  border-color: rgba(173, 118, 31, 0.36);
}

html[data-theme="light"] .segmented .mini {
  background: transparent;
}

html[data-theme="light"] .segmented .mini.active,
html[data-theme="light"] .report-kind.active,
html[data-theme="light"] .control-event-filterbar .mini.active {
  color: #19140b;
  background: rgba(173, 118, 31, 0.18);
  border-color: rgba(173, 118, 31, 0.42);
}

html[data-theme="light"] .mini:disabled,
html[data-theme="light"] .attach-btn:has(input:disabled) {
  background: rgba(244, 247, 250, 0.82);
  color: rgba(93, 104, 118, 0.58);
  border-color: rgba(120, 128, 140, 0.18);
}

html[data-theme="light"] .action-risk-agent,
html[data-theme="light"] .action-risk-prepared,
html[data-theme="light"] .action-risk-dangerous {
  border-color: var(--risk-border);
  background: var(--risk-bg);
}

html[data-theme="light"] .agent-control-actions .action-risk-dangerous:not(:disabled),
html[data-theme="light"] .service-action-table .action-risk-dangerous:not(:disabled) {
  color: #7e1f1f;
  border-color: rgba(179, 45, 45, 0.32);
  background: rgba(179, 45, 45, 0.1);
}

html[data-theme="light"] .primary.action-risk-agent {
  background: var(--accent);
}

html[data-theme="light"] .action-risk-agent:hover,
html[data-theme="light"] .action-risk-agent:focus-visible,
html[data-theme="light"] .action-risk-prepared:hover,
html[data-theme="light"] .action-risk-prepared:focus-visible,
html[data-theme="light"] .action-risk-dangerous:hover,
html[data-theme="light"] .action-risk-dangerous:focus-visible {
  border-color: color-mix(in srgb, var(--risk-color) 58%, var(--line));
  background: color-mix(in srgb, var(--risk-color) 12%, rgba(255, 255, 255, 0.9));
}

html[data-theme="light"] .action-risk:disabled,
html[data-theme="light"] .action-risk[aria-disabled="true"],
html[data-theme="light"] .attach-btn.action-risk:has(input:disabled) {
  background: rgba(244, 247, 250, 0.82);
  color: rgba(93, 104, 118, 0.58);
  border-color: rgba(120, 128, 140, 0.18);
}

html[data-theme="light"] .control-event-filterbar {
  box-shadow: 0 8px 22px rgba(30, 42, 58, 0.08);
}

html[data-theme="light"] #chatSendBtn.stop-mode {
  color: #19140b;
  background: rgba(173, 118, 31, 0.22);
  border-color: rgba(173, 118, 31, 0.46);
}

html[data-theme="light"] .report-insight-summary {
  background: linear-gradient(180deg, rgba(173, 118, 31, 0.08), rgba(255,255,255,0.92));
  border-color: rgba(173, 118, 31, 0.26);
}

html[data-theme="light"] .report-insight-item,
html[data-theme="light"] .report-problem-row,
html[data-theme="light"] .report-problem-metrics span {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(120, 128, 140, 0.26);
}

html[data-theme="light"] .report-problem-row {
  box-shadow: 0 8px 18px rgba(30, 42, 58, 0.05);
}

html[data-theme="light"] .kanban-card {
  background: linear-gradient(180deg, #ffffff, #f7f9fb);
  border-color: rgba(120, 128, 140, 0.28);
}

html[data-theme="light"] .kanban-card:hover {
  background: linear-gradient(180deg, rgba(168, 116, 40, 0.08), #ffffff);
  border-color: color-mix(in srgb, var(--kanban-accent) 42%, rgba(120, 128, 140, 0.28));
}

html[data-theme="light"] .kanban-card-select,
html[data-theme="light"] .kanban-link-chip {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(168, 116, 40, 0.2);
}

html[data-theme="light"] .kanban-sd-quick-toggle {
  background:
    linear-gradient(90deg, rgba(173, 118, 31, 0.12), rgba(31, 123, 116, 0.06)),
    rgba(255, 255, 255, 0.78);
  border-color: rgba(173, 118, 31, 0.28);
}

html[data-theme="light"] .kanban-sd-quick-toggle span {
  color: var(--text);
}

html[data-theme="light"] .kanban-sd-quick-toggle input:checked + span {
  color: #80551d;
}

html[data-theme="light"] .kanban-sd-block {
  color: var(--text);
  background: rgba(244, 247, 250, 0.92);
  border-color: rgba(168, 116, 40, 0.22);
}

html[data-theme="light"] .kanban-sd-chip {
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(120, 128, 140, 0.24);
}

html[data-theme="light"] .kanban-sd-artifacts {
  color: #3f4955;
}

html[data-theme="light"] .kanban-sd-block pre {
  color: #20242a;
  background: #ffffff;
  border-color: rgba(120, 128, 140, 0.24);
}

html[data-theme="light"] .kanban-plan-editor label {
  color: #3f4955;
}

html[data-theme="light"] .kanban-plan-editor input,
html[data-theme="light"] .kanban-plan-editor textarea {
  color: #20242a;
  background: #ffffff;
  border-color: rgba(120, 128, 140, 0.26);
}

html[data-theme="light"] .knowledge-preview h2,
html[data-theme="light"] .knowledge-preview h3,
html[data-theme="light"] .knowledge-preview h4,
html[data-theme="light"] .knowledge-preview h5 {
  color: #80551d;
}

html[data-theme="light"] .knowledge-preview p,
html[data-theme="light"] .knowledge-preview li,
html[data-theme="light"] .knowledge-preview blockquote {
  color: #303741;
}

html[data-theme="light"] .knowledge-preview code {
  color: #7d521a;
}

html[data-theme="light"] .knowledge-preview p code,
html[data-theme="light"] .knowledge-preview li code,
html[data-theme="light"] .knowledge-preview blockquote code {
  padding: 1px 5px;
  border: 1px solid rgba(173, 118, 31, 0.2);
  border-radius: 4px;
  background: rgba(173, 118, 31, 0.08);
}

html[data-theme="light"] .knowledge-preview pre {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 248, 251, 0.96)),
    repeating-linear-gradient(135deg, rgba(173, 118, 31, 0.055) 0 1px, transparent 1px 14px);
  color: #3f3a32;
  border-color: rgba(120, 128, 140, 0.26);
  box-shadow:
    inset 3px 0 0 rgba(173, 118, 31, 0.46),
    0 10px 24px rgba(38, 50, 66, 0.07);
}

html[data-theme="light"] .knowledge-preview pre code {
  color: #4a3820;
}

html[data-theme="light"] .knowledge-preview.source-preview pre {
  background:
    linear-gradient(180deg, #ffffff, #f5f8fb),
    repeating-linear-gradient(0deg, rgba(120, 128, 140, 0.06) 0 1px, transparent 1px 26px);
}

html[data-theme="light"] .knowledge-snippet span {
  color: var(--muted);
}

.logs-context {
  display: none;
}

.logs-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logs-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(104px, 1fr));
  gap: 8px;
  width: min(620px, 100%);
}

.logs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.logs-signal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(120, 128, 140, 0.18);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(55, 60, 68, 0.22), rgba(10, 10, 11, 0.78)),
    #0a0a0b;
}

.logs-signal.critical {
  border-color: rgba(235, 94, 94, 0.42);
  background:
    linear-gradient(90deg, rgba(139, 25, 25, 0.26), rgba(10, 10, 11, 0.82)),
    #0a0a0b;
  box-shadow: inset 4px 0 0 rgba(235, 94, 94, 0.9);
}

.logs-signal.warning {
  border-color: rgba(215, 168, 95, 0.42);
  background:
    linear-gradient(90deg, rgba(133, 88, 18, 0.22), rgba(10, 10, 11, 0.82)),
    #0a0a0b;
  box-shadow: inset 4px 0 0 rgba(215, 168, 95, 0.85);
}

.logs-signal.ok {
  border-color: rgba(69, 173, 114, 0.32);
  box-shadow: inset 4px 0 0 rgba(69, 173, 114, 0.72);
}

.logs-signal-main {
  display: grid;
  gap: 5px;
  min-width: 0;
  align-content: center;
}

.logs-signal-main span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.logs-signal.critical .logs-signal-main span {
  color: #ff8585;
}

.logs-signal.warning .logs-signal-main span {
  color: #f0c477;
}

.logs-signal-main strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
}

.logs-signal-main p {
  margin: 0;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.signal-metric {
  display: grid;
  gap: 2px;
  align-content: center;
  min-width: 0;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.signal-metric.active {
  border-color: rgba(215, 168, 95, 0.62);
  background: rgba(215, 168, 95, 0.12);
  box-shadow: inset 0 0 0 1px rgba(215, 168, 95, 0.12);
}

.signal-metric:hover,
.signal-metric:focus-visible {
  border-color: rgba(215, 168, 95, 0.46);
  outline: none;
}

.signal-metric b {
  font-family: var(--font-mono);
  font-size: 22px;
  line-height: 1;
}

.signal-metric span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.signal-metric.error b {
  color: #ff8585;
}

.signal-metric.warning b {
  color: #f0c477;
}

.signal-metric.info b {
  color: #9eb6d8;
}

.signal-metric.total b {
  color: var(--text);
}

.logs-signal-actions {
  display: grid;
  gap: 8px;
  align-content: center;
  justify-items: end;
}

.logs-context.active {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(215, 168, 95, 0.24);
  border-radius: 7px;
  background: rgba(215, 168, 95, 0.055);
}

.logs-context > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.logs-context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.logs-context-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.logs-context p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.log-hit {
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(215, 168, 95, 0.32);
  color: #fff2d4;
}

.log-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 7px 9px;
  border-left: 3px solid transparent;
  border-radius: 5px;
  color: rgba(217, 210, 195, 0.66);
}

.log-line + .log-line {
  margin-top: 2px;
}

.log-line code {
  min-width: 0;
  color: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log-line.error {
  color: #ffe2e2;
  background:
    linear-gradient(90deg, rgba(193, 58, 58, 0.24), rgba(193, 58, 58, 0.08)),
    rgba(13, 7, 7, 0.8);
  border-left-color: #f35f5f;
  box-shadow: inset 0 0 0 1px rgba(235, 94, 94, 0.12);
}

.log-line.warning {
  color: #ffe5b3;
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.2), rgba(215, 168, 95, 0.07)),
    rgba(16, 12, 6, 0.72);
  border-left-color: #d7a85f;
}

.log-line.traceback {
  box-shadow: inset 0 0 0 1px rgba(235, 94, 94, 0.24);
}

.log-line.focus {
  outline: 2px solid rgba(255, 228, 163, 0.9);
  outline-offset: 2px;
  animation: log-focus-pulse 1.25s ease-out 1;
}

@keyframes log-focus-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 228, 163, 0.46);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(255, 228, 163, 0);
  }
}

.log-severity,
.log-repeat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
}

.log-line.error .log-severity {
  color: #ffd8d8;
  background: rgba(235, 94, 94, 0.16);
  border-color: rgba(235, 94, 94, 0.54);
}

.log-line.warning .log-severity {
  color: #ffe5b3;
  background: rgba(215, 168, 95, 0.14);
  border-color: rgba(215, 168, 95, 0.5);
}

/* UX-8: INFO — мягко-зелёный бейдж, завершает «светофор» уровней (info/warn/error) */
.log-line.info .log-severity {
  color: #9eccb0;
  background: rgba(126, 208, 156, 0.1);
  border-color: rgba(126, 208, 156, 0.32);
}

.log-repeat {
  color: var(--accent);
}

.preview-panel .file-preview {
  height: 100%;
}

.file-preview pre {
  margin: 0;
  white-space: pre-wrap;
}

.file-preview img,
.file-preview video,
.file-preview iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 6px;
  background: #000;
  object-fit: contain;
}

.file-preview audio {
  width: min(720px, 100%);
}

.image-preview,
.video-preview,
.html-preview,
.audio-preview {
  display: grid;
  place-items: center;
  white-space: normal;
}

.html-preview.source-preview {
  display: block;
  place-items: initial;
  white-space: pre-wrap;
}

.mission-card .file-preview {
  max-height: 240px;
}

.logs {
  min-height: 520px;
  max-height: 70vh;
  display: block;
}

html[data-theme="light"] .log-hit {
  background: rgba(173, 118, 31, 0.22);
  color: #5c3b08;
}

html[data-theme="light"] .logs-signal {
  background: #ffffff;
  border-color: rgba(120, 128, 140, 0.26);
}

html[data-theme="light"] .logs-signal.critical {
  background: linear-gradient(90deg, rgba(179, 45, 45, 0.1), #ffffff);
  border-color: rgba(179, 45, 45, 0.32);
  box-shadow: inset 4px 0 0 rgba(179, 45, 45, 0.82);
}

html[data-theme="light"] .logs-signal.warning {
  background: linear-gradient(90deg, rgba(173, 118, 31, 0.12), #ffffff);
  border-color: rgba(173, 118, 31, 0.32);
  box-shadow: inset 4px 0 0 rgba(173, 118, 31, 0.78);
}

html[data-theme="light"] .signal-metric {
  background: rgba(30, 42, 58, 0.045);
  border-color: rgba(120, 128, 140, 0.24);
}

html[data-theme="light"] .logs-signal-main strong,
html[data-theme="light"] .signal-metric {
  color: var(--text);
}

html[data-theme="light"] .signal-metric.active {
  background: rgba(173, 118, 31, 0.12);
  border-color: rgba(173, 118, 31, 0.38);
}

html[data-theme="light"] .log-line.error {
  color: #5b1010;
  background: linear-gradient(90deg, rgba(179, 45, 45, 0.16), rgba(179, 45, 45, 0.055));
  border-left-color: rgba(179, 45, 45, 0.76);
}

html[data-theme="light"] .log-line.warning {
  color: #674400;
  background: linear-gradient(90deg, rgba(173, 118, 31, 0.16), rgba(173, 118, 31, 0.055));
  border-left-color: rgba(173, 118, 31, 0.72);
}

html[data-theme="light"] .log-line.error .log-severity {
  color: #721919;
  border-color: rgba(179, 45, 45, 0.34);
}

html[data-theme="light"] .log-line.warning .log-severity {
  color: #744d04;
  border-color: rgba(173, 118, 31, 0.34);
}

html[data-theme="light"] .log-line.info .log-severity {
  color: #246244;
  border-color: rgba(35, 118, 77, 0.34);
}

@media (max-width: 720px) {
  .logs-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .logs-filters,
  .logs-actions {
    width: 100%;
  }

  .logs-actions .mini {
    flex: 1 1 140px;
  }

  .logs-signal {
    grid-template-columns: 1fr;
  }

  .logs-signal-actions {
    justify-items: stretch;
  }

  .log-line {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

.reports-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr) minmax(240px, 320px);
  gap: 16px;
  align-items: start;
}

.reports-control-panel,
.reports-history-panel {
  position: sticky;
  top: 24px;
}

.reports-form {
  display: grid;
  gap: 10px;
}

.reports-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.report-kind-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.report-kind {
  min-height: 38px;
  padding: 9px 10px;
  color: var(--muted);
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  text-align: left;
  cursor: pointer;
}

.report-kind.active {
  color: var(--text);
  border-color: rgba(215, 168, 95, 0.55);
  background: rgba(215, 168, 95, 0.1);
}

.reports-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.reports-status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--warning);
  font-size: 12px;
}

.reports-preview-panel {
  min-width: 0;
}

.reports-preview {
  display: grid;
  gap: 14px;
  min-height: 520px;
}

.report-insight-summary {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(215, 168, 95, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.075), rgba(255,255,255,0.018));
}

.report-insight-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.report-insight-head h2,
.report-insight-head h3,
.report-insight-section h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.report-insight-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.report-insight-warning {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: var(--warning);
  background: rgba(215, 168, 95, 0.1);
  border: 1px solid rgba(215, 168, 95, 0.24);
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
}

.report-insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-insight-section {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.report-insight-list {
  display: grid;
  gap: 7px;
}

.report-insight-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 66px;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255,255,255,0.026);
}

.report-insight-item.good {
  border-left-color: var(--success);
}

.report-insight-item.warning {
  border-left-color: var(--warning);
}

.report-insight-item.bad {
  border-left-color: var(--danger);
}

.report-insight-item strong,
.report-problem-main strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-insight-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.report-insight-item em {
  color: var(--accent);
  font-style: normal;
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.report-problem-rows {
  display: grid;
  gap: 9px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.report-problem-list {
  display: grid;
  gap: 8px;
}

.report-problem-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(260px, 1fr);
  gap: 8px 12px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(0,0,0,0.14);
}

.report-problem-row.good {
  border-left-color: var(--success);
}

.report-problem-row.warning {
  border-left-color: var(--warning);
}

.report-problem-row.bad {
  border-left-color: var(--danger);
}

.report-problem-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.report-rule {
  width: max-content;
  max-width: 100%;
  padding: 2px 6px;
  overflow: hidden;
  color: var(--accent);
  background: rgba(215, 168, 95, 0.1);
  border: 1px solid rgba(215, 168, 95, 0.22);
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-problem-main small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-problem-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-content: start;
}

.report-problem-metrics span {
  padding: 3px 6px;
  color: var(--text);
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.report-problem-row p,
.report-problem-action {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.report-problem-action {
  color: var(--text);
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
}

.report-kpi-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  justify-content: stretch;
  align-items: stretch;
}

.report-metric {
  min-height: 118px;
}

.report-kpi-grid.compact .report-metric {
  min-height: clamp(78px, 6vw, 96px);
  padding: 12px 14px;
}

.report-kpi-grid.compact .report-metric span {
  color: var(--muted);
  font-size: 12px;
}

.report-kpi-grid.compact .report-metric strong {
  margin-top: 7px;
  font-size: 26px;
  line-height: 1;
}

.report-metric.etl-status {
  position: relative;
  overflow: hidden;
  border-left: 3px solid var(--line-soft);
}

.report-metric.etl-status::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
}

.report-metric.etl-status.bad {
  border-left-color: var(--danger);
}

.report-metric.etl-status.bad strong {
  color: var(--danger);
}

.report-metric.etl-status.bad::after {
  background: var(--danger);
}

.report-metric.etl-status.warning {
  border-left-color: var(--warning);
}

.report-metric.etl-status.warning strong {
  color: var(--warning);
}

.report-metric.etl-status.warning::after {
  background: var(--warning);
}

.report-metric.etl-status.good {
  border-left-color: var(--success);
}

.report-metric.etl-status.good strong {
  color: var(--success);
}

.report-metric.etl-status.good::after {
  background: var(--success);
}

.report-metric.etl-status.neutral {
  border-left-color: rgba(89, 142, 255, 0.62);
}

.report-metric.etl-status.neutral strong {
  color: #8fb3ff;
}

.report-metric.etl-status.neutral::after {
  background: #5f8dff;
}

.report-metric-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.report-metric small {
  display: block;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
}

.report-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.report-delta.good {
  color: var(--success);
}

.report-delta.bad {
  color: var(--danger);
}

.report-period-compare,
.report-table-meta,
.report-pagination {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.report-period-compare {
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255,255,255,0.018);
}

.report-table-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(105px, auto)) auto auto;
  gap: 8px;
  align-items: end;
}

.report-table-toolbar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.reports-source-list {
  display: grid;
  gap: 8px;
}

.reports-source {
  display: grid;
  grid-template-columns: minmax(90px, 130px) minmax(0, 1fr) minmax(160px, 240px);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.022);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
}

.reports-source span,
.reports-source code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reports-table {
  display: grid;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
}

.report-data-table {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
}

.reports-table-head,
.reports-table-row {
  display: grid;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.reports-table-head {
  padding: 9px 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.035);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.report-data-table .reports-table-head,
.report-data-table .reports-table-row {
  width: max-content;
}

.reports-table-head button {
  min-width: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.reports-table-head button:hover,
.reports-table-head button:focus-visible {
  color: var(--accent);
}

.reports-table-row {
  padding: 10px 12px;
  border-top: 1px solid var(--line-soft);
}

.reports-table-row span,
.reports-table-head span,
.reports-table-head button {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-cell {
  display: grid;
  gap: 3px;
  align-content: center;
}

.report-cell b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.report-cell.numeric b {
  font-family: var(--font-mono);
}

.report-cell .report-delta {
  font-size: 12px;
}

.report-table-empty {
  padding: 18px 12px;
}

.report-pagination {
  justify-content: center;
}

.reports-history {
  display: grid;
  gap: 8px;
}

.report-history-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: rgba(255,255,255,0.022);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
}

.report-history-row span {
  color: var(--muted);
  font-size: 12px;
}

.report-history-link {
  width: max-content;
}

.pipeline-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 16px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.pipeline-layout.detail-closed {
  grid-template-columns: minmax(0, 1fr);
}

.pipeline-layout.detail-focus {
  grid-template-columns: minmax(0, 1fr);
}

.pipeline-layout.detail-focus .pipeline-main-panel {
  display: none;
}

.pipeline-layout.detail-focus .pipeline-detail-panel {
  min-height: 0;
}

.pipeline-main-panel,
.pipeline-detail-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.pipeline-main-panel {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
}

.pipeline-detail-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.pipeline-detail-panel.is-closed {
  display: none;
}

.pipeline-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pipeline-mode-switch {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(215, 168, 95, 0.16);
  border-radius: 8px;
  background: rgba(0,0,0,0.18);
}

.pipeline-mode-switch span {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: var(--text);
  border: 1px solid rgba(215, 168, 95, 0.24);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.16), rgba(215, 168, 95, 0.05));
  font-size: 12px;
  font-weight: 800;
}

.pipeline-flow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.pipeline-flow-strip span {
  min-width: 0;
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 7px 9px;
  color: var(--muted);
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(215, 168, 95, 0.075), rgba(93, 201, 194, 0.035)),
    rgba(255,255,255,0.02);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.pipeline-capture-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(215, 168, 95, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.12), transparent 42%),
    linear-gradient(135deg, rgba(93, 201, 194, 0.075), rgba(255,255,255,0.024)),
    rgba(8,8,10,0.74);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.pipeline-capture-main {
  display: grid;
  gap: 10px;
}

.pipeline-capture-form textarea {
  min-height: 106px;
  border-color: rgba(215, 168, 95, 0.22);
  background: rgba(0,0,0,0.2);
}

.pipeline-capture-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.pipeline-capture-rail span {
  min-width: 0;
  padding: 5px 7px;
  color: var(--muted);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 6px;
  background: rgba(255,255,255,0.024);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.pipeline-capture-side {
  display: grid;
  align-content: stretch;
  gap: 10px;
}

.pipeline-capture-side .primary {
  min-height: 44px;
  align-self: end;
}

.pipeline-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 240px);
  gap: 10px;
  margin-bottom: 12px;
}

.pipeline-toolbar input,
.pipeline-toolbar select {
  min-height: 38px;
  padding: 8px 10px;
}

.pipeline-stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 2px 2px 8px;
}

.pipeline-stage {
  --stage-accent: var(--accent);
  --stage-glow: rgba(215, 168, 95, 0.12);
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-top: 2px solid var(--stage-accent);
  border-radius: 8px;
  background:
    linear-gradient(180deg, var(--stage-glow), transparent 130px),
    rgba(255,255,255,0.024);
}

.pipeline-stage[data-pipeline-stage="capture"] {
  --stage-accent: #5dc9c2;
  --stage-glow: rgba(93, 201, 194, 0.11);
}

.pipeline-stage[data-pipeline-stage="gate"] {
  --stage-accent: #e0b75d;
  --stage-glow: rgba(224, 183, 93, 0.14);
}

.pipeline-stage[data-pipeline-stage="execute"] {
  --stage-accent: #d9d5ca;
  --stage-glow: rgba(217, 213, 202, 0.08);
}

.pipeline-stage[data-pipeline-stage="shipped"] {
  --stage-accent: #6fcf97;
  --stage-glow: rgba(111, 207, 151, 0.12);
}

.pipeline-stage-head {
  min-width: 0;
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.pipeline-stage-mark {
  width: 42px;
  min-height: 42px;
  display: grid;
  align-content: center;
  justify-items: center;
  border: 1px solid color-mix(in srgb, var(--stage-accent) 32%, transparent);
  border-radius: 7px;
  background: rgba(0,0,0,0.2);
}

.pipeline-stage-mark b,
.pipeline-stage-mark i {
  display: block;
  font-style: normal;
  line-height: 1.05;
}

.pipeline-stage-mark b {
  color: var(--stage-accent);
  font-family: var(--font-mono);
  font-size: 12px;
}

.pipeline-stage-mark i {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.pipeline-stage-head div {
  min-width: 0;
}

.pipeline-stage-head strong,
.pipeline-stage-head span {
  display: block;
}

.pipeline-stage-head strong {
  color: var(--text);
}

.pipeline-stage-head span {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-stage-count {
  min-width: 28px;
  min-height: 24px;
  display: grid;
  place-items: center;
  color: var(--stage-accent);
  border: 1px solid color-mix(in srgb, var(--stage-accent) 34%, transparent);
  border-radius: 999px;
  background: rgba(255,255,255,0.035);
  font-size: 12px;
}

.pipeline-stage-body {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
}

.pipeline-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.014)), #151519;
  cursor: pointer;
}

.pipeline-card[data-pipeline-stage="gate"] {
  border-color: rgba(224, 183, 93, 0.28);
}

.pipeline-card[data-pipeline-stage="execute"] {
  border-color: rgba(93, 201, 194, 0.2);
}

.pipeline-card[data-pipeline-stage="shipped"] {
  border-color: rgba(215, 168, 95, 0.34);
  background:
    linear-gradient(180deg, rgba(215, 168, 95, 0.09), rgba(255,255,255,0.016)),
    #151519;
}

.pipeline-card:hover,
.pipeline-card:focus-visible,
.pipeline-card.active {
  outline: none;
  border-color: color-mix(in srgb, var(--stage-accent) 55%, rgba(215, 168, 95, 0.18));
  background: linear-gradient(180deg, var(--stage-glow), rgba(255,255,255,0.018)), #151519;
}

.pipeline-card.active {
  box-shadow: 0 0 0 3px rgba(215, 168, 95, 0.09);
}

.pipeline-card-top,
.pipeline-card-meta,
.pipeline-chip-row,
.pipeline-card-actions,
.pipeline-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.pipeline-card-top {
  justify-content: space-between;
}

.pipeline-card-top strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pipeline-card-meta,
.pipeline-event-tail {
  color: var(--muted);
  font-size: 12px;
}

.pipeline-chip-row span {
  min-width: 0;
  max-width: 100%;
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255,255,255,0.028);
  font-size: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pipeline-chip-row .pipeline-codex-chip {
  color: #f0d09a;
  border-color: rgba(215, 168, 95, 0.42);
  background: rgba(215, 168, 95, 0.11);
}

.pipeline-chip-row .pipeline-codex-chip.routed {
  color: #94e1cd;
  border-color: rgba(93, 201, 194, 0.34);
  background: rgba(93, 201, 194, 0.095);
}

.pipeline-chip-row .pipeline-codex-chip.failed {
  color: #ffaaa8;
  border-color: rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.1);
}

.pipeline-card p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.42;
}

.pipeline-card-brief {
  display: grid;
  gap: 4px;
  padding: 8px 9px;
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 7px;
  background: rgba(0,0,0,0.16);
}

.pipeline-card-brief span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.pipeline-stage-empty {
  display: grid;
  gap: 5px;
  min-height: 94px;
  align-content: center;
  padding: 12px;
  color: var(--muted);
  border: 1px dashed rgba(215, 168, 95, 0.16);
  border-radius: 7px;
  background: rgba(0,0,0,0.12);
}

.pipeline-stage-empty strong {
  color: var(--text);
  font-size: 12px;
}

.pipeline-stage-empty span {
  font-size: 12px;
  line-height: 1.4;
}

.pipeline-status-notice {
  display: grid;
  gap: 4px;
  padding: 8px 9px;
  color: var(--text);
  border: 1px solid rgba(71, 132, 220, 0.24);
  border-radius: 7px;
  background: rgba(71, 132, 220, 0.08);
  font-size: 12px;
  line-height: 1.35;
}

.pipeline-status-notice.warning {
  border-color: rgba(215, 168, 95, 0.34);
  background: rgba(215, 168, 95, 0.09);
}

.pipeline-status-notice.failed {
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.08);
}

.pipeline-status-notice span {
  color: var(--muted);
}

.pipeline-codex-summary {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid rgba(215, 168, 95, 0.32);
  border-left: 3px solid var(--warning);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.095), rgba(255,255,255,0.018));
}

.pipeline-codex-summary.failed {
  border-color: rgba(255, 107, 107, 0.3);
  border-left-color: var(--danger);
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.08), rgba(255,255,255,0.018));
}

.pipeline-codex-summary > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pipeline-codex-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pipeline-codex-summary strong {
  color: var(--text);
  font-size: 13px;
}

.pipeline-codex-summary p {
  margin: 0;
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.pipeline-codex-summary b {
  color: var(--accent);
}

.pipeline-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: 2px;
}

.pipeline-auto-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(215, 168, 95, 0.22);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(215, 168, 95, 0.06);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.pipeline-detail {
  display: grid;
  grid-auto-rows: max-content;
  align-items: start;
  align-content: start;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 2px;
}

.pipeline-detail-block {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 12px;
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.024);
  overflow: hidden;
}

.pipeline-detail-block > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pipeline-detail-block p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.pipeline-detail-block pre {
  min-width: 0;
  max-width: 100%;
  max-height: 260px;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pipeline-layout.detail-focus .pipeline-detail {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.pipeline-layout.detail-focus .pipeline-detail-actions,
.pipeline-layout.detail-focus .pipeline-status-notice,
.pipeline-layout.detail-focus .pipeline-built-preview,
.pipeline-layout.detail-focus .pipeline-detail-block:first-of-type,
.pipeline-layout.detail-focus .pipeline-detail-block:nth-of-type(2),
.pipeline-layout.detail-focus .pipeline-detail-block:nth-of-type(3),
.pipeline-layout.detail-focus .pipeline-detail-block:has(.pipeline-artifact-preview),
.pipeline-layout.detail-focus .pipeline-detail-block:has(.activity-timeline) {
  grid-column: 1 / -1;
}

.pipeline-layout.detail-focus .pipeline-detail-block pre {
  max-height: 420px;
}

.pipeline-detail-block code {
  min-width: 0;
  max-width: 100%;
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--muted);
}

.pipeline-plan-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pipeline-plan-section {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  min-height: 96px;
  padding: 10px;
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 7px;
  background: rgba(0,0,0,0.16);
}

.pipeline-plan-section strong {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.pipeline-plan-section p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.pipeline-execute-summary {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(93, 201, 194, 0.18);
  border-radius: 7px;
  background: rgba(93, 201, 194, 0.055);
}

.pipeline-execute-summary strong {
  color: var(--text);
}

.pipeline-execute-summary span,
.pipeline-execute-summary small {
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pipeline-pattern-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(215, 168, 95, 0.18);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.1), rgba(93, 201, 194, 0.045)),
    rgba(0,0,0,0.18);
}

.pipeline-pattern-panel.fan_out_fan_in {
  border-color: rgba(93, 201, 194, 0.24);
  background:
    linear-gradient(90deg, rgba(93, 201, 194, 0.09), rgba(215, 168, 95, 0.055)),
    rgba(0,0,0,0.18);
}

.pipeline-pattern-head,
.pipeline-pattern-fanin,
.pipeline-pattern-guards {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.pipeline-pattern-head {
  justify-content: space-between;
}

.pipeline-pattern-head div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pipeline-pattern-head span,
.pipeline-pattern-fanin strong {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
}

.pipeline-pattern-head strong {
  color: var(--text);
  font-size: 14px;
}

.pipeline-pattern-head b,
.pipeline-pattern-guards span,
.pipeline-pattern-fanin span,
.pipeline-pattern-fanin small {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 7px;
  color: #d7c6a8;
  border: 1px solid rgba(215, 168, 95, 0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.035);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.pipeline-pattern-fanin small {
  color: #9bdccc;
  border-color: rgba(93, 201, 194, 0.22);
  background: rgba(93, 201, 194, 0.07);
}

.pipeline-pattern-panel p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.45;
}

.pipeline-detail-actionbar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid rgba(215, 168, 95, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(17,17,20,0.94), rgba(10,10,12,0.98)),
    var(--panel);
  box-shadow: 0 -12px 28px rgba(0,0,0,0.32);
}

.pipeline-role-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
}

.pipeline-role-item {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 74px;
  padding: 10px;
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.055), rgba(255,255,255,0.018));
}

.pipeline-role-item.system {
  border-color: rgba(215, 168, 95, 0.22);
}

.pipeline-role-item.worker {
  border-color: rgba(99, 198, 183, 0.24);
  background: linear-gradient(180deg, rgba(99, 198, 183, 0.055), rgba(255,255,255,0.018));
}

.pipeline-role-item.skipped {
  border-style: dashed;
  opacity: 0.76;
}

.pipeline-role-item strong {
  color: var(--text);
  font-size: 12px;
}

.pipeline-role-item em {
  color: var(--subtle);
  font-size: 12px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0;
}

.pipeline-role-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pipeline-child-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.pipeline-child-create input {
  min-width: 0;
  min-height: 32px;
  color: var(--text);
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px;
}

.pipeline-child-list,
.pipeline-run-list,
.pipeline-attachment-list {
  display: grid;
  gap: 8px;
}

.pipeline-graph-limits {
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

.pipeline-dag-list {
  position: relative;
}

.pipeline-dag-list::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 10px;
  width: 1px;
  background: linear-gradient(to bottom, rgba(215, 168, 95, 0.36), rgba(215, 168, 95, 0.04));
}

.pipeline-child-row,
.pipeline-run-row,
.pipeline-attachment-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 9px 10px;
  color: var(--text);
  background: rgba(0,0,0,0.16);
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 7px;
  text-align: left;
}

.pipeline-child-row {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.pipeline-child-row.root-only {
  border-color: rgba(93, 201, 194, 0.26);
  background: rgba(93, 201, 194, 0.055);
}

.pipeline-dag-node {
  padding-left: 26px;
}

.pipeline-dag-node::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 6px;
  width: 9px;
  height: 9px;
  background: var(--panel);
  border: 1px solid rgba(215, 168, 95, 0.7);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(215, 168, 95, 0.08);
}

.pipeline-dag-node.ready::before {
  background: var(--accent);
}

.pipeline-dag-node.doing::before {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.pipeline-dag-node.done::before {
  background: var(--success);
  border-color: var(--success);
}

.pipeline-dag-node.blocked::before {
  background: var(--danger);
  border-color: var(--danger);
}

.pipeline-child-open {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.pipeline-child-open:hover,
.pipeline-child-open:focus-visible {
  outline: none;
  color: var(--accent);
}

.pipeline-child-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
}

.pipeline-detail-panel .pipeline-child-row {
  grid-template-columns: minmax(0, 1fr);
}

.pipeline-detail-panel .pipeline-child-actions {
  justify-content: flex-start;
}

.pipeline-child-open span,
.pipeline-child-open small,
.pipeline-run-row span,
.pipeline-attachment-row span {
  color: var(--muted);
  font-size: 12px;
}

.pipeline-child-open small {
  font-family: var(--mono);
  font-size: 12px;
}

.pipeline-run-row .failed,
.pipeline-chip-row .failed {
  color: var(--danger);
}

.pipeline-run-fallback {
  display: grid;
  gap: 3px;
  padding: 7px 8px;
  border: 1px solid rgba(215, 168, 95, 0.22);
  border-radius: 7px;
  background: rgba(215, 168, 95, 0.07);
}

.pipeline-run-fallback span {
  color: #f0d09a;
  font-family: var(--font-mono);
  font-size: 12px;
}

.pipeline-run-fallback p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.pipeline-run-row.failed {
  border-color: rgba(255, 107, 107, 0.28);
}

.pipeline-run-row.running {
  border-color: rgba(71, 132, 220, 0.3);
}

.pipeline-execution-steps {
  display: grid;
  gap: 8px;
}

.pipeline-execution-step {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid rgba(215, 168, 95, 0.13);
  border-radius: 7px;
  background: rgba(0,0,0,0.18);
}

.pipeline-execution-step > span {
  width: 12px;
  height: 12px;
  margin-top: 2px;
  border: 1px solid rgba(215, 168, 95, 0.42);
  border-radius: 50%;
  background: rgba(255,255,255,0.035);
  box-shadow: 0 0 0 3px rgba(215, 168, 95, 0.045);
}

.pipeline-execution-step strong,
.pipeline-gate-brief strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.pipeline-execution-step small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.35;
}

.pipeline-execution-step.done {
  border-color: rgba(111, 207, 151, 0.2);
}

.pipeline-execution-step.done > span {
  border-color: rgba(111, 207, 151, 0.45);
  background: var(--success);
}

.pipeline-execution-step.done strong {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.pipeline-execution-step.running,
.pipeline-execution-step.active {
  border-color: rgba(215, 168, 95, 0.45);
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.11), rgba(93, 201, 194, 0.045)),
    rgba(0,0,0,0.2);
}

.pipeline-execution-step.running > span,
.pipeline-execution-step.active > span {
  border-color: rgba(215, 168, 95, 0.78);
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(215, 168, 95, 0.12);
}

.pipeline-execution-step.blocked {
  border-color: rgba(224, 93, 93, 0.36);
}

.pipeline-execution-step.blocked > span {
  border-color: rgba(224, 93, 93, 0.72);
  background: var(--danger);
}

.pipeline-live-log {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(215, 168, 95, 0.16);
  border-radius: 7px;
  background: rgba(0,0,0,0.26);
}

.pipeline-live-log-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.pipeline-live-log-head strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.pipeline-live-log-head span {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
}

.pipeline-live-log p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.pipeline-live-log pre {
  min-width: 0;
  max-width: 100%;
  max-height: 230px;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  color: #d7d2c7;
  background: rgba(0,0,0,0.34);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 9px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pipeline-changes-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(215, 168, 95, 0.18);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.08), rgba(111, 207, 151, 0.035)),
    rgba(0,0,0,0.18);
}

.pipeline-changes-summary span {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pipeline-changes-summary strong {
  color: var(--text);
  font-size: 13px;
}

.pipeline-change-counts {
  display: inline-flex;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.pipeline-change-counts .plus {
  color: var(--success);
}

.pipeline-change-counts .minus {
  color: var(--danger);
}

.pipeline-changes-summary ul {
  grid-column: 1 / -1;
  margin: 0;
  padding-left: 17px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.pipeline-gate-brief {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid rgba(215, 168, 95, 0.24);
  border-radius: 7px;
  background:
    linear-gradient(120deg, rgba(215, 168, 95, 0.11), rgba(93, 201, 194, 0.035)),
    rgba(0,0,0,0.2);
}

.pipeline-gate-brief span,
.pipeline-gate-plan .pipeline-plan-section strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pipeline-gate-brief p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
}

.pipeline-gate-plan .pipeline-plan-stack {
  gap: 10px;
}

.pipeline-gate-plan .pipeline-plan-section {
  background: rgba(0,0,0,0.2);
}

.pipeline-native-mirror {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(215, 168, 95, 0.18);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(215, 168, 95, 0.06), rgba(93, 201, 194, 0.025)),
    rgba(0,0,0,0.18);
}

.pipeline-native-head,
.pipeline-native-task-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.pipeline-native-head > div:first-child,
.pipeline-native-task-top > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pipeline-native-head strong,
.pipeline-native-task-top strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.pipeline-native-head span,
.pipeline-native-task-top span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pipeline-native-list {
  display: grid;
  gap: 8px;
}

.pipeline-native-task {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(215, 168, 95, 0.13);
  border-radius: 7px;
  background: rgba(0,0,0,0.18);
}

.pipeline-native-task.root {
  border-color: rgba(93, 201, 194, 0.24);
  background:
    linear-gradient(90deg, rgba(93, 201, 194, 0.065), rgba(215, 168, 95, 0.035)),
    rgba(0,0,0,0.18);
}

.pipeline-native-task.done {
  border-color: rgba(111, 207, 151, 0.22);
}

.pipeline-native-task.running {
  border-color: rgba(93, 201, 194, 0.28);
}

.pipeline-native-task.failed {
  border-color: rgba(224, 93, 93, 0.32);
}

.pipeline-native-task p,
.pipeline-native-errors p,
.pipeline-native-run p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.pipeline-native-subgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.pipeline-native-subgrid > div,
.pipeline-native-run,
.pipeline-native-errors {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 7px;
  background: rgba(0,0,0,0.16);
}

.pipeline-native-subgrid > div > span,
.pipeline-native-errors strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
}

.pipeline-native-subgrid code {
  min-width: 0;
  max-width: 100%;
  color: #d8c49f;
  font-size: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pipeline-native-log {
  grid-column: 1 / -1;
  min-width: 0;
}

.pipeline-native-log pre {
  min-width: 0;
  max-width: 100%;
  max-height: 180px;
  margin: 0;
  color: #cfc2a9;
  white-space: pre-wrap;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pipeline-native-run strong {
  color: var(--text);
  font-size: 12px;
}

.pipeline-native-run.failed strong,
.pipeline-native-errors strong {
  color: var(--danger);
}

.pipeline-review-loop {
  display: grid;
  gap: 5px;
  margin: 6px 0;
}

.pipeline-review-loop code {
  display: block;
  padding: 6px 8px;
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 6px;
  background: rgba(0,0,0,0.16);
  color: #d8c49f;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.pipeline-artifact-preview {
  min-height: 220px;
  max-height: 360px;
}

.pipeline-artifact-preview iframe {
  width: 100%;
  height: 320px;
  border: 0;
  background: #fff;
  border-radius: 6px;
}

.pipeline-built-preview {
  display: block;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(215, 168, 95, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(215, 168, 95, 0.075), rgba(0,0,0,0.16)),
    rgba(0,0,0,0.24);
  box-shadow: 0 0 0 1px rgba(215, 168, 95, 0.05) inset;
}

.pipeline-built-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 11px;
  border-bottom: 1px solid rgba(215, 168, 95, 0.17);
}

.pipeline-built-preview-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pipeline-built-preview-head span {
  color: #9fcf68;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.pipeline-built-preview-head strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-preview-open {
  min-width: 42px;
  justify-content: center;
  padding-inline: 8px;
}

.pipeline-built-frame {
  height: min(720px, 62vh);
  min-height: 520px;
  max-height: none;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
}

.pipeline-built-frame iframe {
  min-height: 520px;
  height: 100%;
  border-radius: 0;
}

.pipeline-built-frame.build-preview {
  background: #111;
}

.executor-debug-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 520px);
  gap: 16px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.executor-debug-main-panel,
.executor-debug-detail-panel {
  min-height: 0;
  overflow: hidden;
}

.executor-debug-main-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.executor-debug-detail-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.executor-debug-detail-panel.is-closed {
  display: none;
}

.executor-debug-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.executor-debug-actions select {
  min-width: 160px;
  min-height: 34px;
}

.executor-debug-warning {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(215, 168, 95, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.12), transparent 54%),
    rgba(0,0,0,0.18);
}

.executor-debug-warning strong {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.executor-debug-warning span {
  color: var(--muted);
  line-height: 1.4;
}

.executor-debug-errors {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.executor-debug-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 2px 2px 8px;
}

.executor-debug-task {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-left: 3px solid rgba(215, 168, 95, 0.36);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.034), rgba(255,255,255,0.014)), #151519;
  cursor: pointer;
}

.executor-debug-task:hover,
.executor-debug-task:focus-visible,
.executor-debug-task.active {
  outline: none;
  border-color: rgba(215, 168, 95, 0.48);
  border-left-color: var(--accent);
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.08), rgba(255,255,255,0.016)), #151519;
}

.executor-debug-task.active {
  box-shadow: 0 0 0 3px rgba(215, 168, 95, 0.09);
}

.executor-debug-task-top,
.executor-debug-task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.executor-debug-task-top {
  justify-content: space-between;
}

.executor-debug-task-top strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.executor-debug-task-meta {
  color: var(--muted);
  font-size: 12px;
}

.executor-debug-task p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.42;
}

.executor-debug-detail {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.executor-debug-log pre {
  max-height: 430px;
}

.executor-debug-identity code,
.executor-debug-detail code {
  overflow-wrap: anywhere;
}

.gallery-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
  gap: 16px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.gallery-main-panel,
.gallery-detail-panel {
  min-height: 0;
  overflow: hidden;
}

.gallery-main-panel,
.gallery-detail-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.gallery-detail-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.gallery-detail-panel.is-closed {
  display: none;
}

.gallery-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 210px) minmax(130px, 170px) minmax(130px, 170px);
  gap: 10px;
  margin-bottom: 12px;
}

.gallery-toolbar input,
.gallery-toolbar select {
  min-height: 38px;
  padding: 8px 10px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 2px 2px 8px;
}

.gallery-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: 220px minmax(204px, 1fr);
  overflow: hidden;
  border: 1px solid rgba(215, 168, 95, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.014)),
    linear-gradient(135deg, rgba(215, 168, 95, 0.045), rgba(93, 201, 194, 0.018)),
    #151519;
  cursor: pointer;
  min-height: 430px;
}

.gallery-remove-build {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 130, 102, 0.34);
  border-radius: 999px;
  color: #ffccb9;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  background: rgba(18, 10, 10, 0.82);
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.gallery-remove-build:hover,
.gallery-remove-build:focus-visible {
  outline: none;
  border-color: rgba(255, 174, 128, 0.8);
  color: #fff0dc;
  background: rgba(94, 27, 20, 0.92);
}

.gallery-card:hover,
.gallery-card:focus-visible,
.gallery-card.active {
  outline: none;
  border-color: rgba(215, 168, 95, 0.48);
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.08), rgba(255,255,255,0.016)), #151519;
}

.gallery-card.active {
  box-shadow: 0 0 0 3px rgba(215, 168, 95, 0.09);
}

.gallery-card-preview,
.gallery-live-preview {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: stretch;
  overflow: hidden;
  background: #0d0d10;
  border-bottom: 1px solid rgba(215, 168, 95, 0.12);
}

.gallery-card-preview img,
.gallery-card-preview video,
.gallery-card-preview iframe,
.gallery-live-preview img,
.gallery-live-preview video,
.gallery-live-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  background: #fff;
}

.gallery-card-preview iframe {
  pointer-events: none;
  transform: scale(0.84);
  transform-origin: top left;
  width: 119.05%;
  height: 119.05%;
}

.gallery-card-preview pre,
.gallery-live-preview pre {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  padding: 12px;
  color: var(--text);
  background: rgba(0,0,0,0.25);
  white-space: pre-wrap;
}

.gallery-preview-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100%;
  padding: 14px;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(215, 168, 95, 0.08), rgba(93, 201, 194, 0.05)),
    rgba(255,255,255,0.018);
}

.gallery-preview-empty strong {
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: 0;
}

.gallery-preview-empty span {
  max-width: 34ch;
  font-size: 12px;
  line-height: 1.45;
}

.gallery-preview-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid rgba(215, 168, 95, 0.26);
  border-radius: 999px;
  color: #f0d09a;
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(10, 10, 12, 0.78);
  backdrop-filter: blur(8px);
}

.gallery-preview-empty audio {
  width: min(100%, 320px);
}

.gallery-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 12px;
}

.gallery-card-top,
.gallery-card-actions,
.gallery-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gallery-card-top {
  justify-content: space-between;
  align-items: flex-start;
}

.gallery-card-top strong {
  min-width: 0;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.gallery-card-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
}

.gallery-card-kicker span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card p {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.gallery-card-actions {
  margin-top: auto;
  align-self: stretch;
  padding-top: 2px;
}

.gallery-card-actions .mini {
  min-height: 28px;
  padding: 6px 8px;
}

.gallery-detail-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 12px 48px 12px 12px;
  border: 1px solid rgba(215, 168, 95, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(215, 168, 95, 0.065), rgba(255,255,255,0.016)),
    rgba(0,0,0,0.16);
}

.gallery-remove-build-detail {
  top: 12px;
  right: 12px;
}

.gallery-detail-hero h3 {
  margin: 4px 0 9px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.18;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.gallery-detail-kicker {
  color: #f0d09a;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
}

.gallery-project-log-block {
  border-color: rgba(215, 168, 95, 0.2);
  background:
    linear-gradient(180deg, rgba(215, 168, 95, 0.055), rgba(255,255,255,0.018)),
    rgba(0,0,0,0.14);
}

.gallery-project-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.gallery-project-log-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.gallery-project-log-block small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.gallery-project-log {
  max-height: min(520px, 62vh);
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 7px;
  background: rgba(0,0,0,0.2);
}

.gallery-project-log h2,
.gallery-project-log h3,
.gallery-project-log h4,
.gallery-project-log h5 {
  margin: 12px 0 6px;
  color: var(--accent);
  font-family: var(--font-display);
  letter-spacing: 0;
}

.gallery-project-log h2:first-child,
.gallery-project-log h3:first-child {
  margin-top: 0;
}

.gallery-project-log p,
.gallery-project-log li,
.gallery-project-log blockquote {
  color: var(--text);
  font-size: 12px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.gallery-project-log ul {
  display: grid;
  gap: 4px;
  margin: 0 0 6px 16px;
  padding: 0;
}

.gallery-project-log code {
  color: #f0d09a;
  font-family: var(--font-mono);
  font-size: 12px;
}

.gallery-project-log pre {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
}

.gallery-detail {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.gallery-detail .pipeline-detail-block {
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(215, 168, 95, 0.045), rgba(255,255,255,0.018)),
    rgba(0,0,0,0.12);
}

.gallery-detail .pipeline-detail-block > span {
  display: block;
  margin-bottom: 2px;
}

.gallery-detail .pipeline-detail-block pre {
  max-height: 360px;
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.gallery-detail .pipeline-chip-row {
  align-items: flex-start;
}

.gallery-live-preview {
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(215, 168, 95, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(215, 168, 95, 0.055), rgba(93, 201, 194, 0.035)),
    #0d0d10;
}

.gallery-live-preview iframe {
  min-height: 640px;
}

.gallery-preview-open {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  color: #f4ead6;
  background: rgba(8, 8, 10, 0.72);
  border-color: rgba(244, 214, 160, 0.34);
  box-shadow: 0 12px 28px rgba(0,0,0,0.32);
  backdrop-filter: blur(10px);
}

.gallery-preview-open:hover,
.gallery-preview-open:focus-visible {
  color: #fff7e6;
  background: rgba(30, 25, 17, 0.9);
  border-color: rgba(244, 214, 160, 0.72);
  transform: translateY(-1px);
}

.gallery-source-block p {
  margin-bottom: 0;
  line-height: 1.48;
}

.gallery-file-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

html[data-theme="light"] .gallery-card,
html[data-theme="light"] .gallery-preview-empty {
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(244, 240, 232, 0.68)), #ffffff;
  border-color: rgba(164, 135, 86, 0.22);
}

html[data-theme="light"] .gallery-live-preview {
  color: #f5e8cf;
  background:
    linear-gradient(135deg, rgba(215, 168, 95, 0.08), rgba(93, 201, 194, 0.04)),
    #0d0d10;
  border-color: rgba(88, 72, 42, 0.34);
}

html[data-theme="light"] .gallery-live-preview pre {
  color: #f5e8cf;
  background: rgba(9, 9, 12, 0.92);
}

html[data-theme="light"] .gallery-live-preview .gallery-preview-empty {
  color: #d8c49f;
  background:
    linear-gradient(135deg, rgba(215, 168, 95, 0.08), rgba(93, 201, 194, 0.04)),
    #0d0d10;
}

html[data-theme="light"] .gallery-live-preview .gallery-preview-empty strong {
  color: #fff3d7;
}

html[data-theme="light"] .gallery-preview-open {
  color: #fff4dc;
  background: rgba(18, 16, 13, 0.74);
  border-color: rgba(255, 235, 191, 0.38);
}

html[data-theme="light"] .gallery-preview-open:hover,
html[data-theme="light"] .gallery-preview-open:focus-visible {
  color: #ffffff;
  background: rgba(34, 28, 18, 0.92);
  border-color: rgba(255, 235, 191, 0.74);
}

html[data-theme="light"] .executor-debug-warning {
  background:
    linear-gradient(90deg, rgba(173, 118, 31, 0.11), rgba(255,255,255,0.78) 56%),
    #ffffff;
  border-color: rgba(164, 135, 86, 0.26);
}

html[data-theme="light"] .executor-debug-task {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(244, 247, 250, 0.82)), #ffffff;
  border-color: rgba(120, 128, 140, 0.24);
  border-left-color: rgba(173, 118, 31, 0.42);
}

html[data-theme="light"] .executor-debug-task:hover,
html[data-theme="light"] .executor-debug-task:focus-visible,
html[data-theme="light"] .executor-debug-task.active {
  background: linear-gradient(180deg, rgba(173, 118, 31, 0.11), rgba(255,255,255,0.88)), #ffffff;
  border-color: rgba(173, 118, 31, 0.36);
  border-left-color: var(--accent);
}

html[data-theme="light"] .executor-debug-task p,
html[data-theme="light"] .executor-debug-detail code,
html[data-theme="light"] .executor-debug-identity code {
  color: var(--text);
}

html[data-theme="light"] .executor-debug-log pre {
  background: #f4f6f8;
  color: #20242a;
  border-color: rgba(120, 128, 140, 0.3);
}

html[data-theme="light"] .gallery-project-log-block,
html[data-theme="light"] .gallery-project-log,
html[data-theme="light"] .gallery-detail .pipeline-detail-block {
  background: linear-gradient(180deg, rgba(173, 118, 31, 0.075), rgba(255,255,255,0.76)), #ffffff;
  border-color: rgba(164, 135, 86, 0.24);
}

html[data-theme="light"] .gallery-project-log code {
  color: #6f4708;
}

html[data-theme="light"] .pipeline-capture-form,
html[data-theme="light"] .pipeline-stage,
html[data-theme="light"] .pipeline-detail-block,
html[data-theme="light"] .pipeline-native-mirror,
html[data-theme="light"] .pipeline-native-task,
html[data-theme="light"] .pipeline-native-subgrid > div,
html[data-theme="light"] .pipeline-native-run,
html[data-theme="light"] .pipeline-native-errors {
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.08), rgba(255,255,255,0.74)), #ffffff;
  border-color: rgba(164, 135, 86, 0.24);
}

html[data-theme="light"] .pipeline-card {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(244, 240, 232, 0.68)), #ffffff;
  border-color: rgba(164, 135, 86, 0.22);
}

html[data-theme="light"] .pipeline-card:hover,
html[data-theme="light"] .pipeline-card:focus-visible,
html[data-theme="light"] .pipeline-card.active {
  background: linear-gradient(180deg, rgba(215, 168, 95, 0.12), rgba(255,255,255,0.82)), #ffffff;
}

html[data-theme="light"] .pipeline-chip-row span {
  background: rgba(255,255,255,0.72);
}

html[data-theme="light"] .pipeline-detail-actions .icon-action,
html[data-theme="light"] .gallery-detail-actions .icon-action,
html[data-theme="light"] .logs-actions .icon-action,
html[data-theme="light"] .executor-debug-actions .icon-action {
  color: var(--text);
}

.empty {
  color: var(--muted);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(440px, calc(100vw - 32px));
}

.login-panel {
  padding: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel .brand-mark {
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
}

.login-panel h1 {
  margin: 10px 0 12px;
  font-size: 44px;
}

.login-copy {
  color: var(--muted);
  margin-bottom: 22px;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 1700px) {
  .doctor-overview {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .service-action-table .table-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    min-width: 0;
    padding: 12px;
    background: rgba(255,255,255,0.022);
    border: 1px solid var(--line-soft);
    border-radius: 7px;
  }

  .service-action-table .table-row > * {
    min-width: 0;
  }

  .service-action-table .mini {
    width: max-content;
  }
}

@media (max-width: 1100px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    overflow-x: hidden;
  }

  .shell {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 100vh;
    padding: 24px;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .topbar,
  body.compact-header-view .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .chrome-switches {
    flex-wrap: wrap;
  }

  .grid.two,
  .chat-layout,
  .missions-layout,
  .kanban-layout,
  .pipeline-layout,
  .executor-debug-layout,
  .gallery-layout,
  .night-layout,
  .doctor-layout,
  .control-room-layout,
  .activity-panel-layout,
  .workspace-layout,
  .knowledge-layout,
  .metrics,
  .reports-layout {
    grid-template-columns: 1fr;
  }

  .reports-control-panel,
  .reports-history-panel {
    position: static;
  }

  .report-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-insight-grid,
  .report-problem-row {
    grid-template-columns: 1fr 1fr;
  }

  .report-table-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .report-table-toolbar > input:first-child {
    grid-column: 1 / -1;
  }

  .reports-source {
    grid-template-columns: 1fr;
  }

  .reports-table {
    overflow-x: auto;
  }

  .reports-table-head,
  .reports-table-row {
    min-width: 760px;
  }

  .report-period-compare,
  .report-table-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .kanban-board {
    grid-template-columns: 1fr;
  }

  .pipeline-stages,
  .pipeline-capture-form,
  .pipeline-flow-strip,
  .pipeline-toolbar,
  .pipeline-capture-rail,
  .pipeline-plan-stack,
  .gallery-toolbar {
    grid-template-columns: 1fr;
  }

  .pipeline-layout {
    height: auto;
    overflow: visible;
  }

  .pipeline-main-panel,
  .pipeline-detail-panel,
  .executor-debug-main-panel,
  .executor-debug-detail-panel,
  .gallery-main-panel,
  .gallery-detail-panel {
    overflow: visible;
  }

  .pipeline-main-panel {
    grid-template-rows: auto;
  }

  .pipeline-stage-body,
  .pipeline-detail,
  .executor-debug-list,
  .executor-debug-detail {
    overflow: visible;
  }

  .pipeline-layout.detail-focus .pipeline-detail {
    grid-template-columns: 1fr;
  }

  .pipeline-stage {
    min-height: 220px;
  }

  .pipeline-stage-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .gallery-layout {
    height: auto;
    overflow: visible;
  }

  .gallery-live-preview {
    min-height: 320px;
    max-height: none;
  }

  .kanban-quick-form,
  .kanban-toolbar-actions {
    grid-template-columns: 1fr;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  body {
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
  }

  html {
    overflow-x: hidden;
  }

  .chat-layout,
  .chat-main {
    height: auto;
  }

  .night-layout.summary-collapsed,
  .doctor-layout.summary-collapsed,
  .kanban-layout.create-collapsed {
    grid-template-columns: 1fr;
  }

  .kanban-layout.create-collapsed .kanban-create-panel .panel-head {
    display: flex;
    justify-items: stretch;
    padding: 0;
  }

  .kanban-layout.create-collapsed #kanbanCreateTitle {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .kanban-layout.create-collapsed .kanban-create-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .doctor-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body .mode-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  body .mode-tab {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    justify-content: center;
    white-space: normal;
  }

  .report-insight-head {
    align-items: stretch;
    flex-direction: column;
  }

  .report-insight-grid,
  .report-problem-row,
  .report-kpi-grid {
    grid-template-columns: 1fr;
  }

  .doctor-overview {
    grid-template-columns: 1fr;
  }
}

/* Multi-Agent Pipeline visual polish: keep the board dense, remove duplicated box rails. */
body[data-view="pipeline"] .pipeline-main-panel {
  position: relative;
  isolation: isolate;
  border-color: rgba(215, 168, 95, 0.18);
  background:
    radial-gradient(circle at 18% 8%, rgba(215, 168, 95, 0.13), transparent 28rem),
    radial-gradient(circle at 75% 18%, rgba(93, 201, 194, 0.08), transparent 30rem),
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012)),
    #111114;
}

body[data-view="pipeline"] .pipeline-main-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.52;
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.07) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.032) 0 1px, transparent 1px 18px);
  mask-image: linear-gradient(180deg, black, transparent 76%);
}

body[data-view="pipeline"] .pipeline-main-panel .panel-head {
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(215, 168, 95, 0.12);
}

body[data-view="pipeline"] .pipeline-main-panel .panel-head h2 {
  margin-bottom: 3px;
}

body[data-view="pipeline"] .pipeline-mode-switch {
  border-color: rgba(215, 168, 95, 0.22);
  background: rgba(0,0,0,0.3);
}

body[data-view="pipeline"] .pipeline-flow-strip {
  display: none;
}

body[data-view="pipeline"] .pipeline-flow-strip::before {
  content: none;
}

body[data-view="pipeline"] .pipeline-flow-strip span {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: rgba(243, 240, 232, 0.78);
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

body[data-view="pipeline"] .pipeline-flow-strip span::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border: 1px solid rgba(215, 168, 95, 0.58);
  border-radius: 50%;
  background: #111114;
  box-shadow: 0 0 0 4px rgba(215, 168, 95, 0.055);
}

body[data-view="pipeline"] .pipeline-capture-form {
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-color: rgba(215, 168, 95, 0.22);
  border-left: 3px solid rgba(215, 168, 95, 0.78);
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.12), transparent 32%),
    linear-gradient(135deg, rgba(93, 201, 194, 0.06), rgba(255,255,255,0.018)),
    rgba(5,5,7,0.58);
}

body[data-view="pipeline"] .pipeline-capture-main {
  gap: 8px;
}

body[data-view="pipeline"] .pipeline-capture-form label > span {
  color: #d7c6a8;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

body[data-view="pipeline"] .pipeline-capture-form textarea {
  height: 64px;
  min-height: 62px;
  resize: vertical;
  background: rgba(0,0,0,0.34);
}

body[data-view="pipeline"] .pipeline-capture-rail {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  overflow: hidden;
}

body[data-view="pipeline"] .pipeline-capture-rail span {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  padding: 0 14px 0 0;
  color: rgba(145, 139, 128, 0.9);
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

body[data-view="pipeline"] .pipeline-capture-rail span:not(:last-child)::after {
  content: "/";
  position: absolute;
  right: 5px;
  color: rgba(215, 168, 95, 0.5);
}

body[data-view="pipeline"] .pipeline-capture-side {
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 9px;
}

body[data-view="pipeline"] .pipeline-capture-side .primary {
  min-height: 38px;
  box-shadow: 0 10px 24px rgba(215, 168, 95, 0.16);
}

body[data-view="pipeline"] .pipeline-toolbar {
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 210px);
  margin-bottom: 8px;
}

body[data-view="pipeline"] .pipeline-stages {
  gap: 10px;
  padding: 0 0 6px;
}

body[data-view="pipeline"] .pipeline-stage {
  border-color: rgba(215, 168, 95, 0.1);
  border-top: 0;
  background:
    linear-gradient(180deg, var(--stage-glow), transparent 150px),
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01)),
    rgba(9,9,11,0.62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025);
}

body[data-view="pipeline"] .pipeline-stage-head {
  min-height: 56px;
  padding: 9px 10px;
  border-bottom-color: rgba(255,255,255,0.055);
}

body[data-view="pipeline"] .pipeline-stage-mark {
  width: 34px;
  min-height: 34px;
  background: rgba(0,0,0,0.26);
}

body[data-view="pipeline"] .pipeline-stage-body {
  gap: 8px;
  padding: 10px;
}

body[data-view="pipeline"] .pipeline-card {
  position: relative;
  gap: 7px;
  padding: 11px;
  border-color: color-mix(in srgb, var(--stage-accent) 22%, rgba(255,255,255,0.08));
  border-left: 3px solid color-mix(in srgb, var(--stage-accent) 70%, rgba(255,255,255,0.12));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--stage-accent) 9%, transparent), rgba(255,255,255,0.012) 42%),
    #131316;
}

body[data-view="pipeline"] .pipeline-card[data-pipeline-state="executing"],
body[data-view="pipeline"] .pipeline-card[data-pipeline-state="reviewing"] {
  background:
    linear-gradient(90deg, rgba(93, 201, 194, 0.105), transparent 58%),
    #131316;
}

body[data-view="pipeline"] .pipeline-card[data-pipeline-state="ready_to_ship"],
body[data-view="pipeline"] .pipeline-card[data-pipeline-state="shipped"] {
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.14), rgba(111, 207, 151, 0.052)),
    #131316;
}

body[data-view="pipeline"] .pipeline-card-top strong {
  font-size: 13px;
  line-height: 1.25;
}

body[data-view="pipeline"] .pipeline-chip-row span {
  min-height: 21px;
  padding: 2px 6px;
  background: rgba(0,0,0,0.18);
}

body[data-view="pipeline"] .pipeline-card-brief {
  border-color: rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.2);
}

body[data-view="pipeline"] .pipeline-card-actions .mini {
  min-height: 26px;
  padding: 5px 8px;
}

body[data-view="pipeline"] .pipeline-stage-empty {
  min-height: 76px;
  border-color: rgba(215, 168, 95, 0.1);
  background: rgba(0,0,0,0.14);
}

body[data-view="pipeline"] .pipeline-detail-panel {
  border-color: rgba(215, 168, 95, 0.18);
  background:
    linear-gradient(180deg, rgba(215, 168, 95, 0.055), rgba(255,255,255,0.012)),
    #111114;
}

body[data-view="pipeline"] .pipeline-detail-block {
  border-color: rgba(215, 168, 95, 0.13);
  background: rgba(0,0,0,0.17);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-main-panel {
  border-color: rgba(164, 135, 86, 0.26);
  background:
    radial-gradient(circle at 18% 8%, rgba(215, 168, 95, 0.16), transparent 28rem),
    radial-gradient(circle at 75% 18%, rgba(93, 201, 194, 0.08), transparent 30rem),
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(248, 245, 239, 0.82)),
    #f8f5ef;
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-main-panel::before {
  opacity: 0.42;
  background:
    linear-gradient(90deg, rgba(164, 135, 86, 0.11) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(135deg, rgba(34, 38, 45, 0.035) 0 1px, transparent 1px 18px);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-main-panel .panel-head {
  border-bottom-color: rgba(164, 135, 86, 0.22);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-mode-switch {
  border-color: rgba(164, 135, 86, 0.26);
  background: rgba(255,255,255,0.74);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-capture-form {
  border-color: rgba(164, 135, 86, 0.3);
  border-left-color: rgba(184, 123, 22, 0.82);
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.18), transparent 36%),
    linear-gradient(135deg, rgba(93, 201, 194, 0.08), rgba(255,255,255,0.66)),
    #fffdf8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.74);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-capture-form label > span {
  color: #805812;
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-capture-form textarea {
  color: #20242a;
  background: rgba(255,255,255,0.88);
  border-color: rgba(164, 135, 86, 0.26);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-capture-rail span {
  color: #68625a;
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-capture-rail span:not(:last-child)::after {
  color: rgba(128, 88, 18, 0.54);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-stage {
  border-color: rgba(164, 135, 86, 0.2);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--stage-accent) 13%, transparent), transparent 150px),
    linear-gradient(180deg, rgba(255,255,255,0.9), rgba(247, 244, 237, 0.78)),
    #ffffff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-stage-head {
  border-bottom-color: rgba(164, 135, 86, 0.18);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-stage-mark {
  background: rgba(255,255,255,0.76);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-card {
  color: #20242a;
  border-color: color-mix(in srgb, var(--stage-accent) 30%, rgba(164, 135, 86, 0.2));
  border-left-color: color-mix(in srgb, var(--stage-accent) 72%, rgba(164, 135, 86, 0.3));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--stage-accent) 10%, transparent), rgba(255,255,255,0.74) 44%),
    #fffefa;
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-card[data-pipeline-state="executing"],
html[data-theme="light"] body[data-view="pipeline"] .pipeline-card[data-pipeline-state="reviewing"] {
  background:
    linear-gradient(90deg, rgba(93, 201, 194, 0.13), transparent 60%),
    #fffefa;
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-card[data-pipeline-state="ready_to_ship"],
html[data-theme="light"] body[data-view="pipeline"] .pipeline-card[data-pipeline-state="shipped"] {
  background:
    linear-gradient(90deg, rgba(215, 168, 95, 0.15), rgba(111, 207, 151, 0.09)),
    #fffefa;
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-card-top strong,
html[data-theme="light"] body[data-view="pipeline"] .pipeline-stage-head strong {
  color: #20242a;
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-card-meta,
html[data-theme="light"] body[data-view="pipeline"] .pipeline-event-tail,
html[data-theme="light"] body[data-view="pipeline"] .pipeline-stage-head span,
html[data-theme="light"] body[data-view="pipeline"] .pipeline-card p {
  color: #5f6670;
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-chip-row span {
  color: #4d5560;
  background: rgba(255,255,255,0.82);
  border-color: rgba(112, 121, 134, 0.34);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-card-brief,
html[data-theme="light"] body[data-view="pipeline"] .pipeline-stage-empty,
html[data-theme="light"] body[data-view="pipeline"] .pipeline-codex-summary {
  color: #4d5560;
  border-color: rgba(164, 135, 86, 0.18);
  background: rgba(255,255,255,0.64);
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-detail-panel {
  border-color: rgba(164, 135, 86, 0.26);
  background:
    linear-gradient(180deg, rgba(215, 168, 95, 0.08), rgba(255,255,255,0.72)),
    #faf7f0;
}

html[data-theme="light"] body[data-view="pipeline"] .pipeline-detail-block {
  border-color: rgba(164, 135, 86, 0.22);
  background: rgba(255,255,255,0.72);
}

@media (max-width: 1100px) {
  body[data-view="pipeline"] .pipeline-flow-strip {
    grid-template-columns: repeat(4, minmax(70px, 1fr));
    overflow: hidden;
  }

  body[data-view="pipeline"] .pipeline-capture-form,
  body[data-view="pipeline"] .pipeline-toolbar {
    grid-template-columns: 1fr;
  }

  body[data-view="pipeline"] .pipeline-capture-rail {
    flex-wrap: wrap;
    row-gap: 5px;
  }

  body[data-view="pipeline"] .pipeline-stages {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body[data-view="pipeline"] .pipeline-flow-strip {
    display: none;
  }

  body[data-view="pipeline"] .pipeline-capture-form textarea {
    min-height: 104px;
  }

  body[data-view="pipeline"] .pipeline-capture-rail {
    display: none;
  }
}
