:root {
  --bg: #05060a;
  --bg-2: #080a10;
  --panel: rgba(255, 255, 255, 0.025);
  --panel-solid: #0b0d13;
  --line: rgba(255, 255, 255, 0.07);
  --line-soft: rgba(255, 255, 255, 0.04);
  --text: #e9ecf4;
  --muted: #8f98ad;
  --muted-2: #69738a;
  --accent: #35e0c8;
  --accent-2: #6c7dff;
  --amber: #f6b73c;
  --danger: #ff5c6e;
  --good: #3ddc97;
  --radius: 18px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── háttér ─────────────────────────────────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 85%);
  pointer-events: none;
  z-index: 0;
}
.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}
.glow.g1 { width: 620px; height: 620px; top: -280px; left: -120px; background: radial-gradient(circle, rgba(53, 224, 200, 0.28), transparent 65%); }
.glow.g2 { width: 560px; height: 560px; top: -220px; right: -140px; background: radial-gradient(circle, rgba(108, 125, 255, 0.22), transparent 65%); }

/* ── topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 34px 18px;
  max-width: 1560px;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(140deg, rgba(53, 224, 200, 0.9), rgba(108, 125, 255, 0.85));
  display: grid; place-items: center;
  color: #06121a;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.5px;
  box-shadow: 0 8px 26px -8px rgba(53, 224, 200, 0.6);
}
.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.brand h1 span { color: var(--accent); }
.brand p {
  margin: 2px 0 0;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  backdrop-filter: blur(10px);
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.16);
}
.pill.stale .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(246, 183, 60, 0.16); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: 0.16s ease;
  font-family: inherit;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.accent {
  background: linear-gradient(140deg, rgba(53, 224, 200, 0.16), rgba(108, 125, 255, 0.16));
  border-color: rgba(53, 224, 200, 0.35);
  color: #d6fff8;
}
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn .spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── layout ─────────────────────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 34px 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
}

/* ── regime band ────────────────────────────────────────────────────────── */
.regime {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 26px;
  padding: 24px 28px;
  align-items: center;
}
.regime-right { text-align: right; }

.regime-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.regime-state {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
}
.regime-state .beacon {
  width: 12px; height: 12px; border-radius: 50%;
  position: relative;
  flex: none;
}
.regime-state .beacon::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.5;
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.7); opacity: 0.65; }
  100% { transform: scale(1.9); opacity: 0; }
}
.regime[data-code="on"] .regime-state { color: var(--good); }
.regime[data-code="neutral"] .regime-state { color: var(--amber); }
.regime[data-code="off"] .regime-state { color: var(--danger); }

