:root {
  --bg: #11162f;
  --bg-strong: #0c1125;
  --panel: #1a2146;
  --panel-alt: #20295a;
  --panel-border: rgba(101, 118, 201, 0.2);
  --text: #f4f7ff;
  --muted: #9aa5d1;
  --accent: #14c8c3;
  --accent-strong: #09a9a4;
  --accent-soft: rgba(20, 200, 195, 0.14);
  --blue-soft: rgba(65, 128, 255, 0.14);
  --violet-soft: rgba(171, 84, 255, 0.14);
  --orange-soft: rgba(255, 170, 48, 0.14);
  --green-soft: rgba(15, 232, 126, 0.14);
  --danger-soft: rgba(255, 99, 132, 0.16);
  --shadow: 0 26px 52px rgba(3, 8, 24, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(20, 200, 195, 0.18), transparent 28%),
    radial-gradient(circle at right center, rgba(82, 109, 255, 0.16), transparent 32%),
    linear-gradient(180deg, #131938 0%, var(--bg) 48%, var(--bg-strong) 100%);
}

.flag-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(104, 121, 196, 0.18);
  border-radius: 14px;
  background: rgba(11, 18, 44, 0.82);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
}

.flag-button.is-active {
  border-color: rgba(20, 200, 195, 0.4);
  background: rgba(20, 200, 195, 0.12);
}

.shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.hero-card {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-radius: 28px;
  border: 1px solid rgba(34, 226, 214, 0.18);
  background:
    radial-gradient(circle at left bottom, rgba(255, 255, 255, 0.06), transparent 20%),
    radial-gradient(circle at right top, rgba(255, 255, 255, 0.1), transparent 18%),
    linear-gradient(135deg, #0d847f 0%, #129890 48%, #0f7f92 100%);
  box-shadow: var(--shadow);
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.layout {
  display: grid;
  gap: 20px;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(33, 42, 88, 0.96), rgba(23, 31, 69, 0.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.controls-panel,
.detail-panel {
  padding: 24px;
}

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

.panel-eyebrow,
.panel-title {
  margin: 0;
}

.panel-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.panel-title {
  margin-top: 8px;
  font-size: 1.32rem;
}

.panel-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  color: var(--accent);
  background: rgba(11, 28, 58, 0.74);
  border: 1px solid rgba(20, 200, 195, 0.18);
  font-weight: 700;
}

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

.toggle-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.toggle-chip {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(104, 121, 196, 0.18);
  border-radius: 999px;
  background: rgba(12, 18, 44, 0.8);
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.toggle-chip.is-active {
  color: var(--text);
  border-color: rgba(20, 200, 195, 0.36);
  background: rgba(20, 200, 195, 0.12);
}

.field-group {
  display: grid;
}

.field-label {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #dbe1ff;
}

.search-input,
.select-input {
  width: 100%;
  padding: 18px 20px;
  border: 1px solid rgba(103, 121, 205, 0.22);
  border-radius: 18px;
  font-size: 1rem;
  color: var(--text);
  background: rgba(10, 17, 40, 0.82);
  outline: none;
}

.search-input {
  margin-bottom: 0;
}

.search-input:focus,
.select-input:focus {
  border-color: rgba(20, 200, 195, 0.56);
  box-shadow: 0 0 0 4px rgba(20, 200, 195, 0.12);
}

.meta-row {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--muted);
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(12, 18, 44, 0.8);
  border: 1px solid rgba(104, 121, 196, 0.18);
}

.meta-chip--ghost:empty {
  display: none;
}

.line-detail {
  min-height: 280px;
}

.empty-state {
  padding: 28px;
  border-radius: 20px;
  border: 1px dashed rgba(109, 126, 208, 0.22);
  color: var(--muted);
  background: rgba(12, 17, 40, 0.62);
}

.line-card {
  display: grid;
  gap: 20px;
}

.line-head {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: start;
}

.line-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #74fffb;
  background: rgba(20, 200, 195, 0.12);
  border: 1px solid rgba(20, 200, 195, 0.18);
}

.line-title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.line-subtitle {
  margin: 10px 0 0;
  max-width: 48rem;
  line-height: 1.6;
  color: var(--muted);
}

.line-meta-inline {
  margin: 10px 0 0;
  color: #86fffb;
  font-weight: 700;
}

.line-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #eff3ff;
  background: rgba(8, 15, 37, 0.86);
  border: 1px solid rgba(100, 118, 205, 0.16);
}

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

.info-block {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(96, 113, 196, 0.18);
  background: rgba(13, 19, 44, 0.88);
}

.info-block--stations {
  border-color: rgba(74, 138, 255, 0.26);
}

.info-block--crossings {
  border-color: rgba(64, 205, 124, 0.28);
}

.info-block--km {
  border-color: rgba(157, 93, 255, 0.26);
}

.info-block--etcs {
  border-color: rgba(24, 226, 125, 0.26);
}

.info-block--switches {
  border-color: rgba(255, 170, 48, 0.26);
}

.info-block--live {
  border-color: rgba(20, 200, 195, 0.24);
}

.info-block--context {
  border-color: rgba(20, 200, 195, 0.24);
}

.info-block--full {
  grid-column: 1 / -1;
}

.info-block h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.timeline,
.bullet-list {
  margin: 0;
  padding: 0;
}

.timeline {
  list-style: none;
  display: grid;
  gap: 12px;
}

.timeline li,
.bullet-list li {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(22, 30, 68, 0.92);
  border: 1px solid rgba(103, 121, 201, 0.14);
}

.timeline li {
  position: relative;
  padding-left: 20px;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #54b6ff;
}

.bullet-list {
  list-style: none;
  display: grid;
  gap: 12px;
}

.item-title {
  margin: 0;
  font-weight: 700;
}

.item-meta,
.item-copy {
  margin: 6px 0 0;
  line-height: 1.55;
  color: var(--muted);
}

.severity {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffd575;
  background: var(--orange-soft);
}

@media (max-width: 860px) {
  .topbar-inner,
  .hero-card,
  .panel-head,
  .line-head,
  .line-stats {
    display: grid;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}
