/* ==========================================================================
   TG·88 — «НАЗАД В БУДУЩЕЕ 2» UI
   Приборная панель машины времени: временные цепи, неон Хилл-Вэлли 2015,
   LED-дисплеи, хром DeLorean, предупреждающие ленты и 1.21 гигаватта.
   Рукописные SVG — в app/Views/partials/icons.php.
   ========================================================================== */

/* ─────────────────────────── 0. ТОКЕНЫ ─────────────────────────── */
:root {
  /* ночь над Хилл-Вэлли */
  --sky-0: #04060f;
  --sky-1: #070b1c;
  --sky-2: #0c1330;

  /* металл DeLorean */
  --steel-0: #0d111c;
  --steel-1: #131a2a;
  --steel-2: #1a2338;
  --steel-3: #263250;
  --edge:    #2e3d61;
  --chrome:  #a9bedf;

  /* неон */
  --neon-cyan:   #3be8ff;
  --neon-pink:   #ff2e88;
  --neon-orange: #ff7a18;

  /* LED временных цепей */
  --led-red:   #ff3b24;
  --led-green: #3aff6e;
  --led-amber: #ffb300;

  --ok:     #3aff6e;
  --warn:   #ffb300;
  --danger: #ff3b3b;

  --text:     #dce7ff;
  --text-dim: #7f8fb6;

  --font-display: 'Orbitron', 'Chakra Petch', sans-serif;
  --font-ui:      'Chakra Petch', 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
  --font-led:     'DSEG7-Classic', 'DSEG7 Classic', 'JetBrains Mono', monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --glow-cyan:   0 0 8px rgba(59, 232, 255, .55), 0 0 24px rgba(59, 232, 255, .25);
  --glow-pink:   0 0 8px rgba(255, 46, 136, .55), 0 0 24px rgba(255, 46, 136, .25);
  --glow-orange: 0 0 10px rgba(255, 122, 24, .55), 0 0 26px rgba(255, 122, 24, .3);

  --dash-h: 78px;
  --console-w: 216px;
}

/* ─────────────────────────── 1. БАЗА ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* атрибут hidden сильнее любых display-правил компонентов */
[hidden] { display: none !important; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(120% 90% at 50% -10%, var(--sky-2) 0%, var(--sky-1) 45%, var(--sky-0) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  color-scheme: dark;
}

::selection { background: rgba(59, 232, 255, .35); color: #fff; }

:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

a { color: var(--neon-cyan); }
a.link { color: var(--neon-cyan); text-decoration-color: rgba(59,232,255,.4); }
a.link:hover { text-shadow: var(--glow-cyan); }

.mono { font-family: var(--font-mono); }

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

/* иконки спрайта */
.ic {
  width: 1.15em; height: 1.15em;
  display: inline-block;
  vertical-align: -0.22em;
  flex: none;
}

/* светодиоды */
.led {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  background: #444;
}
.led-green { background: var(--led-green); box-shadow: 0 0 6px var(--led-green); animation: led-breathe 2.4s ease-in-out infinite; }
.led-cyan  { background: var(--neon-cyan); box-shadow: 0 0 6px var(--neon-cyan); animation: led-breathe 3.1s ease-in-out infinite; }
.led-amber { background: var(--led-amber); box-shadow: 0 0 6px var(--led-amber); animation: led-breathe 1.8s ease-in-out infinite; }
.led-red   { background: var(--led-red);   box-shadow: 0 0 6px var(--led-red);   animation: led-blink 1s steps(1) infinite; }

/* кастомный скроллбар */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--steel-0); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--steel-3), var(--steel-2));
  border-radius: 6px;
  border: 2px solid var(--steel-0);
}
::-webkit-scrollbar-thumb:hover { background: var(--neon-cyan); }

/* ─────────────────────────── 2. ФОН ─────────────────────────── */
#bttf-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* свечение горизонта над «сеткой» */
.skyline {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 34vh;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(to top,
      rgba(255, 46, 136, .10) 0%,
      rgba(59, 232, 255, .06) 34%,
      transparent 70%);
}

/* ─────────────────────────── 3. КОКПИТ ─────────────────────────── */
.cockpit {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* лёгкие сканлайны поверх всего кокпита */
.cockpit::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 3px,
    rgba(0, 0, 0, .085) 3px 4px
  );
  mix-blend-mode: multiply;
}

/* ══════════ 3.1 ПРИБОРНАЯ ДОСКА ══════════ */
.dash {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--dash-h);
  display: flex;
  align-items: stretch;
  gap: 18px;
  padding: 8px 18px;
  background:
    linear-gradient(180deg, #1c2438 0%, #11182a 55%, #0b101f 100%);
  border-bottom: 1px solid var(--edge);
  box-shadow:
    inset 0 1px 0 rgba(169, 190, 223, .18),
    0 6px 24px rgba(0, 0, 0, .55);
}
/* хром-кант снизу доски */
.dash::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 4px;
  background: linear-gradient(90deg,
    transparent, rgba(59,232,255,.5) 18%, rgba(169,190,223,.7) 50%,
    rgba(255,46,136,.5) 82%, transparent);
  filter: blur(.4px);
  opacity: .6;
  pointer-events: none;
}

