:root {
  --bg: #eef3f8;
  --bg-soft: #f7f9fc;
  --topbar: #0f62a9;
  --topbar-deep: #0a4d87;
  --rail: #ffffff;
  --nav-panel: #fbfcfe;
  --panel: #ffffff;
  --panel-alt: #f4f8fc;
  --border: #d8e3ef;
  --border-strong: #bdd0e4;
  --text: #223243;
  --muted: #6a7b8d;
  --primary: #0f62a9;
  --primary-soft: #e7f0fb;
  --success: #65bf52;
  --warning: #f5c244;
  --danger: #e25f64;
  --minor: #ffde4b;
  --shadow: 0 6px 24px rgba(31, 57, 84, 0.08);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  height: 100vh;
  overflow: hidden;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 52px;
  padding: 0 18px 0 22px;
  background: linear-gradient(180deg, var(--topbar), var(--topbar-deep));
  color: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.topbar-title strong {
  font-size: 17px;
  font-weight: 700;
}

.topbar-title span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

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

.topbar-pill,
.topbar-user {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
}

.topbar-user {
  background: rgba(255, 255, 255, 0.24);
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 56px 260px minmax(0, 1fr);
  height: calc(100vh - 52px);
  overflow: hidden;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 8px;
  background: var(--rail);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.rail-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.rail-item.active,
.rail-item:hover {
  background: var(--primary-soft);
  border-color: var(--border-strong);
  color: var(--primary);
}

.navigator {
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 18px;
  background: var(--nav-panel);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f7fafe);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1674c1, #0f62a9);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-text strong {
  font-size: 18px;
  line-height: 1;
}

.brand-text small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.navigator-panel {
  margin: 14px 0;
  padding: 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}

.navigator-panel strong {
  display: block;
  margin-bottom: 6px;
}

.navigator-panel p:last-child {
  margin-bottom: 0;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-home,
.nav-group a {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  border: 1px solid transparent;
}

.nav-home.active,
.nav-group a.active,
.nav-home:hover,
.nav-group a:hover {
  background: var(--primary-soft);
  border-color: var(--border-strong);
}

.nav-group h3 {
  margin: 0 0 8px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-section-copy {
  margin: 0;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.nav-group a span {
  display: block;
  font-weight: 600;
}

.nav-group a small {
  color: var(--muted);
  font-size: 11px;
}

.main-content {
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.flash {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

.flash-danger,
.flash-warning {
  border-color: #efc5c7;
}

.flash-success {
  border-color: #c8dfca;
}

.planner-header,
.filter-strip,
.kpi-grid,
.dashboard-grid,
.exception-layout,
.hero-card,
.section-card,
.workspace-grid {
  margin-bottom: 14px;
}

.planner-header,
.filter-strip,
.map-panel,
.stats-panel,
.exception-panel,
.domain-panel,
.hero-card,
.section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.planner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
}

.planner-header-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.planner-header-title strong {
  font-size: 24px;
  font-weight: 700;
}

.planner-header-title span {
  color: var(--muted);
}

.planner-header-actions {
  display: flex;
  gap: 10px;
}

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
}

.filter-chip,
.pill,
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

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

.kpi-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.kpi-head strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.kpi-head span {
  display: block;
  margin-top: 6px;
  font-weight: 600;
}

.kpi-card p {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.sparkline {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 42px;
}

.sparkline span {
  flex: 1;
  border-radius: 4px 4px 0 0;
  opacity: 0.9;
}

.sparkline-blue span {
  background: linear-gradient(180deg, #89b9ea, #dbeafb);
}

.sparkline-yellow span {
  background: linear-gradient(180deg, #f1c645, #fbefb9);
}

.sparkline-gold span {
  background: linear-gradient(180deg, #f0b94f, #fbe3a8);
}

.sparkline-red span {
  background: linear-gradient(180deg, #dc7679, #f8d4d6);
}

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

.factory-visual-section {
  padding: 12px;
}

.factory-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.factory-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.factory-blueprint {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background:
    radial-gradient(circle at 20% 18%, rgba(27, 111, 180, 0.16), transparent 18%),
    radial-gradient(circle at 80% 22%, rgba(28, 133, 112, 0.12), transparent 16%),
    linear-gradient(180deg, #0f2740 0%, #123556 100%);
}

.factory-blueprint::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(168, 208, 243, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 208, 243, 0.18) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.7;
  pointer-events: none;
}

.factory-blueprint-head,
.factory-zone-grid {
  position: relative;
  z-index: 1;
}

.factory-blueprint-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.factory-blueprint-head strong {
  display: block;
  color: #eff7ff;
  font-size: 20px;
}

.factory-blueprint-head p {
  margin: 6px 0 0;
  max-width: 720px;
  color: #dcecff;
  font-size: 12px;
}

.factory-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.factory-summary .filter-chip {
  border-color: rgba(199, 229, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
  color: #f8fcff;
}

.factory-blueprint-layout {
  display: grid;
  gap: 12px;
}

.factory-blueprint-secondary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
  gap: 12px;
}

.factory-zone {
  min-height: 150px;
  border: 1px solid rgba(199, 229, 255, 0.24);
  border-radius: 12px;
  padding: 12px;
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.factory-zone-standard {
  min-width: 0;
  max-width: none;
}

.factory-zone-blue {
  background: linear-gradient(180deg, rgba(27, 111, 180, 0.28), rgba(13, 54, 94, 0.5));
}

.factory-zone-gold {
  background: linear-gradient(180deg, rgba(179, 129, 34, 0.3), rgba(92, 64, 15, 0.45));
}

.factory-zone-red {
  background: linear-gradient(180deg, rgba(160, 67, 67, 0.28), rgba(88, 32, 32, 0.45));
}

.factory-zone-green {
  background: linear-gradient(180deg, rgba(52, 138, 92, 0.28), rgba(24, 76, 49, 0.45));
}

.factory-zone-orange {
  background: linear-gradient(180deg, rgba(194, 117, 41, 0.28), rgba(96, 55, 16, 0.45));
}

.factory-zone-teal {
  background: linear-gradient(180deg, rgba(25, 127, 138, 0.28), rgba(17, 69, 74, 0.45));
}

.factory-zone-steel {
  background: linear-gradient(180deg, rgba(95, 118, 146, 0.28), rgba(40, 56, 74, 0.45));
}

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

.factory-zone-head strong {
  display: block;
  color: #eff7ff;
  font-size: 15px;
}

.factory-zone-head p,
.factory-zone-metrics span {
  margin: 4px 0 0;
  color: #dcecff;
  font-size: 12px;
}

.factory-zone-metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}

.factory-resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.factory-zone-wide {
  min-width: 100%;
  max-width: 100%;
}

@media (max-width: 1180px) {
  .factory-blueprint-secondary {
    grid-template-columns: 1fr;
  }
}

.factory-resource-card {
  border: 1px solid rgba(199, 229, 255, 0.2);
  border-radius: 10px;
  padding: 10px;
  background: rgba(4, 14, 24, 0.56);
}

.factory-resource-card.active {
  box-shadow: inset 0 0 0 1px rgba(161, 225, 255, 0.2);
}

.factory-resource-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.factory-resource-top strong {
  display: block;
  color: #ffffff;
  font-size: 14px;
}

.factory-resource-top p {
  margin: 4px 0 0;
  color: #dcecff;
  font-size: 12px;
  line-height: 1.4;
}

.factory-resource-kpis,
.factory-resource-meta,
.factory-resource-empty {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.factory-resource-kpis span,
.factory-resource-meta span,
.factory-resource-empty span,
.mix-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f6fbff;
  font-size: 11px;
  font-weight: 600;
}

.factory-resource-meta span,
.factory-resource-empty span,
.mix-pill-muted {
  color: #e2effa;
}

.factory-item-mix {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.factory-progress-block {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(199, 229, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.factory-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.factory-progress-head strong {
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
}

.factory-progress-head span {
  color: #dcecff;
  font-size: 12px;
  font-weight: 600;
}

.factory-progress-bar {
  margin-top: 8px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.factory-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #49b0ff, #6fe29a);
}

.factory-progress-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.factory-progress-meta .progress-pill {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(220, 236, 255, 0.34);
  background: rgba(3, 10, 18, 0.9);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.35;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.factory-progress-meta .progress-pill-strong {
  background: rgba(6, 18, 31, 0.95);
  color: #fbfdff;
}

.factory-progress-meta .progress-pill-code {
  justify-content: flex-start;
  border-color: rgba(132, 191, 255, 0.46);
  background: rgba(1, 8, 16, 0.98);
  color: #eef7ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.factory-resource-alert {
  margin-top: 10px;
  color: #ffd6d6;
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-dot-run,
.status-tag-run {
  color: #5fda93;
}

.status-dot-pending,
.status-tag-pending {
  color: #f0c15d;
}

.status-dot-idle,
.status-tag-idle {
  color: #f0c15d;
}

.status-dot-done,
.status-tag-done {
  color: #86d2ff;
}

.status-dot-down,
.status-tag-down {
  color: #f47d7d;
}

.status-dot-maint,
.status-tag-maint {
  color: #7eb8ff;
}

.status-dot-unknown,
.status-tag-unknown {
  color: #bfc8d3;
}

.status-tag {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  white-space: nowrap;
  line-height: 1;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(199, 229, 255, 0.2);
}

.map-panel,
.stats-panel,
.exception-panel,
.domain-panel {
  padding: 12px;
}

.panel-title {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 700;
}

.network-board {
  position: relative;
  min-height: 350px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 20% 32%, rgba(15, 98, 169, 0.08), transparent 18%),
    radial-gradient(circle at 65% 62%, rgba(101, 191, 82, 0.08), transparent 16%),
    linear-gradient(180deg, #d9ecfb 0%, #cbe0f3 38%, #e7efe6 39%, #dce9d4 100%);
}

.network-board::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.34) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.34) 1px, transparent 1px);
  background-size: 54px 54px;
  opacity: 0.5;
}

.network-board-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 45%, rgba(114, 213, 94, 0.12), transparent 22%),
    radial-gradient(circle at 50% 70%, rgba(226, 95, 100, 0.12), transparent 18%);
}

.board-node {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -50%);
  min-width: 60px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: rgba(255, 255, 255, 0.94);
  text-align: center;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.22);
}

.board-node span {
  display: block;
  font-size: 10px;
  font-weight: 700;
}

.board-node-good {
  box-shadow: 0 0 0 8px rgba(101, 191, 82, 0.24);
}

.board-node-warn {
  box-shadow: 0 0 0 8px rgba(245, 194, 68, 0.24);
}

.board-node-danger {
  box-shadow: 0 0 0 8px rgba(226, 95, 100, 0.28);
}

.board-detail {
  position: absolute;
  top: 74px;
  left: 45%;
  z-index: 2;
  width: 250px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.board-detail strong {
  display: block;
  font-size: 18px;
}

.board-detail small,
.board-detail p {
  color: var(--muted);
}

.board-detail-link {
  color: var(--primary);
  font-weight: 700;
}

.stats-stack {
  display: grid;
  gap: 10px;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 12px auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.stats-row small {
  color: var(--muted);
}

.stats-row strong {
  display: block;
  margin-top: 2px;
}

.stats-row b {
  font-size: 22px;
  font-weight: 700;
}

.stats-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.stats-dot-critical {
  background: var(--danger);
}

.stats-dot-major {
  background: var(--warning);
}

.stats-dot-minor {
  background: var(--minor);
}

.stats-divider {
  margin: 12px 0;
  border-top: 1px solid var(--border);
}

.logic-box strong {
  display: block;
  margin-bottom: 8px;
}

.logic-box p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.exception-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 10px;
}

.domain-stack {
  display: grid;
  gap: 8px;
}

.domain-card {
  display: block;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
}

.domain-card strong {
  display: block;
  margin-bottom: 4px;
}

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

.hero-card,
.section-card {
  padding: 12px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 12px;
}

.hero-card-compact {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-card h1,
.section-card h1,
.section-card h2 {
  margin: 0;
  line-height: 1.2;
}

.hero-card h1 {
  font-size: 30px;
}

.section-card h2 {
  font-size: 22px;
}

.hero-copy,
.section-copy,
.muted-copy,
.subtle-line {
  color: var(--muted);
}

.hero-copy,
.section-copy {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.muted-copy,
.subtle-line {
  font-size: 12px;
  line-height: 1.4;
}

.hero-stats,
.table-grid,
.chain-grid,
.chain-view-stack,
.feature-grid,
.mini-grid,
.hotspot-grid,
.route-stack,
.operation-stack {
  display: grid;
  gap: 10px;
}

.hero-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card,
.table-card,
.chain-card,
.feature-card,
.route-card,
.operation-card,
.mini-card,
.capability-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
}

.stat-card strong {
  display: block;
  font-size: 28px;
}

.table-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.hotspot-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.chain-view-stack {
  gap: 12px;
}

.table-card {
  display: grid;
  gap: 8px;
}

.table-card:hover,
.domain-card:hover,
.feature-card:hover {
  border-color: var(--border-strong);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading.compact {
  margin-bottom: 10px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 14px;
}

.workbench-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}

.workbench-stack {
  display: grid;
  gap: 14px;
}

.table-stage {
  min-height: 560px;
}

.action-row,
.form-actions,
.search-form,
.checkbox-row,
.actions-col,
.pager,
.table-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-actions form {
  margin: 0;
}

.action-row form {
  margin: 0;
}

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

.inline-actions form {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.button-inline {
  min-height: 28px;
  padding: 0 10px;
}

.top-gap {
  margin-top: 10px;
}

.search-form {
  margin-bottom: 12px;
}

.search-form input {
  flex: 1;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #eaf0f6;
}

.data-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.data-table tr.is-active {
  background: #eef5fc;
}

.exception-table td {
  white-space: nowrap;
}

.exception-table td:nth-child(3),
.exception-table td:nth-child(7) {
  white-space: normal;
}

.actions-col {
  white-space: nowrap;
}

.actions-col form {
  display: inline;
  margin: 0;
}

.table-meta {
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.pager {
  justify-content: flex-end;
  margin-top: 12px;
}

.pager-state {
  min-width: 110px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.button.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.text-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.text-link.danger {
  color: var(--danger);
}

.empty-cell {
  text-align: center;
  color: var(--muted);
}

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

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field span {
  font-weight: 700;
}

.field em {
  color: var(--danger);
  font-style: normal;
  margin-left: 3px;
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 98, 169, 0.12);
}

.checkbox-row {
  justify-content: flex-start;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.checkbox-row small,
.field-error,
.inline-error {
  color: var(--muted);
  font-size: 12px;
}

.inline-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff2f2;
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(30, 44, 58, 0.42);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(24, 39, 56, 0.24);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-alt);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.chain-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.chain-card p,
.feature-index {
  margin: 0 0 6px;
  color: var(--primary);
  font-weight: 700;
}

.chain-selector select {
  max-width: 460px;
}

.route-header,
.operation-header,
.capability-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mini-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.template-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.template-card {
  display: grid;
  gap: 8px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(15, 98, 169, 0.05), rgba(15, 98, 169, 0)),
    var(--panel-alt);
}

.template-card strong,
.template-card .muted-copy,
.template-card .chip-row {
  margin: 0;
}

.template-kind {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mini-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

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

.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(15, 98, 169, 0.14);
  border-radius: 999px;
  background: rgba(15, 98, 169, 0.06);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.tag-chip.is-active {
  border-color: rgba(15, 98, 169, 0.34);
  background: rgba(15, 98, 169, 0.16);
  box-shadow: inset 0 0 0 1px rgba(15, 98, 169, 0.12);
}

.template-detail-list {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.template-detail-list p {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(16, 29, 44, 0.04);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.detail-block + .detail-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.detail-block strong {
  display: block;
  margin-bottom: 6px;
}

.capability-card + .capability-card {
  margin-top: 8px;
}

.timeline-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.timeline-head {
  position: relative;
  height: 42px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fbfe, #eef5fb);
}

.timeline-head span {
  position: absolute;
  top: 12px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.timeline-body {
  display: grid;
}

.timeline-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 180px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #eaf0f6;
}

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

.timeline-row.is-impacted {
  background: linear-gradient(90deg, rgba(15, 98, 169, 0.05), rgba(15, 98, 169, 0));
}

.timeline-meta strong,
.timeline-meta small,
.timeline-note {
  display: block;
}

.timeline-meta small,
.timeline-note {
  color: var(--muted);
  font-size: 12px;
}

.timeline-track {
  position: relative;
  height: 34px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(15, 98, 169, 0.06) 1px, transparent 1px),
    #f4f8fc;
  background-size: 12.5% 100%;
  border: 1px solid var(--border);
}

.timeline-bar {
  position: absolute;
  top: 4px;
  bottom: 4px;
  min-width: 44px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1f7bca, #0f62a9);
  box-shadow: 0 4px 10px rgba(15, 98, 169, 0.24);
}

.timeline-bar.is-low {
  background: linear-gradient(90deg, #4b90cb, #2276bf);
}

.timeline-bar.is-medium {
  background: linear-gradient(90deg, #efb933, #d89400);
  box-shadow: 0 4px 10px rgba(216, 148, 0, 0.22);
}

.timeline-bar.is-high {
  background: linear-gradient(90deg, #e46f52, #d94841);
  box-shadow: 0 4px 10px rgba(217, 72, 65, 0.22);
}

.timeline-bar span {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 12px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-critical,
.pill-danger,
.pill-error {
  background: #fff0f1;
  border-color: #f3c5c8;
  color: #c04f55;
}

.pill-major,
.pill-warning {
  background: #fff8e7;
  border-color: #f5df9a;
  color: #946f08;
}

.pill-minor {
  background: #fffce3;
  border-color: #efe08b;
  color: #8b7a10;
}

.pill-success,
.pill-info {
  background: #edf9eb;
  border-color: #c5e6c0;
  color: #407e34;
}

.hotspot-card {
  background:
    linear-gradient(180deg, rgba(15, 98, 169, 0.05), rgba(15, 98, 169, 0)),
    var(--panel-alt);
}

.scope-template-card {
  display: grid;
  gap: 8px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(101, 191, 82, 0.08), rgba(101, 191, 82, 0)),
    var(--panel-alt);
}

.stability-card {
  background:
    linear-gradient(180deg, rgba(245, 194, 68, 0.10), rgba(245, 194, 68, 0)),
    var(--panel-alt);
}

.recommendation-card {
  display: grid;
  gap: 8px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(15, 98, 169, 0.08), rgba(15, 98, 169, 0)),
    var(--panel-alt);
}

.chain-segment {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(320px, 1.2fr) minmax(220px, 0.9fr);
  gap: 12px;
  align-items: stretch;
}

.chain-segment.is-anchor .chain-link-card {
  border-color: #f0b3b6;
  box-shadow: 0 8px 18px rgba(226, 95, 100, 0.10);
}

.chain-node,
.chain-link-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.chain-node {
  background: var(--panel-alt);
}

.chain-node h3,
.chain-link-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.chain-link-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(15, 98, 169, 0.05), rgba(15, 98, 169, 0)),
    #fff;
}

.chain-link-card::before,
.chain-link-card::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  height: 2px;
  background: var(--border-strong);
}

.chain-link-card::before {
  left: -18px;
}

.chain-link-card::after {
  right: -18px;
}

.chain-link-head,
.chain-context-list {
  display: grid;
  gap: 8px;
}

.chain-context-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.operation-row.is-impacted td {
  background: rgba(15, 98, 169, 0.03);
}

.operation-row.is-impacted.impact-high td {
  background: rgba(226, 95, 100, 0.08);
}

.operation-row.is-impacted.impact-medium td {
  background: rgba(245, 194, 68, 0.10);
}

.operation-row.is-impacted.impact-low td {
  background: rgba(15, 98, 169, 0.05);
}

.queue-panel {
  display: grid;
  align-content: start;
}

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

.queue-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-alt);
}

.queue-actions {
  align-items: flex-end;
}

.queue-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-alt);
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.queue-item:hover,
.queue-item.is-active {
  border-color: var(--border-strong);
  box-shadow: 0 8px 18px rgba(25, 66, 109, 0.08);
  transform: translateY(-1px);
}

.queue-item.is-active {
  background:
    linear-gradient(180deg, rgba(15, 98, 169, 0.06), rgba(15, 98, 169, 0)),
    var(--panel-alt);
}

.queue-item-top,
.queue-item-meta,
.queue-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.queue-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.queue-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.queue-check input {
  width: auto;
}

.queue-item-top strong {
  font-size: 15px;
}

.queue-item-meta,
.queue-item-foot,
.queue-item-copy {
  color: var(--muted);
  font-size: 12px;
}

.queue-item-copy {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 1360px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .exception-layout,
  .workbench-grid,
  .workspace-grid,
  .chain-segment,
  .hero-card,
  .factory-blueprint-layout {
    grid-template-columns: 1fr;
  }

  .chain-link-card::before,
  .chain-link-card::after {
    display: none;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 56px 220px minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail,
  .navigator {
    display: none;
  }

  .main-content {
    overflow-y: auto;
    padding: 12px;
  }

  .kpi-grid,
  .mini-grid,
  .mini-grid.three-columns,
  .hero-stats,
  .table-grid,
  .chain-grid,
  .factory-zone-grid {
    grid-template-columns: 1fr;
  }

  .planner-header,
  .section-heading,
  .search-form,
  .form-actions,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

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