/* hub.momaten.ru — Пульт проектов (v1, mode: Operate)
 * Строго по DESIGN_SPEC.md: без внешних CDN, системная кириллица,
 * GPU-анимации (transform / opacity), zero horizontal overflow на 390x844.
 */

:root {
  color-scheme: dark;

  /* Поверхности (без градиентов и glassmorphism) */
  --bg-canvas: #0B0D11;
  --bg-surface: #12151C;
  --bg-surface-elevated: #171B24;
  --bg-surface-hover: #1B202B;
  --bg-track: #202634;
  --bg-overlay: rgba(6, 8, 12, 0.72);

  /* Границы */
  --border-subtle: #1E2430;
  --border-default: #2A3242;
  --border-strong: #3B465C;

  /* Типографика и контраст (WCAG AA >= 4.5:1 на #12151C) */
  --text-primary: #F2F5FA;
  --text-secondary: #A4B0C2;
  --text-muted: #7F8BA1;
  --text-on-light: #0B0D11;

  /* Первичный интерактив и фокус */
  --cta-bg: #EDF2FA;
  --cta-bg-hover: #FFFFFF;
  --cta-text: #0B0D11;
  --focus-ring: #60A5FA;

  /* Семантика статусов (строго по функции) */
  --amber: #F59E0B;
  --amber-text: #FCD34D;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.30);

  --blue: #4C8DFF;
  --blue-text: #8BB8FF;
  --blue-bg: rgba(76, 141, 255, 0.12);
  --blue-border: rgba(76, 141, 255, 0.28);

  --violet: #A78BFA;
  --violet-text: #C4B5FD;
  --violet-bg: rgba(139, 92, 246, 0.12);
  --violet-border: rgba(139, 92, 246, 0.28);

  --green: #22C55E;
  --green-text: #6EE7B7;
  --green-bg: rgba(34, 197, 94, 0.12);
  --green-border: rgba(34, 197, 94, 0.28);

  --red: #EF4444;
  --red-text: #FCA5A5;
  --red-bg: rgba(239, 68, 68, 0.12);
  --red-border: rgba(239, 68, 68, 0.30);

  --unknown: #7F8BA1;
  --unknown-bg: rgba(127, 139, 161, 0.12);
  --unknown-border: rgba(127, 139, 161, 0.25);

  /* Радиусы и глубина */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-drawer: -16px 0 40px rgba(0, 0, 0, 0.55);

  /* Типографические стеки без внешних CDN */
  --font-sans: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont,
               "SF Pro Text", "Roboto", "Noto Sans", "Liberation Sans", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono",
               ui-monospace, monospace;

  /* Кривые и длительности анимаций */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-enter: 280ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

::selection {
  background: rgba(76, 141, 255, 0.28);
  color: var(--text-primary);
}

html {
  font-size: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.drawer-open {
  overflow: hidden;
}

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

input,
textarea {
  caret-color: var(--focus-ring);
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

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

[hidden] {
  display: none !important;
}

.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;
}

.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.mono-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.section-cap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-cap-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: currentColor;
  flex-shrink: 0;
}

.section-cap-dot--amber {
  background-color: var(--amber);
}

.section-cap-dot--blue {
  background-color: var(--blue);
}

.section-cap-dot--green {
  background-color: var(--green);
}

.section-cap-dot--violet {
  background-color: var(--violet);
}

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

.led {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  background-color: var(--unknown);
}

.led--sm {
  width: 7px;
  height: 7px;
}

.led--online {
  background-color: var(--green);
}

.led--degraded,
.led--warning,
.led--waiting_alexey {
  background-color: var(--amber);
}

.led--active {
  background-color: var(--blue);
}

.led--pilot {
  background-color: var(--violet);
}

.led--offline,
.led--error {
  background-color: var(--red);
}

.led--unknown {
  background-color: var(--unknown);
}

.led--pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: inherit;
  animation: ledPulse 2.2s var(--ease-out) infinite;
  pointer-events: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--unknown-border);
  background-color: var(--unknown-bg);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge--waiting_alexey {
  color: var(--amber-text);
  background-color: var(--amber-bg);
  border-color: var(--amber-border);
}

