@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Spline+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #0f111a;
  --bg-alt: #151926;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.14);
  --accent: #ffb703;
  --accent-2: #00b4d8;
  --text: #f6f6f6;
  --muted: rgba(255, 255, 255, 0.65);
  --border: rgba(255, 255, 255, 0.12);
  --table-head: #242b3d;
  --success: #3ecf8e;
  --warn: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Spline Sans", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #1f2242 0%, var(--bg) 50%, #0b0d14 100%);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  z-index: 0;
}

.orb-1 {
  top: -120px;
  right: -120px;
  background: rgba(255, 183, 3, 0.6);
}

.orb-2 {
  bottom: -160px;
  left: -160px;
  background: rgba(0, 180, 216, 0.5);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.25;
  z-index: 0;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 6vw 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffb703, #fb5607);
  box-shadow: 0 10px 30px rgba(255, 183, 3, 0.35);
}

.brand-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 10px;
}

.nav-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-btn.is-active,
.nav-btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.08);
}

.is-hidden {
  display: none;
}

.shell {
  position: relative;
  z-index: 2;
  padding: 20px 6vw 80px;
}

.view {
  display: none;
  animation: fadeIn 0.5s ease forwards;
}

.view.is-active {
  display: block;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.hero h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.2rem;
  margin: 0 0 8px;
}

.hero p {
  color: var(--muted);
  max-width: 560px;
  margin: 0;
}

.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.export-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.meta-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta-chip {
  padding: 8px 14px;
  background: var(--card);
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.meta-chip.is-active {
  border-color: rgba(62, 207, 142, 0.6);
  background: rgba(62, 207, 142, 0.18);
  color: var(--text);
}

.meta-btn {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* Stats grid columns are controlled by .stats-grid.cols-* below. */

.stack-cards {
  display: grid;
  gap: 2px;
}

.stack-cards .card {
  margin-bottom: 4px;
}

.stack-cards .card:last-child {
  margin-bottom: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.card h2,
.card h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.module-badge {
  margin-left: 8px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f4d98a;
  opacity: 0.85;
}

.modules {
  grid-column: span 2;
}

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

.module-header-text {
  display: grid;
  gap: 6px;
}

.module-header-text h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.module-count {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
}

.module-name-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.module-name-filter-fields {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.module-name-filter-fields.is-hidden {
  display: none;
}

.filter-chip-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 180, 216, 0.18);
  border: 1px solid rgba(0, 180, 216, 0.35);
  color: var(--text);
  font-size: 0.74rem;
}

.filter-chip button {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
}

.filter-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.module-name-filter-fields input {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 0.8rem;
  min-width: 220px;
  padding-right: 34px;
}

.filter-clear-btn {
  position: absolute;
  right: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--text);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.module-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.module-run-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-basis: 100%;
  justify-content: flex-end;
}

.module-run-actions .primary-btn,
.module-run-actions .ghost-btn,
.module-run-actions .danger-btn,
.module-run-actions .stop-btn {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.danger-btn {
  border: 1px solid rgba(255, 99, 99, 0.4);
  background: rgba(255, 99, 99, 0.18);
  color: #ffd2d2;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.danger-btn:hover {
  background: rgba(255, 99, 99, 0.28);
  border-color: rgba(255, 99, 99, 0.55);
}

.stop-btn.danger-btn {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.18);
  color: #ffe4bf;
}

.stop-btn.danger-btn:hover {
  background: rgba(245, 158, 11, 0.3);
  border-color: rgba(245, 158, 11, 0.55);
}

.layout-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  gap: 4px;
}

.filter-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  gap: 4px;
}

.filter-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.filter-btn.is-active {
  background: rgba(62, 207, 142, 0.25);
  color: var(--text);
}

.layout-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.layout-btn.is-active {
  background: rgba(255, 183, 3, 0.2);
  color: var(--text);
}

.stats-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 18px;
}

.stats-filter-switch {
  margin-right: 12px;
}

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

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

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

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

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.module-list {
  display: grid;
  gap: 14px;
}

.module-list.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.module-list.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