/* — логотип — */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 6px 4px;
}
.brand-badge {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, var(--steel-2), var(--steel-0));
  border: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 rgba(169,190,223,.25), 0 3px 10px rgba(0,0,0,.5);
}
.brand-badge .ic {
  width: 26px; height: 26px;
  color: var(--neon-orange);
  filter: drop-shadow(0 0 5px rgba(255,122,24,.7));
  animation: flux-throb 2.2s ease-in-out infinite;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 24px;
  font-style: italic;
  letter-spacing: .5px;
  background: linear-gradient(180deg, #f4f8ff 8%, #b9cbe8 38%, #5f7396 52%, #cfdcf2 66%, #8fa5c9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.7)) drop-shadow(0 0 12px rgba(59,232,255,.35));
}
.brand-name i { font-style: inherit; color: var(--neon-orange); -webkit-text-fill-color: var(--neon-orange); }
.brand-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* — временные цепи — */
.circuits {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  margin-left: auto;
  padding: 6px 14px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #0a0d16, #060810);
  border: 1px solid var(--steel-3);
  box-shadow: inset 0 2px 10px rgba(0,0,0,.8), inset 0 0 0 1px rgba(0,0,0,.6);
}
.tc-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 12px;
}
.tc-led {
  font-family: var(--font-led);
  font-size: 15px;
  letter-spacing: 1px;
  white-space: nowrap;
  min-width: 188px;
}
.tc-caption {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}
.tc-dest    .tc-led { color: var(--led-red);   text-shadow: 0 0 6px rgba(255,59,36,.9), 0 0 18px rgba(255,59,36,.35); }
.tc-present .tc-led { color: var(--led-green); text-shadow: 0 0 6px rgba(58,255,110,.9), 0 0 18px rgba(58,255,110,.35); }
.tc-depart  .tc-led { color: var(--led-amber); text-shadow: 0 0 6px rgba(255,179,0,.9), 0 0 18px rgba(255,179,0,.35); }
.tc-led.tc-flicker { animation: tc-flicker .45s steps(2) 1; }

/* — правый блок доски — */
.dash-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* спидометр */
.speedo {
  position: relative;
  width: 116px;
  cursor: pointer;
  user-select: none;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.5));
}
.speedo-svg { display: block; width: 100%; }
.speedo-arc {
  fill: none;
  stroke: var(--steel-3);
  stroke-width: 3;
  stroke-linecap: round;
}
.speedo-ticks line { stroke: var(--chrome); stroke-width: 1.6; opacity: .55; }
.speedo-ticks line.is-major { stroke-width: 2.4; opacity: .95; }
.speedo-num {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-dim);
}
.speedo-88 { fill: var(--neon-orange); font-weight: 700; }
.speedo-needle {
  stroke: var(--led-red);
  stroke-width: 2.5;
  stroke-linecap: round;
  transform-origin: 60px 60px;
  transform: rotate(-110deg);
  transition: transform .6s cubic-bezier(.2, .9, .25, 1.15);
  filter: drop-shadow(0 0 3px rgba(255,59,36,.8));
}
.speedo-hub { fill: var(--steel-3); stroke: var(--chrome); stroke-width: 1; }
.speedo-read {
  position: absolute;
  left: 50%; bottom: -2px;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.speedo-mph {
  font-family: var(--font-led);
  font-size: 13px;
  color: var(--led-amber);
  text-shadow: 0 0 6px rgba(255,179,0,.8);
}
.speedo-unit {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.speedo.is-88 .speedo-needle { stroke: var(--neon-orange); filter: drop-shadow(0 0 6px rgba(255,122,24,1)); }
.speedo.is-88 .speedo-mph { color: var(--neon-orange); animation: led-blink .25s steps(1) 6; }

/* статусы */
.dash-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}
.status-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
}
#os-clock {
  font-size: 15px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(59,232,255,.6);
}
#net-status.is-offline .led { background: var(--led-red); box-shadow: 0 0 6px var(--led-red); animation: led-blink .6s steps(1) infinite; }
#net-status.is-offline .status-text { color: var(--led-red); }

/* кнопка выхода */
.logout-form { display: flex; align-items: center; }
.eject-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffd9cf;
  background: linear-gradient(180deg, #57202a, #33141c);
  border: 1px solid #7a2d36;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: box-shadow .2s, transform .12s, border-color .2s;
}
.eject-btn:hover {
  border-color: var(--led-red);
  box-shadow: 0 0 12px rgba(255,59,36,.45), inset 0 0 8px rgba(255,59,36,.2);
}
.eject-btn:active { transform: translateY(1px); }

/* ══════════ 3.2 КАБИНА ══════════ */
.cabin {
  flex: 1;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 0;
}

/* — центральная консоль (навигация) — */
.console {
  width: var(--console-w);
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 14px 16px;
  background: linear-gradient(180deg, rgba(19,26,42,.92), rgba(10,14,24,.92));
  border-right: 1px solid var(--edge);
  box-shadow: inset -12px 0 24px -14px rgba(0,0,0,.8);
}
.console-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.console-key {
  position: relative;
  display: grid;
  grid-template-columns: 10px 22px 1fr;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  text-decoration: none;
  color: var(--text-dim);
  background: linear-gradient(180deg, var(--steel-2), var(--steel-1) 60%, var(--steel-0));
  border: 1px solid var(--steel-3);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 1px 0 rgba(169,190,223,.16),
    0 3px 6px rgba(0,0,0,.45);
  transition: transform .15s ease, box-shadow .2s ease, color .2s ease, border-color .2s ease;
  overflow: hidden;
}
/* неон-подсветка «ховера» — как у летающих машин */
.console-key::after {
  content: '';
  position: absolute;
  left: 12%; right: 12%; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--neon-cyan);
  opacity: 0;
  filter: blur(1px);
  transition: opacity .25s;
}
.console-key:hover {
  color: var(--text);
  transform: translateY(-2px);
  border-color: rgba(59,232,255,.5);
  box-shadow:
    inset 0 1px 0 rgba(169,190,223,.16),
    0 8px 18px rgba(0,0,0,.5),
    0 4px 16px rgba(59,232,255,.18);
}
.console-key:hover::after { opacity: .9; }
.console-key:active { transform: translateY(0); }

.key-led {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #39404f;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.8);
  transition: background .2s, box-shadow .2s;
}
.key-icon { width: 21px; height: 21px; }
.key-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .4px;
}
.key-code {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8.5px;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity .25s;
}
.console-key:hover .key-code { opacity: .75; }