.regime-drivers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.driver {
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--mono);
}
.driver.pos { color: #9df0d6; border-color: rgba(61, 220, 151, 0.24); background: rgba(61, 220, 151, 0.07); }
.driver.neg { color: #ffc4a8; border-color: rgba(246, 183, 60, 0.24); background: rgba(246, 183, 60, 0.07); }
.driver.bad { color: #ffb3bb; border-color: rgba(255, 92, 110, 0.26); background: rgba(255, 92, 110, 0.08); }

.divergence {
  margin-top: 12px;
  font-size: 12px;
  color: #ffd9a0;
  background: rgba(246, 183, 60, 0.09);
  border: 1px solid rgba(246, 183, 60, 0.28);
  padding: 8px 12px;
  border-radius: 10px;
}

.score-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.score-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.score-bar {
  width: 100%;
  min-width: 210px;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  position: relative;
  overflow: hidden;
}
.score-bar::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: rgba(255, 255, 255, 0.35);
}
.score-bar i {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 99px;
  transition: 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── KPI ────────────────────────────────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.kpi {
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 132px;
}
.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.kpi-name {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}
.kpi-tag {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.kpi-tag.ok { color: #9df0d6; border-color: rgba(61, 220, 151, 0.3); background: rgba(61, 220, 151, 0.08); }
.kpi-tag.warn { color: #ffd9a0; border-color: rgba(246, 183, 60, 0.32); background: rgba(246, 183, 60, 0.09); }
.kpi-tag.bad { color: #ffb3bb; border-color: rgba(255, 92, 110, 0.34); background: rgba(255, 92, 110, 0.1); }
.kpi-tag.bad.pulse { animation: badgePulse 1.9s ease-in-out infinite; }
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 92, 110, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(255, 92, 110, 0); }
}

.kpi-value {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-family: var(--mono);
  font-size: 33px;
  font-weight: 600;
  letter-spacing: -1.2px;
  line-height: 1;
}
.kpi-value small { font-size: 14px; color: var(--muted-2); letter-spacing: 0; font-weight: 500; }
.kpi-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.chg.up { color: var(--good); }
.chg.down { color: var(--danger); }
.chg.flat { color: var(--muted); }
.spark { height: 34px; margin-top: auto; }

/* ── chart cards ────────────────────────────────────────────────────────── */
.chart-card { padding: 18px 20px 12px; }
.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.card-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #cfd6e6;
  display: flex;
  align-items: center;
  gap: 9px;
}
.card-head h2::before {
  content: "";
  width: 3px; height: 13px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.card-head .spacer { flex: 1; }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(255, 255, 255, 0.09); color: var(--text); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }

.chart-alert {
  margin: 4px 0 10px;
  padding: 10px 14px;
  border-radius: 11px;
  font-size: 12.5px;
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(246, 183, 60, 0.3);
  background: linear-gradient(90deg, rgba(246, 183, 60, 0.13), rgba(246, 183, 60, 0.02));
  color: #ffd9a0;
}
.chart-alert.crit {
  border-color: rgba(255, 92, 110, 0.36);
  background: linear-gradient(90deg, rgba(255, 92, 110, 0.16), rgba(255, 92, 110, 0.02));
  color: #ffb3bb;
}
.chart-alert .ico { font-size: 14px; animation: badgePulse 1.9s ease-in-out infinite; border-radius: 50%; }

.zone-legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--muted-2);
  font-family: var(--mono);
  flex-wrap: wrap;
}
.zone-legend span { display: inline-flex; align-items: center; gap: 6px; }
.zone-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.zone-legend b { color: #c7cedd; font-weight: 600; }

.score-ticks {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-width: 210px;
  font-size: 9.5px;
  color: var(--muted-2);
  font-family: var(--mono);
  margin-top: -2px;
}

.chart { width: 100%; height: 400px; }
.chart.sm { height: 260px; }
.chart.tall { height: 460px; }

.threshold-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  transition: 0.15s;
}
.threshold-chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.16); }
.threshold-chip b { color: var(--amber); font-weight: 600; }
.threshold-chip b.crit { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2.wide-left { grid-template-columns: 1.15fr 0.85fr; }

/* ── tables ─────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  margin: 0 -4px;
  padding: 0 4px;
}
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 99px; }
.table-wrap table { min-width: 520px; }
thead th {
  text-align: right;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}
thead th:first-child { text-align: left; }
tbody td {
  padding: 13px 10px;
  text-align: right;
  font-family: var(--mono);
  border-bottom: 1px solid var(--line-soft);
  color: #c7cedd;
}
tbody td:first-child {
  text-align: left;
  font-family: inherit;
  color: var(--text);
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 9px;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.022); }
.sym-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.cell-date {
  font-size: 9.5px;
  color: var(--muted-2);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.cell-up { color: var(--good); }
.cell-down { color: var(--danger); }
.cell-flat { color: var(--muted-2); }
.unit { color: var(--muted-2); font-size: 10.5px; }

/* ── alerts ─────────────────────────────────────────────────────────────── */
.alert-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 9px;
}
.alert-row.active {
  border-color: rgba(255, 92, 110, 0.32);
  background: linear-gradient(90deg, rgba(255, 92, 110, 0.12), rgba(255, 92, 110, 0.02));
}
.alert-row.active.warn {
  border-color: rgba(246, 183, 60, 0.3);
  background: linear-gradient(90deg, rgba(246, 183, 60, 0.1), rgba(246, 183, 60, 0.02));
}
.alert-row .state { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex: none; }
.alert-row.active .state { background: var(--danger); box-shadow: 0 0 10px rgba(255, 92, 110, 0.7); animation: badgePulse 1.9s ease-in-out infinite; }
.alert-row.active.warn .state { background: var(--amber); box-shadow: 0 0 10px rgba(246, 183, 60, 0.7); }
.alert-text { flex: 1; }
.alert-text .t { font-size: 13px; font-weight: 550; }
.alert-text .s { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.alert-level { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.cross-list { max-height: 236px; overflow-y: auto; margin-top: 4px; padding-right: 4px; }
.cross-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.cross-item:last-child { border-bottom: 0; }
.cross-item .date { color: #b9c1d3; }
.cross-item .arrow { font-size: 10px; }
.cross-item .arrow.below { color: var(--danger); }
.cross-item .arrow.above { color: var(--good); }

h3.sub {
  margin: 18px 0 6px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}

.note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 10px;
}

/* ── modal ──────────────────────────────────────────────────────────────── */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 7, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-back.open { display: flex; }
.modal {
  width: 100%;
  max-width: 430px;
  background: #0b0d13;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9);
}
.modal h2 { margin: 0 0 4px; font-size: 16px; }
.modal p.hint { margin: 0 0 20px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 7px; }
.field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  outline: none;
}
.field input:focus { border-color: rgba(53, 224, 200, 0.5); box-shadow: 0 0 0 3px rgba(53, 224, 200, 0.1); }
.field .desc { font-size: 11px; color: var(--muted-2); margin-top: 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.presets { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.presets .btn { padding: 6px 11px; font-size: 11.5px; font-family: var(--mono); }

/* ── footer ─────────────────────────────────────────────────────────────── */
footer {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 34px 40px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11.5px;
  color: var(--muted-2);
  font-family: var(--mono);
  flex-wrap: wrap;
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ── skeleton ───────────────────────────────────────────────────────────── */
.skeleton { color: transparent !important; background: rgba(255, 255, 255, 0.05); border-radius: 6px; animation: shim 1.4s ease-in-out infinite; }
@keyframes shim { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2.wide-left { grid-template-columns: 1fr; }
  .regime { grid-template-columns: 1fr; }
  .regime-right { text-align: left; }
  .score-wrap { align-items: flex-start; }
}
@media (max-width: 720px) {
  .topbar { padding: 18px 16px 12px; flex-wrap: wrap; }
  main { padding: 0 16px 48px; }
  .kpis { grid-template-columns: 1fr; }
  .chart { height: 320px; }
  .chart.sm { height: 230px; }
  .kpi-value { font-size: 28px; }
  footer { padding: 0 16px 32px; }
  .regime-state { font-size: 26px; }
}