.status-badge--active {
  color: var(--blue-text);
  background-color: var(--blue-bg);
  border-color: var(--blue-border);
}

.status-badge--pilot {
  color: var(--violet-text);
  background-color: var(--violet-bg);
  border-color: var(--violet-border);
}

.status-badge--done,
.status-badge--online {
  color: var(--green-text);
  background-color: var(--green-bg);
  border-color: var(--green-border);
}

.status-badge--offline,
.status-badge--error {
  color: var(--red-text);
  background-color: var(--red-bg);
  border-color: var(--red-border);
}

.status-badge--degraded,
.status-badge--warning {
  color: var(--amber-text);
  background-color: var(--amber-bg);
  border-color: var(--amber-border);
}

.status-badge--unknown {
  color: var(--text-muted);
  background-color: var(--unknown-bg);
  border-color: var(--unknown-border);
}

.status-badge--internal {
  color: var(--text-secondary);
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-default);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.btn:hover:not(:disabled) {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--ghost {
  background-color: transparent;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn--ghost:hover:not(:disabled) {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.btn--primary {
  position: relative;
  height: 44px;
  width: 100%;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background-color: var(--cta-bg);
  color: var(--cta-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.btn--primary:hover:not(:disabled) {
  background-color: var(--cta-bg-hover);
  border-color: transparent;
}

.btn--primary:disabled {
  opacity: 0.82;
}

.btn-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.btn--primary.is-loading .btn-label {
  opacity: 0;
}

.btn-spinner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  border: 2px solid rgba(11, 13, 17, 0.24);
  border-top-color: var(--cta-text);
  opacity: 0;
  pointer-events: none;
  animation: spin 0.75s linear infinite;
}

.btn--primary.is-loading .btn-spinner {
  opacity: 1;
}

.btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-icon.is-spinning {
  animation: spin 0.75s linear infinite;
}

.btn-card-open {
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-card-open:hover {
  background-color: var(--cta-bg);
  border-color: var(--cta-bg);
  color: var(--cta-text);
}

.ext-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.ext-link-pill:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
}

/* ==========================================================================
   Экран 1: Вход (/login)
   ========================================================================== */

.login-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  animation: cardEnter var(--dur-enter) var(--ease-out) both;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--text-secondary);
}

.brand-mark {
  display: inline-grid;
  grid-template-columns: repeat(2, 5px);
  gap: 3px;
}

.brand-mark span {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-pill);
  background-color: var(--text-primary);
}

.brand-mark span:nth-child(2) {
  background-color: var(--blue);
}

.login-title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.login-subtitle {
  margin: 0 0 22px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-secondary);
}

.field-control {
  position: relative;
  display: flex;
  align-items: center;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-size: 0.875rem;
  line-height: 1.4;
}

.input--password {
  padding-right: 46px;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:hover {
  border-color: var(--border-strong);
}

.input:focus {
  outline: none;
  border-color: var(--focus-ring);
}

.eye-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
}

.eye-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

.form-alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red-border);
  background-color: var(--red-bg);
  color: var(--red-text);
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* ==========================================================================
   Экран 2: Шапка пульта (Sticky Topbar)
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: rgba(11, 13, 17, 0.92);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  max-width: 1380px;
  margin: 0 auto;
  min-height: 56px;
  padding: 8px 24px;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.hub-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  white-space: nowrap;
}

.contour-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sync-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.topbar-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.filter-tab:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

.filter-tab[aria-selected="true"] {
  background-color: var(--cta-bg);
  border-color: var(--cta-bg);
  color: var(--cta-text);
  font-weight: 600;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-track);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
}