.console-key.is-active {
  color: #eaf6ff;
  border-color: rgba(59,232,255,.65);
  box-shadow:
    inset 0 1px 0 rgba(169,190,223,.2),
    inset 0 0 18px rgba(59,232,255,.12),
    0 0 16px rgba(59,232,255,.22);
}
.console-key.is-active .key-led {
  background: var(--led-green);
  box-shadow: 0 0 7px var(--led-green);
  animation: led-breathe 2s ease-in-out infinite;
}
.console-key.is-active .key-icon { color: var(--neon-cyan); filter: drop-shadow(0 0 5px rgba(59,232,255,.7)); }
.console-key.is-active::after { opacity: 1; }

/* Mr. Fusion в подвале консоли */
.console-fusion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--steel-3);
  border-radius: var(--r-md);
  opacity: .85;
}
.fusion-icon {
  width: 26px; height: 26px;
  color: var(--chrome);
  animation: fusion-shimmer 4s ease-in-out infinite;
}
.fusion-meta { display: flex; flex-direction: column; line-height: 1.3; }
.fusion-name {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.fusion-power {
  font-size: 10.5px;
  color: var(--led-amber);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* — лобовое стекло / контент — */
.viewport {
  flex: 1;
  min-width: 0;
  padding: 26px 28px 34px;
  display: flex;
}

.panel-frame {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(16,21,35,.92), rgba(10,14,24,.94));
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 1px 0 rgba(169,190,223,.14),
    0 24px 60px -18px rgba(0,0,0,.8),
    0 0 0 1px rgba(0,0,0,.5);
  animation: panel-in .38s cubic-bezier(.2,.9,.3,1) both;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  background: linear-gradient(180deg, rgba(38,50,80,.55), rgba(19,26,42,.4));
  border-bottom: 1px solid var(--edge);
}
.panel-rivet,
.panel-rivet::after {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #cdd9ee, #5a6a8c 55%, #232d45);
  box-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.panel-rivet { position: relative; flex: none; }
.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff 10%, #bacce9 45%, #64789c 55%, #d6e2f5 70%, #90a6ca 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.65));
}
.panel-code {
  margin-left: auto;
  font-size: 10.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.panel-body {
  flex: 1;
  padding: 24px 24px 28px;
  min-width: 0;
  animation: body-in .34s ease-out both;
  animation-delay: .05s;
}

/* бегущая строка в подвале панели */
.panel-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 7px 18px;
  font-size: 10px;
  letter-spacing: 1.6px;
  color: var(--text-dim);
  border-top: 1px solid rgba(46,61,97,.6);
  background: rgba(6,9,16,.7);
  overflow: hidden;
}
.panel-foot-cell { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.panel-foot-scroll {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.panel-foot-scroll span {
  display: inline-block;
  padding-left: 100%;
  animation: ticker 38s linear infinite;
}

/* ─────────────────────── 4. FLASH / OUTATIME ─────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-weight: 600;
  animation: flash-in .3s ease-out both;
}
.flash .ic { color: currentColor; }
.flash-success {
  color: #c9ffdb;
  background: rgba(58,255,110,.08);
  border: 1px solid rgba(58,255,110,.4);
  box-shadow: inset 0 0 18px rgba(58,255,110,.07), 0 0 14px rgba(58,255,110,.12);
}
.flash-info {
  color: #cff4ff;
  background: rgba(59,232,255,.08);
  border: 1px solid rgba(59,232,255,.4);
}

/* номерной знак OUTATIME для ошибок */
.flash-error.plate {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 16px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #f4f1e4, #ddd8c4);
  border: 3px solid #8f2f1f;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 2px #f8f6ec,
    inset 0 0 22px rgba(143,47,31,.18),
    0 4px 14px rgba(0,0,0,.5);
  animation: plate-slam .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.plate-title {
  grid-row: 1 / span 2;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 21px;
  letter-spacing: 3px;
  color: #a33520;
  text-shadow: 0 1px 0 #fff;
}
.plate-msg {
  color: #4c3a2c;
  font-weight: 600;
  font-size: 13.5px;
}
.flash-error.plate::before {
  content: '● ' 'CALIFORNIA · TIME PARADOX DETECTED';
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 2px;
  color: #8d7a5f;
}

/* ─────────────────────── 5. КНОПКИ ─────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .6px;
  color: var(--text);
  background: linear-gradient(180deg, var(--steel-2), var(--steel-1) 55%, var(--steel-0));
  border: 1px solid var(--steel-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease, color .2s;
  box-shadow: inset 0 1px 0 rgba(169,190,223,.14), 0 3px 8px rgba(0,0,0,.4);
}
.btn:hover {
  border-color: rgba(59,232,255,.55);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(169,190,223,.14),
    0 4px 14px rgba(0,0,0,.45),
    0 0 14px rgba(59,232,255,.25);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  font-family: var(--font-display);
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-size: 12.5px;
  color: #fff8f2;
  background: linear-gradient(180deg, #ff8a2a, #f4470f 55%, #c22b06);
  border-color: #ff9b4a;
  text-shadow: 0 1px 2px rgba(120,30,0,.8);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.35),
    0 4px 14px rgba(244,71,15,.35);
}
.btn-primary:hover {
  border-color: #ffc180;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.35),
    0 6px 22px rgba(244,71,15,.5),
    var(--glow-orange);
}

.btn-danger {
  color: #ffd7d7;
  background: linear-gradient(180deg, #5b1f27, #38131a);
  border-color: #7c2b31;
}
.btn-danger:hover {
  border-color: var(--led-red);
  box-shadow: 0 0 12px rgba(255,59,36,.4);
}

.btn-warn {
  color: #ffe9bd;
  background: linear-gradient(180deg, #5d4413, #3a2b0c);
  border-color: #8a6a1e;
}
.btn-warn:hover { border-color: var(--led-amber); box-shadow: 0 0 12px rgba(255,179,0,.35); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 15px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* большой рычаг запуска кампании */
.btn-engage {
  position: relative;
  overflow: hidden;
}
.btn-engage::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 48%, transparent 62%);
  transform: translateX(-120%);
  transition: transform .5s ease;
}
.btn-engage:hover::before { transform: translateX(120%); }

/* ─────────────────────── 6. ФОРМЫ ─────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.field input,
.field select,
.field textarea,
.input,
.post-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  background: linear-gradient(180deg, #0a0e1a, #0d1322);
  border: 1px solid var(--steel-3);
  border-radius: var(--r-sm);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.55);
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus,
.post-textarea:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.55), 0 0 0 1px rgba(59,232,255,.4), 0 0 14px rgba(59,232,255,.2);
}
.field select,
select.input {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5 L6 6.5 L11 1.5' fill='none' stroke='%233be8ff' stroke-width='1.8' stroke-linecap='round'/></svg>"),
    linear-gradient(180deg, #0a0e1a, #0d1322);
  background-repeat: no-repeat, no-repeat;
  background-position: right 12px center, 0 0;
  padding-right: 34px;
}
.input-sm { padding: 7px 10px; font-size: 13px; }
select.input-sm { padding-right: 30px; }
input::placeholder, textarea::placeholder { color: #55648c; }

/* дата/время — красный LED, как Destination Time */
input[type="datetime-local"],
input[type="time"] {
  font-family: var(--font-mono);
  color: var(--led-red);
  text-shadow: 0 0 5px rgba(255,59,36,.55);
  letter-spacing: 1px;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(.7) sepia(1) saturate(4) hue-rotate(150deg);
  cursor: pointer;
}
input[type="number"] { font-family: var(--font-mono); color: var(--led-amber); text-shadow: 0 0 5px rgba(255,179,0,.4); }
input[type="checkbox"] { accent-color: var(--neon-cyan); width: 15px; height: 15px; }
input[type="radio"] { accent-color: var(--neon-orange); }

/* ─────────────────────── 7. ЧИПЫ / ПИЛЮЛИ ─────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--neon-cyan);
  background: rgba(59,232,255,.06);
  border: 1px solid rgba(59,232,255,.35);
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
  user-select: none;
}
.chip:hover {
  background: rgba(59,232,255,.14);
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}
.chip-accent {
  color: var(--neon-pink);
  border-color: rgba(255,46,136,.4);
  background: rgba(255,46,136,.07);
}
.chip-accent:hover { background: rgba(255,46,136,.16); box-shadow: var(--glow-pink); }
.chip-sm { padding: 2px 8px; font-size: 10.5px; cursor: default; }
.chip-sm:hover { transform: none; box-shadow: none; }

.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check:has(input:checked) {
  color: #06121a;
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  font-weight: 700;
}

/* режимы тайминга — тумблеры приборки */
.timing-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}
.radio-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  background: linear-gradient(180deg, var(--steel-2), var(--steel-0));
  border: 1px solid var(--steel-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .18s ease;
  box-shadow: inset 0 1px 0 rgba(169,190,223,.12);
}
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #3a4152;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.7);
  transition: all .18s;
}
.radio-pill:hover { color: var(--text); border-color: rgba(59,232,255,.4); }
.radio-pill:has(input:checked) {
  color: #eaf9ff;
  border-color: rgba(59,232,255,.65);
  box-shadow: inset 0 0 14px rgba(59,232,255,.12), 0 0 12px rgba(59,232,255,.18);
}
.radio-pill:has(input:checked)::before {
  background: var(--led-green);
  box-shadow: 0 0 7px var(--led-green);
}

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