@media (max-width: 1200px) {
  .module-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .module-list {
    grid-template-columns: 1fr;
  }
}

.module-card {
  cursor: grab;
}

.module-card.is-dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.module-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.module-actions .muted {
  font-size: 0.85rem;
}

.param-editor {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.param-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.param-help {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: var(--muted);
  margin: -2px 0 6px;
}

.param-row input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 0.85rem;
}

.param-save {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.8rem;
}

.toggle {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.toggle-body {
  flex: 1;
}

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

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

.toggle-title-wrap {
  display: grid;
  gap: 4px;
}

.collapse-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
}

.is-collapsed .param-editor {
  display: none;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
}

.toggle-switch input {
  display: none;
}

.toggle-switch .toggle-ui {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  position: relative;
  transition: background 0.2s ease;
}

.toggle-switch .toggle-ui::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-ui {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-ui::after {
  transform: translateX(18px);
}

.module-switch-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 50px;
}

.module-refresh-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.module-refresh-btn .refresh-icon {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
}

.module-refresh-btn.is-ready {
  border-color: rgba(64, 207, 133, 0.65);
  color: rgba(118, 255, 184, 0.9);
  background: rgba(64, 207, 133, 0.18);
}

.module-refresh-btn.is-running {
  border-color: rgba(255, 184, 3, 0.7);
  color: rgba(255, 214, 102, 0.95);
  background: rgba(255, 184, 3, 0.2);
  animation: refresh-pulse 1.1s ease-in-out infinite;
}

.module-refresh-btn.is-running .refresh-icon {
  animation: refresh-spin 0.9s linear infinite;
}

.module-refresh-btn.is-error {
  border-color: rgba(255, 107, 107, 0.7);
  color: rgba(255, 145, 145, 0.95);
  background: rgba(255, 107, 107, 0.2);
}

.module-refresh-btn:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.module-refresh-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

@keyframes refresh-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes refresh-pulse {
  0% {
    box-shadow: 0 0 0 rgba(255, 184, 3, 0.0);
  }
  50% {
    box-shadow: 0 0 14px rgba(255, 184, 3, 0.45);
  }
  100% {
    box-shadow: 0 0 0 rgba(255, 184, 3, 0.0);
  }
}

.stats-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.stats-toggle.toggle-switch .toggle-ui {
  width: 34px;
  height: 20px;
}

.stats-toggle.toggle-switch .toggle-ui::after {
  width: 14px;
  height: 14px;
  top: 3px;
  left: 3px;
}

.stats-toggle.toggle-switch input:checked + .toggle-ui::after {
  transform: translateX(14px);
}

.stats-toggle.toggle-switch input:checked + .toggle-ui {
  background: rgba(255, 183, 3, 0.6);
}

.stats-toggle-text {
  white-space: nowrap;
}

.toggle-title {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.param-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.param-tag {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: hsla(var(--tag-hue, 210), 70%, 40%, 0.22);
  border: 1px solid hsla(var(--tag-hue, 210), 75%, 55%, 0.45);
  color: var(--text);
}

.param-tag.is-active {
  box-shadow: inset 0 0 0 1px rgba(62, 207, 142, 0.75), 0 0 10px rgba(62, 207, 142, 0.2);
}

.param-tag.is-inactive {
  color: var(--muted);
  opacity: 0.7;
}

.empty-state {
  margin-top: 12px;
  color: var(--muted);
}

.placeholder {
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  color: var(--muted);
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.2rem;
}

.prediction .numbers {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.prediction .numbers.small {
  gap: 6px;
  margin: 10px 0 6px;
}

.number-pill {
  background: rgba(255, 255, 255, 0.12);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.prediction .numbers.small .number-pill {
  padding: 6px 10px;
  font-size: 0.82rem;
}

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

.numbers.inline .number-pill {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 600;
}

.pill.updated {
  background: rgba(255, 199, 102, 0.22);
  color: #ffe7ba;
}

.pill.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--muted);
}

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

.partial-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffe7ba;
  background: rgba(255, 199, 102, 0.22);
  border: 1px solid rgba(255, 199, 102, 0.25);
}