.filter-tab[aria-selected="true"] .filter-count {
  background-color: rgba(11, 13, 17, 0.12);
  color: var(--cta-text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   Полотно дашборда
   ========================================================================== */

.hub-main {
  max-width: 1380px;
  margin: 0 auto;
  padding: 16px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--red-border);
  background-color: var(--red-bg);
  color: var(--red-text);
  font-size: 0.8125rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Верхняя лента «Ждёт решения Алексея»
   ========================================================================== */

.attention-band {
  background-color: var(--bg-surface);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attention-band--clear {
  border-color: var(--green-border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.attention-clear-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green-text);
  font-size: 0.8125rem;
  font-weight: 500;
}

.attention-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.attention-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attention-row {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-elevated);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.attention-row:hover {
  border-color: var(--amber-border);
  background-color: var(--bg-surface-hover);
}

.attention-project-tag {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--amber-border);
  background-color: var(--amber-bg);
  color: var(--amber-text);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.attention-text {
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.attention-arrow {
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.attention-more {
  align-self: flex-start;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background-color: transparent;
  color: var(--amber-text);
  font-size: 0.75rem;
  font-weight: 600;
}

.attention-more:hover {
  background-color: var(--amber-bg);
  border-color: var(--amber-border);
}

/* ==========================================================================
   Сетка 6 карточек проектов (3×2 на >= 1200px)
   ========================================================================== */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  gap: 12px;
}

.project-card--animate {
  animation: cardEnter var(--dur-enter) var(--ease-out) both;
  animation-delay: calc(var(--card-index, 0) * 35ms);
}

.project-card:hover {
  border-color: var(--border-default);
  background-color: var(--bg-surface-hover);
}

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

.card-title-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.card-domain {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.card-owner {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-owner-label {
  color: var(--text-muted);
}

.card-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pulse-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pulse-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Внутренний блок бенчмарка */

.benchmark-box {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.benchmark-values {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.benchmark-current {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.benchmark-target {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.benchmark-note {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* Сегментированная шкала прогресса */

.stage-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.stage-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  line-height: 1.35;
  min-width: 0;
}

.stage-progress-label {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.stage-progress-name {
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-segments {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
}

.progress-seg {
  position: relative;
  height: 6px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-track);
  overflow: hidden;
}

.progress-seg-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform-origin: left center;
  transform: scaleX(1);
}

.progress-seg--animate .progress-seg-fill {
  animation: segFill 260ms var(--ease-out) both;
}

.progress-seg--done .progress-seg-fill {
  background-color: var(--green);
}

.progress-seg--active .progress-seg-fill {
  background-color: var(--blue);
  animation: segFill 260ms var(--ease-out) both, activeSegPulse 2.2s ease-in-out 280ms infinite;
}

.progress-seg--waiting .progress-seg-fill {
  background-color: var(--amber);
  animation: segFill 260ms var(--ease-out) both, activeSegPulse 2.2s ease-in-out 280ms infinite;
}

/* Следующий шаг */

.next-step-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex-grow: 1;
}

.next-step-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* Футер карточки */

.card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.card-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Пустое состояние и скелетоны */

.empty-state {
  grid-column: 1 / -1;
  padding: 28px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.empty-state p {
  margin: 0;
  color: var(--text-secondary);
}

.skeleton-card {
  height: 292px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skeleton-bar {
  height: 14px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-track);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-bar--lg {
  height: 22px;
  width: 58%;
}

.skeleton-bar--box {
  height: 68px;
  border-radius: var(--radius-md);
}

.skeleton-bar--sm {
  width: 42%;
}

/* ==========================================================================
   Экран 3: Панель проекта (Slide-over Drawer)
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: var(--bg-overlay);
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}

.drawer-backdrop[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  width: 740px;
  max-width: 92vw;
  height: 100dvh;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(28px);
  opacity: 0;
  transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}

.drawer-backdrop[data-open="true"] .drawer-panel {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: rgba(18, 21, 28, 0.96);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.drawer-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.drawer-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background-color: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

.drawer-close-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background-color: var(--bg-surface-hover);
}

.drawer-close-mobile-text {
  display: none;
}

.drawer-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.drawer-owner {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.drawer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-body {
  padding: 20px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* Vision */

.vision-box {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vision-box--dictation {
  background-color: var(--amber-bg);
  border-color: var(--amber-border);
}

.vision-quote {
  margin: 0;
  max-width: 72ch;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.vision-box--dictation .vision-quote {
  color: var(--amber-text);
  font-weight: 500;
}

.vision-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Вертикальная дорожка этапов */

.stages-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.stage-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 14px;
}

.stage-item:last-child {
  padding-bottom: 0;
}

.stage-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stage-rail::after {
  content: "";
  width: 1px;
  flex: 1;
  margin-top: 4px;
  background-color: var(--border-default);
}

.stage-item:last-child .stage-rail::after {
  display: none;
}

.stage-node {
  position: relative;
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border-strong);
  background-color: var(--bg-surface);
  flex-shrink: 0;
}

.stage-node--done {
  border-color: var(--green);
  background-color: var(--green);
}

.stage-node--active {
  border-color: var(--blue);
  background-color: var(--blue);
}

.stage-node--active::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background-color: var(--blue);
  animation: ledPulse 2.2s var(--ease-out) infinite;
  pointer-events: none;
}

.stage-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stage-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stage-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stage-item--next .stage-name {
  color: var(--text-secondary);
  font-weight: 500;
}

.stage-detail {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* План развития по горизонтам */

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.roadmap-col {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.roadmap-list {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.roadmap-list li {
  overflow-wrap: anywhere;
}

.roadmap-empty {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Живой срез: мост + TND задачи */

.bridge-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-elevated);
}

.bridge-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bridge-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.bridge-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.tasks-table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-elevated);
  overflow: hidden;
}

.tasks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.tasks-table th {
  padding: 9px 12px;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
}

.tasks-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.tasks-table tr:last-child td {
  border-bottom: 0;
}

.task-title-link {
  color: var(--text-primary);
  font-weight: 500;
}

.task-title-link:hover {
  color: var(--blue-text);
  text-decoration: underline;
}

/* Матрица сервисов */

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

.service-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

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

.service-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.service-detail {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* Подтверждено в работе / Открытые пункты */

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

.list-panel {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.detail-list {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.detail-list li {
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Ключевые кадры (только transform и opacity)
   ========================================================================== */

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes segFill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes activeSegPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes ledPulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  70%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes skeletonPulse {
  0%, 100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.85;
  }
}

/* ==========================================================================
   Адаптив: Планшет 768px – 1199px
   ========================================================================== */

@media (max-width: 1199px) {
  .topbar-inner {
    padding: 10px 20px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
  }

  .topbar-tabs {
    grid-column: 1 / -1;
    order: 3;
    justify-content: flex-start;
  }

  .hub-main {
    padding: 16px 20px 24px;
  }

  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .drawer-panel {
    width: 86vw;
    max-width: 86vw;
  }
}

/* ==========================================================================
   Адаптив: Мобильный < 768px (в т.ч. 390×844 без горизонтального скролла)
   ========================================================================== */

@media (max-width: 767px) {
  .topbar-inner {
    padding: 10px 16px;
    gap: 10px;
  }

  .topbar-left {
    gap: 8px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .btn,
  .filter-tab,
  .btn-card-open,
  .ext-link-pill,
  .eye-btn,
  .attention-row,
  .attention-more,
  .drawer-close-btn {
    min-height: 44px;
  }

  .filter-tab {
    padding: 0 11px;
  }

  .hub-main {
    padding: 12px 16px 24px;
    gap: 12px;
  }

  .projects-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .attention-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .attention-project-tag {
    grid-column: 1 / 2;
    justify-self: start;
  }

  .attention-text {
    grid-column: 1 / 2;
  }

  .attention-arrow {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
  }

  .drawer-panel {
    width: 100vw;
    max-width: 100vw;
    border-left: 0;
    border-radius: 0;
    transform: translateY(24px);
  }

  .drawer-header {
    padding: 12px 16px;
  }

  .drawer-body {
    padding: 16px 16px 28px;
    gap: 16px;
  }

  .drawer-close-desktop-icon {
    display: none;
  }

  .drawer-close-mobile-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .roadmap-grid,
  .service-matrix,
  .split-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Таблица TND-1..N перестраивается в компактные вертикальные строки-карточки */
  .tasks-table-wrap {
    border: 0;
    background-color: transparent;
  }

  .tasks-table,
  .tasks-table thead,
  .tasks-table tbody,
  .tasks-table tr,
  .tasks-table td {
    display: block;
    width: 100%;
  }

  .tasks-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .tasks-table tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .tasks-table tr {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .tasks-table td {
    padding: 0;
    border-bottom: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
  }

  .tasks-table td::before {
    content: attr(data-label);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    flex-shrink: 0;
  }

  .tasks-table td.task-title-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

/* ==========================================================================
   Доступность: отключение анимаций при prefers-reduced-motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