/* ─────────────────────── 8. КАРТОЧКИ / ПАНЕЛИ ─────────────────────── */
.glass,
.glass-card,
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(26,35,56,.55), rgba(13,17,28,.72));
  border: 1px solid var(--steel-3);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 1px 0 rgba(169,190,223,.12),
    0 10px 28px -10px rgba(0,0,0,.65);
}
.glass-card, .panel { padding: 20px; }
.panel + .panel, .glass-card + .glass-card, section.panel ~ section.panel { margin-top: 20px; }

/* уголки-скобы на карточках */
.glass-card::before,
.panel::before {
  content: '';
  position: absolute;
  inset: 6px;
  pointer-events: none;
  border-radius: calc(var(--r-md) - 4px);
  background:
    linear-gradient(var(--neon-cyan), var(--neon-cyan)) top left / 14px 1.5px,
    linear-gradient(var(--neon-cyan), var(--neon-cyan)) top left / 1.5px 14px,
    linear-gradient(var(--neon-cyan), var(--neon-cyan)) bottom right / 14px 1.5px,
    linear-gradient(var(--neon-cyan), var(--neon-cyan)) bottom right / 1.5px 14px;
  background-repeat: no-repeat;
  opacity: .28;
  transition: opacity .25s;
}
.glass-card:hover::before, .panel:hover::before { opacity: .75; }

.panel-title,
.card-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: #cfe0fb;
}
h2.panel-title::before, h2.card-title::before {
  content: '▸ ';
  color: var(--neon-orange);
}
.card-subtitle {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  letter-spacing: 1px;
  color: #eaf2ff;
}
.page-sub { margin: 4px 0 0; color: var(--text-dim); font-size: 13.5px; }