.updated-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ffe7ba;
  background: rgba(255, 199, 102, 0.22);
  border: 1px solid rgba(255, 199, 102, 0.25);
  margin-left: 8px;
}

.fusion-block {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 6px;
}

.fusion-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.card-foot {
  color: var(--muted);
  font-size: 0.85rem;
}

.table-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table-card + .table-card {
  margin-top: 20px;
}

.table-card th,
.table-card td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
}

.quick-stats-table th {
  text-align: left;
}

.quick-stats-table th,
.quick-stats-table td {
  text-align: left;
}

.quick-stats-table th.sortable {
  cursor: pointer;
}

.quick-stats-table th.sortable.is-active {
  color: var(--text);
}

.quick-stats-table th.sortable::after {
  content: "▲▼";
  position: static;
  margin-left: 6px;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  opacity: 0.45;
}

.quick-stats-table th.sortable.sort-asc::after,
.quick-stats-table th.sortable.sort-desc::after {
  opacity: 0.85;
  color: var(--accent);
}

.quick-stats-table th.sortable.sort-asc::after {
  content: "▲";
}

.quick-stats-table th.sortable.sort-desc::after {
  content: "▼";
}

.quick-stats-table th:nth-child(1),
.quick-stats-table td:nth-child(1) {
  width: 16%;
}

.quick-stats-table th:nth-child(2),
.quick-stats-table td:nth-child(2) {
  width: 18%;
}

.quick-stats-table th:nth-child(3),
.quick-stats-table td:nth-child(3) {
  width: 28%;
}

.quick-stats-table th:nth-child(4),
.quick-stats-table td:nth-child(4) {
  width: 12%;
}

.quick-stats-table th:nth-child(5),
.quick-stats-table td:nth-child(5) {
  width: 10%;
}

.quick-stats-table th:nth-child(6),
.quick-stats-table td:nth-child(6) {
  width: 8%;
}

.quick-stats-table th:nth-child(7),
.quick-stats-table td:nth-child(7) {
  width: 8%;
}

.quick-stats-table th:last-child,
.quick-stats-table td:last-child {
  text-align: center;
}

.table-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.status.ok {
  background: rgba(62, 207, 142, 0.2);
  color: var(--success);
}

.status.warn {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warn);
}

.status.off {
  background: rgba(148, 163, 184, 0.2);
  color: rgba(148, 163, 184, 0.9);
}

.login-card {
  max-width: 420px;
  display: grid;
  gap: 14px;
}

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

.field input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}

.field select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  appearance: none;
  color-scheme: dark;
}

.field select option {
  background: #0f141c;
  color: var(--text);
}

.primary-btn {
  background: var(--accent);
  border: none;
  color: #0b0d14;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(247, 154, 0, 0.22);
  filter: brightness(1.05);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

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


.form-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.form-error {
  color: #ff6b6b;
  min-height: 20px;
}

.chart .bars {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.mini-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.85rem;
}

.mini-table-grid {
  display: grid;
  gap: 16px;
  margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.mini-table-stack {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.mini-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 4px;
}

.mini-table th,
.mini-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.mini-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--table-head);
  background-clip: padding-box;
}

.mini-table-wrap {
  max-height: 260px;
  overflow: auto;
  position: relative;
  margin-top: 12px;
  scrollbar-gutter: stable;
}

.stat-bridge-actions {
  position: absolute;
  top: 18px;
  right: 20px;
  display: flex;
  justify-content: flex-end;
  margin: 0;
  z-index: 2;
}

.stat-bridge-import {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(92, 127, 255, 0.2);
  color: #e6ecff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: background 0.2s ease, border 0.2s ease;
}

.stat-bridge-import:hover {
  background: rgba(92, 127, 255, 0.32);
  border-color: rgba(92, 127, 255, 0.45);
}

.table-bridge-controls {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 6px;
}

.table-bridge-reset {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 183, 77, 0.15);
  color: #ffe8c2;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s ease, border 0.2s ease;
}