/* ─────────────────────── 9. ТАБЛИЦЫ ─────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.data-table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 12px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--steel-3);
  white-space: nowrap;
}
td {
  padding: 12px;
  font-size: 13.5px;
  border-bottom: 1px solid rgba(38,50,80,.45);
  vertical-align: middle;
}
tbody tr {
  transition: background .18s, box-shadow .18s;
}
tbody tr:hover {
  background: linear-gradient(90deg, rgba(59,232,255,.05), rgba(255,46,136,.04));
  box-shadow: inset 2px 0 0 var(--neon-cyan);
}
.cell-title { display: block; font-weight: 600; color: #e8f0ff; }
.cell-sub { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.empty-cell { color: var(--text-dim); padding: 18px 12px; }
.ta-r { text-align: right; }
.row-actions { display: flex; gap: 6px; justify-content: flex-start; }
.inline-form { display: inline-block; margin: 0 0 0 4px; }

/* ─────────────────────── 10. БЕЙДЖИ / ПРОГРЕСС ─────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-radius: 4px;
  color: var(--text-dim);
  background: rgba(127,143,182,.1);
  border: 1px solid rgba(127,143,182,.35);
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.badge-green, .badge-active, .badge-completed {
  color: var(--led-green);
  border-color: rgba(58,255,110,.45);
  background: rgba(58,255,110,.07);
}
.badge-red, .badge-cancelled {
  color: var(--led-red);
  border-color: rgba(255,59,36,.45);
  background: rgba(255,59,36,.07);
}
.badge-purple {
  color: var(--neon-pink);
  border-color: rgba(255,46,136,.45);
  background: rgba(255,46,136,.07);
}
.badge-paused {
  color: var(--led-amber);
  border-color: rgba(255,179,0,.45);
  background: rgba(255,179,0,.07);
}
.badge-active::before { animation: led-breathe 2s ease-in-out infinite; }

/* прогресс — предупреждающая лента флюкса */
.progress {
  position: relative;
  height: 12px;
  min-width: 120px;
  background: #0a0d16;
  border: 1px solid var(--steel-3);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.7);
}
.progress-bar {
  height: 100%;
  border-radius: 5px;
  background: repeating-linear-gradient(
    -45deg,
    var(--led-amber) 0 9px,
    #171307 9px 18px
  );
  background-size: 200% 100%;
  box-shadow: 0 0 10px rgba(255,179,0,.35);
  animation: hazard-roll 1.2s linear infinite;
  transition: width .6s ease;
}

/* дельты статистики */
.delta { font-family: var(--font-mono); font-weight: 700; font-size: 15px; }
.delta-up   { color: var(--led-green); text-shadow: 0 0 8px rgba(58,255,110,.5); }
.delta-down { color: var(--led-red);   text-shadow: 0 0 8px rgba(255,59,36,.5); }
.delta-flat { color: var(--text-dim); }
.delta-na   { color: #4b5878; }
.delta-up::before   { content: '▲ '; font-size: 10px; }
.delta-down::before { content: '▼ '; font-size: 10px; }

/* ─────────────────────── 11. ДАШБОРД ─────────────────────── */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
/* LED-табло, как строки временных цепей */
.grid-cards .stat-card {
  padding: 14px 16px 12px;
  text-align: center;
  overflow: hidden;
}
.grid-cards .stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.16) 2px 3px);
  border-radius: inherit;
}
.stat-value {
  font-family: var(--font-led);
  font-size: 30px;
  line-height: 1.1;
  color: var(--led-green);
  text-shadow: 0 0 8px rgba(58,255,110,.85), 0 0 26px rgba(58,255,110,.3);
  animation: value-ignite .5s ease-out both;
}
.stat-value.is-neutral {
  color: var(--led-amber);
  text-shadow: 0 0 8px rgba(255,179,0,.85), 0 0 26px rgba(255,179,0,.3);
}
.stat-value.is-danger {
  color: var(--led-red);
  text-shadow: 0 0 8px rgba(255,59,36,.85), 0 0 26px rgba(255,59,36,.3);
}
.stat-label {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* — системный монитор — */
.sysmon { margin-bottom: 22px; }
.sysmon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.sysmon-head .card-title { margin: 0; }
.sysmon-live { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; }
.sysmon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
}
.sysmon-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.gauge { position: relative; width: 108px; height: 108px; }
.gauge-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: #1c2437; stroke-width: 9; }
.gauge-fill {
  fill: none;
  stroke: var(--neon-cyan);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 5px rgba(59,232,255,.6));
  transition: stroke .3s;
}
.gauge.is-warn .gauge-fill { stroke: var(--led-amber); filter: drop-shadow(0 0 5px rgba(255,179,0,.6)); }
.gauge.is-crit .gauge-fill { stroke: var(--led-red); filter: drop-shadow(0 0 6px rgba(255,59,36,.7)); animation: led-breathe 1s ease-in-out infinite; }
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.gauge-value {
  font-family: var(--font-led);
  font-size: 17px;
  color: #d9e6ff;
  text-shadow: 0 0 8px rgba(59,232,255,.5);
}
.gauge-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.sysmon-sub { font-size: 10.5px; color: var(--text-dim); }
.sparkline { width: 100%; max-width: 150px; height: 34px; }
.sparkline polyline {
  stroke: var(--neon-cyan);
  stroke-width: 1.6;
  filter: drop-shadow(0 0 3px rgba(59,232,255,.6));
}
.sysmon-info { align-items: stretch; justify-content: center; }
.sysmon-list { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.sysmon-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed rgba(38,50,80,.6);
  padding-bottom: 6px;
}
.sysmon-row dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sysmon-row dd { margin: 0; font-size: 12.5px; color: #d9e6ff; display: flex; align-items: center; gap: 6px; }
.db-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--led-green);
  box-shadow: 0 0 6px var(--led-green);
}
.db-dot.is-down { background: var(--led-red); box-shadow: 0 0 6px var(--led-red); animation: led-blink .5s steps(1) infinite; }

/* — терминал: бортовой радиожурнал — */
.terminal {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--steel-3);
  box-shadow: 0 14px 40px -12px rgba(0,0,0,.8);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  background: linear-gradient(180deg, #1b2334, #10131f);
  border-bottom: 1px solid var(--steel-3);
}
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot:nth-child(1) { background: var(--led-red); box-shadow: 0 0 5px var(--led-red); }
.terminal-dot:nth-child(2) { background: var(--led-amber); box-shadow: 0 0 5px var(--led-amber); }
.terminal-dot:nth-child(3) { background: var(--led-green); box-shadow: 0 0 5px var(--led-green); }
.terminal-body {
  position: relative;
  height: 320px;
  overflow-y: auto;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(58,255,110,.05), transparent 55%),
    #050807;
}
.terminal-body::after {
  content: '';
  position: sticky;
  display: block;
  bottom: 0; left: 0; right: 0;
  height: 0;
  box-shadow: 0 0 34px 18px rgba(5,8,7,.9);
}
.term-line { animation: term-line-in .25s ease-out both; word-break: break-word; }
.term-line.is-ok      { color: var(--led-green); text-shadow: 0 0 6px rgba(58,255,110,.35); }
.term-line.is-err     { color: var(--led-red);   text-shadow: 0 0 6px rgba(255,59,36,.35); }
.term-line.is-pending { color: var(--neon-cyan); text-shadow: 0 0 6px rgba(59,232,255,.35); }
.term-line.is-wait    { color: var(--led-amber); opacity: .8; }
.term-cursor {
  display: inline-block;
  width: 8px; height: 14px;
  margin-left: 4px;
  vertical-align: -2px;
  background: var(--led-green);
  box-shadow: 0 0 8px rgba(58,255,110,.8);
  animation: led-blink 1s steps(1) infinite;
}

/* ─────────────────────── 12. КОНСТРУКТОР ─────────────────────── */
.constructor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}
.constructor-editor { min-width: 0; }

.templates-bar,
.macro-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(6,9,16,.55);
  border: 1px solid rgba(38,50,80,.7);
  border-radius: var(--r-sm);
}
.macro-bar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.templates-list { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.templates-empty { font-size: 11px; color: var(--text-dim); }
.template-chip { display: inline-flex; align-items: center; gap: 2px; }
.template-del {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.template-del:hover { color: var(--led-red); background: rgba(255,59,36,.12); }
#template-save { margin-left: auto; }

.post-textarea {
  resize: vertical;
  min-height: 170px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
}

.editor-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

/* дропзона — тяговый луч */
.dropzone {
  position: relative;
  margin-top: 16px;
  padding: 22px 16px;
  text-align: center;
  border: 2px dashed rgba(59,232,255,.4);
  border-radius: var(--r-md);
  background: rgba(59,232,255,.03);
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.dropzone:hover { border-color: rgba(59,232,255,.7); background: rgba(59,232,255,.06); }
.dropzone.is-drag {
  border-color: var(--neon-cyan);
  background: rgba(59,232,255,.1);
  box-shadow: inset 0 0 34px rgba(59,232,255,.15), var(--glow-cyan);
  animation: tractor 1s ease-in-out infinite;
}
.dropzone-hint { color: var(--text-dim); font-size: 13px; }
.dropzone.is-drag .dropzone-hint { color: var(--neon-cyan); }
.media-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--neon-cyan);
}

/* выбор каналов */
.channels-picker { margin-top: 20px; }
.channels-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.channels-picker-head .card-subtitle { margin: 0; }
.channels-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.channels-tools .input { width: auto; }
.channel-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--steel-3);
  border-radius: var(--r-sm);
  background: rgba(6,9,16,.5);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.channel-item:hover {
  background: rgba(59,232,255,.06);
  border-color: rgba(59,232,255,.25);
  transform: translateX(3px);
}
.channel-item:has(.js-channel:checked) {
  background: rgba(58,255,110,.06);
  border-color: rgba(58,255,110,.35);
  box-shadow: inset 2px 0 0 var(--led-green);
}
.channel-item-name { font-weight: 600; font-size: 13.5px; }
.channel-item-meta { font-size: 11px; color: var(--text-dim); margin-left: auto; }

/* тайминг */
.timing {
  margin: 22px 0 0;
  padding: 16px;
  border: 1px solid var(--steel-3);
  border-radius: var(--r-md);
  background:
    linear-gradient(180deg, rgba(10,13,22,.6), rgba(6,9,16,.6));
}
.timing legend {
  padding: 2px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--led-red);
  text-shadow: 0 0 6px rgba(255,59,36,.6);
  border: 1px solid rgba(255,59,36,.35);
  border-radius: 4px;
  background: #0a0d16;
}
.timing-panel { margin-top: 10px; }

/* вариативность */
.variability {
  margin-top: 14px;
  border: 1px dashed var(--steel-3);
  border-radius: var(--r-sm);
  background: rgba(6,9,16,.4);
}
.variability summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--text);
  transition: color .2s;
}
.variability summary::-webkit-details-marker { display: none; }
.variability summary::before {
  content: '▸';
  color: var(--neon-orange);
  transition: transform .2s;
}
.variability[open] summary::before { transform: rotate(90deg); }
.variability-hint { font-size: 11.5px; color: var(--text-dim); font-weight: 400; }
.variability-body { padding: 4px 14px 14px; }
.variability-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--led-amber);
  font-family: var(--font-mono);
}
.variability-note:not(:empty)::before { content: '⚡ '; }

.editor-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--steel-3);
}
.launch-status { font-size: 13px; color: var(--text-dim); }
.launch-status.is-ok { color: var(--led-green); text-shadow: 0 0 8px rgba(58,255,110,.5); }
.launch-status.is-err { color: var(--led-red); text-shadow: 0 0 8px rgba(255,59,36,.5); }