.table-bridge-reset:hover {
  background: rgba(255, 183, 77, 0.25);
  border-color: rgba(255, 183, 77, 0.4);
}

.mini-table .stat-bridge-row {
  cursor: pointer;
}

.mini-table .stat-bridge-row.is-param-active td {
  background: rgba(255, 255, 255, 0.06);
}

.mini-table .stat-bridge-row.is-selected td {
  background: rgba(93, 201, 255, 0.2);
}

.mini-table-wrap::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.mini-table-wrap {
  scrollbar-width: none;
}

.mini-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 2px 0 var(--border);
}

.mini-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.mini-table th.sortable::after {
  content: "↕";
  font-size: 0.65rem;
  margin-left: 6px;
  opacity: 0.5;
}

.mini-table th.sortable.is-active {
  color: var(--text);
}

.mini-table th.sortable.sort-asc::after {
  content: "▲";
  opacity: 0.9;
}

.mini-table th.sortable.sort-desc::after {
  content: "▼";
  opacity: 0.9;
}

.sum-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 6px;
  align-items: end;
  gap: 2px;
  height: 140px;
  padding: 8px 0;
  overflow-x: auto;
}

.sum-bar {
  width: 6px;
  border-radius: 6px 6px 0 0;
  background: rgba(0, 180, 216, 0.65);
}

.sum-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 8px;
}

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

.sestina-card {
  min-width: 320px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.sestina-card .card-head {
  margin-bottom: 6px;
}

.sestina-card .numbers {
  margin: 8px 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.sestina-card .numbers.small {
  margin: 6px 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.sestina-card .card-foot {
  font-size: 0.78rem;
}

.filter-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
}

.filter-row input[type="checkbox"] {
  accent-color: var(--accent-2);
}

.row-highlight td {
  background: rgba(255, 183, 3, 0.12);
}

.history-hits {
  margin-top: 12px;
}

.history-hit-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

.history-hit-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.history-hit-id {
  font-weight: 600;
  color: var(--text);
}

.parity-chart {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.parity-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
}

.parity-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.parity-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
}

.parity-fill {
  height: 100%;
  width: var(--v);
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.parity-value {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
  min-width: 72px;
}

.bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--v);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.bar span {
  position: absolute;
  right: 8px;
  top: -24px;
  font-size: 0.8rem;
}

.line {
  height: 120px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.2), rgba(0, 180, 216, 0.2));
  border: 1px dashed var(--border);
}

.legend {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.dot.ok {
  background: var(--success);
}

.dot.warn {
  background: var(--warn);
}

.dot.off {
  background: #6c757d;
}

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

.stack-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stack-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
}

.stack-bar.ok {
  background: rgba(62, 207, 142, 0.4);
}

.stack-bar.warn {
  background: rgba(245, 158, 11, 0.4);
}

.stack-bar.off {
  background: rgba(108, 117, 125, 0.4);
}

.legend-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.code {
  background: rgba(0, 0, 0, 0.3);
}

.code pre {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text);
}

.muted {
  color: var(--muted);
}

.meta-params {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.85;
}

.stat-meta-line {
  margin: 6px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.stat-meta-label {
  font-weight: 600;
  margin-right: 6px;
  color: rgba(255, 255, 255, 0.75);
}

.stat-meta-small {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.52);
  opacity: 1;
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.5s ease;
}

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

.report-grid .report-card {
  grid-column: auto;
}

.report-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.export-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
}

.export-actions .meta-btn:hover {
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.15);
}

.export-menu {
  position: absolute;
  left: 0;
  top: 42px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(15, 18, 26, 0.95);
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 5;
}

.export-menu.is-hidden {
  display: none;
}

.export-menu-btn {
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.export-menu-btn:hover {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.18);
}

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.report-select {
  min-width: 220px;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.kv-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kv span {
  color: var(--muted);
}

.kv strong {
  color: var(--text);
  font-weight: 600;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--metric-accent, rgba(255, 255, 255, 0.2));
  color: var(--text);
}

.metric-row.is-match {
  background: rgba(62, 207, 142, 0.18);
  border-color: rgba(62, 207, 142, 0.35);
}

.metric-row.is-mismatch {
  background: rgba(255, 112, 87, 0.16);
  border-color: rgba(255, 112, 87, 0.35);
}

.metric-row.is-out {
  box-shadow: 0 0 0 1px rgba(255, 195, 74, 0.35) inset;
}

.metric-label {
  font-weight: 600;
}

.metric-value {
  color: var(--text);
}

.metric-sum {
  --metric-accent: #fbbf24;
}

.metric-parity {
  --metric-accent: #60a5fa;
}

.metric-gap {
  --metric-accent: #f87171;
}

.metric-righe {
  --metric-accent: #94a3b8;
}

.metric-quadrant {
  --metric-accent: #34d399;
}

.metric-fr {
  --metric-accent: #a78bfa;
}

.metric-border {
  --metric-accent: #fb923c;
}

.metric-band {
  --metric-accent: #38bdf8;
}

.metric-cluster {
  --metric-accent: #22d3ee;
}

.metric-len {
  --metric-accent: #f472b6;
}

.metric-neutral {
  --metric-accent: #94a3b8;
}

.module-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.module-pill.metric-sum,
.module-pill.metric-parity,
.module-pill.metric-gap,
.module-pill.metric-righe,
.module-pill.metric-quadrant,
.module-pill.metric-fr,
.module-pill.metric-border,
.module-pill.metric-band,
.module-pill.metric-cluster,
.module-pill.metric-len,
.module-pill.metric-neutral {
  background: color-mix(in srgb, var(--metric-accent, #94a3b8) 22%, rgba(0, 0, 0, 0.3));
  border-color: color-mix(in srgb, var(--metric-accent, #94a3b8) 45%, rgba(0, 0, 0, 0.4));
}

.coord-hit td {
  background: rgba(62, 207, 142, 0.12);
}

.coord-num.coord-hit {
  color: #8bf0c6;
  font-weight: 700;
}

.report-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.ai-tables {
  grid-template-columns: 1fr;
  margin-top: 12px;
  gap: 16px;
}

.ai-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-actions {
  margin-top: 0;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
}

.ai-action-btn {
  padding: 6px 14px;
  font-size: 0.82rem;
  background: rgba(125, 211, 252, 0.18);
  border-color: rgba(125, 211, 252, 0.35);
  color: #e0f2fe;
}

.ai-action-btn:hover {
  background: rgba(125, 211, 252, 0.28);
  border-color: rgba(125, 211, 252, 0.55);
  color: #f8fafc;
}

.ai-status {
  font-size: 0.75rem;
  min-height: 1rem;
}

.ai-desc {
  font-size: 0.8rem;
  margin-top: 6px;
}

.ai-sub {
  font-size: 0.75rem;
  margin-top: 6px;
  opacity: 0.85;
}

.ai-tables {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.ai-header-actions {
  justify-content: flex-end;
}

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

.ai-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

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

@media (max-width: 1200px) {
  .ai-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .ai-grid {
    grid-template-columns: 1fr;
  }
}

.ai-note {
  margin-top: 18px;
}

.ai-predict-block {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 16px;
}

.ai-predict-block h4 {
  margin-bottom: 6px;
}

.ai-form {
  margin-top: 16px;
}

.ai-form + .ai-note {
  margin-top: 18px;
}

.ai-block {
  margin-top: 18px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-block-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.ai-block h4 {
  margin-bottom: 4px;
}

.divider-line {
  height: 1px;
  width: 100%;
  margin: 16px 0;
  background: rgba(255, 255, 255, 0.08);
}

.report-bottom {
  display: grid;
  grid-template-columns: minmax(320px, 2fr) minmax(260px, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.report-backtest {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

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

.id-list {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}

.report-suggestions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.report-suggestions li {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.report-summary-strong {
  font-weight: 700;
  color: var(--accent);
}

.match-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(62, 207, 142, 0.2);
  color: var(--text);
}

.match-pill.off {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

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

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .hero {
    flex-direction: column;
  }

  .modules {
    grid-column: span 1;
  }
}