/* — превью: бортовой видеоэкран — */
.constructor-preview {
  position: sticky;
  top: calc(var(--dash-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.viewscreen {
  border-radius: 14px;
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, #1b2334, #0c101d);
  box-shadow:
    inset 0 1px 0 rgba(169,190,223,.18),
    0 18px 44px -12px rgba(0,0,0,.85);
  overflow: hidden;
}
.viewscreen-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--steel-3);
}
.viewscreen-bar .led { margin-left: auto; }
.viewscreen-screen {
  position: relative;
  min-height: 380px;
  padding: 14px;
  background:
    radial-gradient(130% 100% at 50% 0%, rgba(59,232,255,.06), transparent 60%),
    #05070d;
}
/* сканлайны экрана */
.viewscreen-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.22) 2px 3px);
}
.tg-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px dashed rgba(38,50,80,.8);
}
.tg-avatar {
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #06121a;
  background: linear-gradient(160deg, var(--neon-cyan), #1798b8);
  box-shadow: 0 0 12px rgba(59,232,255,.4);
}
.tg-title { font-weight: 700; font-size: 14px; color: #eaf2ff; }
.tg-sub { font-size: 11px; color: var(--text-dim); }
.tg-feed { display: flex; flex-direction: column; }
.tg-bubble {
  position: relative;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 4px 12px 12px 12px;
  background: linear-gradient(180deg, #101a2e, #0b1322);
  border: 1px solid rgba(59,232,255,.25);
  box-shadow: 0 4px 14px rgba(0,0,0,.5), inset 0 0 18px rgba(59,232,255,.04);
}
.tg-media {
  display: block;
  width: 100%;
  border-radius: 8px;
  margin-bottom: 8px;
}
.tg-text {
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  color: #dbe7ff;
}
.tg-text a { color: var(--neon-cyan); }
.tg-meta {
  margin-top: 6px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
}
.preview-hint {
  margin: 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ─────────────────────── 13. СТАТИСТИКА КАНАЛОВ ─────────────────────── */
.stats-actions { display: flex; align-items: center; gap: 12px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}
.stats-grid .stat-card { display: flex; flex-direction: column; gap: 12px; }
.stat-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.stat-card-title { margin: 0; font-size: 16px; font-weight: 700; color: #eaf2ff; }
.stat-card-id { margin: 3px 0 0; font-size: 11px; color: var(--text-dim); }
.stat-members { display: flex; align-items: baseline; gap: 10px; }
.stat-members-num {
  font-family: var(--font-led);
  font-size: 34px;
  color: var(--led-green);
  text-shadow: 0 0 10px rgba(58,255,110,.8), 0 0 30px rgba(58,255,110,.3);
}
.stat-members-empty { color: #4b5878; text-shadow: none; }
.stat-members-label { font-size: 12px; color: var(--text-dim); }
.stat-deltas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  padding: 10px;
  background: rgba(6,9,16,.5);
  border: 1px solid rgba(38,50,80,.6);
  border-radius: var(--r-sm);
}
.stat-delta-item { display: flex; flex-direction: column; gap: 3px; }
.stat-delta-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sparkline-wrap { min-height: 60px; }
.sparkline-wrap canvas { display: block; width: 100%; }
.sparkline-empty { margin: 8px 0; font-size: 12px; color: var(--text-dim); }
.stat-updated { margin: 0; font-size: 10.5px; color: var(--text-dim); }

/* ─────────────────────── 14. ЛОГИН ─────────────────────── */
.login-body {
  display: grid;
  place-items: center;
  padding: 30px 16px;
}
.login-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  flex-wrap: wrap;
}

/* флюкс-конденсатор */
.fluxbox { text-align: center; }
.flux-svg { width: 250px; max-width: 68vw; filter: drop-shadow(0 18px 44px rgba(0,0,0,.7)); }
.fx-case {
  fill: #131a2a;
  stroke: var(--edge);
  stroke-width: 2;
}
.fx-window { fill: #05070d; stroke: #2a3550; stroke-width: 1.5; }
.fx-rivet { fill: #8fa5c9; }
.fx-hazard-band { fill: #0b0e18; stroke: #8a6a1e; stroke-width: 1; }
.fx-hazard-text {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 1.5px;
  fill: var(--led-amber);
  animation: led-breathe 2s ease-in-out infinite;
}
.fx-arm {
  stroke: var(--neon-cyan);
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(59,232,255,.9));
  animation: flux-arm 1.6s ease-in-out infinite;
}
.fx-node { fill: #0b1322; stroke: var(--chrome); stroke-width: 2.5; }
.fx-node-core {
  fill: var(--neon-cyan);
  filter: drop-shadow(0 0 7px rgba(59,232,255,1));
  animation: flux-throb 1.6s ease-in-out infinite;
}
.fx-core {
  fill: #fff;
  filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 26px var(--neon-cyan));
  animation: flux-throb 1.6s ease-in-out infinite;
}
.fx-core-glow {
  fill: rgba(59,232,255,.16);
  animation: flux-throb 1.6s ease-in-out infinite reverse;
}
.fx-spark {
  fill: #fff;
  filter: drop-shadow(0 0 6px var(--neon-cyan));
}
.fx-spark-a { animation: spark-a 1.6s linear infinite; }
.fx-spark-b { animation: spark-b 1.6s linear infinite; }
.fx-spark-c { animation: spark-c 1.6s linear infinite; }
.flux-label {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3.5px;
  color: var(--text-dim);
  animation: led-breathe 3s ease-in-out infinite;
}

.login-card {
  width: 360px;
  max-width: 94vw;
  padding: 28px 26px 22px;
  background: linear-gradient(180deg, rgba(26,35,56,.85), rgba(13,17,28,.92));
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 1px 0 rgba(169,190,223,.16),
    0 30px 70px -20px rgba(0,0,0,.9);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
  animation: panel-in .5s cubic-bezier(.2,.9,.3,1) both;
}
/* предупреждающая лента сверху карточки */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(-45deg, var(--led-amber) 0 12px, #131a2a 12px 24px);
  opacity: .85;
}
.login-head { text-align: center; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.login-logo { font-size: 34px; }
.login-sub {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-dim);
}
.login-hint {
  margin: 4px 0 0;
  text-align: center;
  font-size: 9.5px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #4b5878;
}

/* ─────────────────────── 15. ПРЫЖОК ВО ВРЕМЕНИ ─────────────────────── */
#timejump {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  visibility: hidden;
}
#timejump.is-active { visibility: visible; }
.tj-trail {
  position: absolute;
  left: -40%;
  height: 3px;
  width: 36%;
  border-radius: 3px;
  opacity: 0;
}
.tj-t1 { top: 38%; background: linear-gradient(90deg, transparent, var(--neon-orange), #fff); box-shadow: 0 0 18px var(--neon-orange); }
.tj-t2 { top: 50%; background: linear-gradient(90deg, transparent, var(--neon-cyan), #fff); box-shadow: 0 0 18px var(--neon-cyan); }
.tj-t3 { top: 62%; background: linear-gradient(90deg, transparent, var(--neon-pink), #fff); box-shadow: 0 0 18px var(--neon-pink); }
#timejump.is-active .tj-trail { animation: tj-sweep .5s cubic-bezier(.55, 0, .8, .4) both; }
#timejump.is-active .tj-t2 { animation-delay: .05s; }
#timejump.is-active .tj-t3 { animation-delay: .1s; }
.tj-flash {
  position: absolute;
  inset: 0;
  background: #eafbff;
  opacity: 0;
}
#timejump.is-active .tj-flash { animation: tj-flash .5s ease-out .28s both; }

/* ─────────────────────── 16. KEYFRAMES ─────────────────────── */
@keyframes led-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}
@keyframes led-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: .18; }
}
@keyframes flux-throb {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.88); }
}
@keyframes flux-arm {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
@keyframes fusion-shimmer {
  0%, 100% { opacity: .6; }
  50% { opacity: 1; filter: drop-shadow(0 0 6px rgba(169,190,223,.6)); }
}
@keyframes hazard-roll {
  from { background-position: 0 0; }
  to { background-position: 25.5px 0; }
}
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes body-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes plate-slam {
  0% { opacity: 0; transform: scale(1.4) rotate(-3deg); }
  60% { opacity: 1; transform: scale(.97) rotate(.6deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes value-ignite {
  0% { opacity: 0; filter: brightness(3); }
  40% { opacity: 1; }
  55% { opacity: .4; }
  70% { opacity: 1; }
  100% { filter: brightness(1); }
}
@keyframes term-line-in {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: none; }
}
@keyframes tractor {
  0%, 100% { box-shadow: inset 0 0 34px rgba(59,232,255,.15), 0 0 8px rgba(59,232,255,.4); }
  50% { box-shadow: inset 0 0 48px rgba(59,232,255,.28), 0 0 22px rgba(59,232,255,.6); }
}
@keyframes tc-flicker {
  0% { opacity: .2; }
  50% { opacity: 1; }
  75% { opacity: .4; }
  100% { opacity: 1; }
}
@keyframes tj-sweep {
  0% { left: -40%; opacity: 0; }
  15% { opacity: 1; }
  100% { left: 110%; opacity: .9; }
}
@keyframes tj-flash {
  0% { opacity: 0; }
  20% { opacity: .9; }
  100% { opacity: 0; }
}
@keyframes spark-a {
  0%   { cx: 58; cy: 62; opacity: 0; }
  10%  { opacity: 1; }
  45%  { cx: 103; cy: 112; opacity: 1; }
  55%, 100% { cx: 103; cy: 112; opacity: 0; }
}
@keyframes spark-b {
  0%   { cx: 162; cy: 62; opacity: 0; }
  10%  { opacity: 1; }
  45%  { cx: 117; cy: 112; opacity: 1; }
  55%, 100% { cx: 117; cy: 112; opacity: 0; }
}
@keyframes spark-c {
  0%   { cx: 110; cy: 186; opacity: 0; }
  10%  { opacity: 1; }
  45%  { cx: 110; cy: 126; opacity: 1; }
  55%, 100% { cx: 110; cy: 126; opacity: 0; }
}

/* ─────────────────────── 17. АДАПТИВ ─────────────────────── */
@media (max-width: 1280px) {
  .tc-caption { display: none; }
  .circuits { gap: 5px; }
}

@media (max-width: 1080px) {
  :root { --console-w: 74px; }
  .key-label, .key-code { display: none; }
  .console-key { grid-template-columns: 8px 1fr; justify-items: center; padding: 12px 8px; }
  .console-fusion { flex-direction: column; padding: 8px 4px; }
  .fusion-meta { display: none; }
  .constructor { grid-template-columns: 1fr; }
  .constructor-preview { position: static; max-width: 420px; }
}

@media (max-width: 900px) {
  .circuits { display: none; }
  .dash { gap: 12px; }
}

@media (max-width: 760px) {
  .cabin { flex-direction: column; }
  .console {
    order: 2;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    width: auto;
    flex-direction: row;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0));
    border-right: none;
    border-top: 1px solid var(--edge);
    background: linear-gradient(180deg, rgba(19,26,42,.97), rgba(8,11,20,.97));
    box-shadow: 0 -8px 30px rgba(0,0,0,.6);
  }
  .console-rail {
    flex-direction: row;
    flex: 1;
    justify-content: space-around;
    gap: 4px;
  }
  .console-key {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 8px 6px;
    border: none;
    background: transparent;
    box-shadow: none;
  }
  .console-key:hover { transform: none; }
  .key-led { display: none; }
  .console-fusion { display: none; }
  .viewport { padding: 14px 12px calc(86px + env(safe-area-inset-bottom, 0)); }
  .speedo { width: 84px; }
  .dash-status { display: none; }
  .brand-sub { display: none; }
  .eject-btn span { display: none; }
  .dash-right { margin-left: auto; }
  .panel-body { padding: 16px 14px 20px; }
  .panel-code { display: none; }
}

/* ─────────────────────── 18. REDUCED MOTION ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
  .panel-foot-scroll span { animation: none; padding-left: 0; }
  #timejump { display: none; }
  .speedo-needle { transition: none; }
}
