:root {
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #182032;
  --border: #253047;
  --text: #e6edf7;
  --muted: #8b9bb4;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --emerald: #10b981;
  --rose: #f43f5e;
  --amber: #f59e0b;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: radial-gradient(circle at 15% 0%, #13213a 0%, var(--bg) 45%);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.full-width { width: 100%; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(11, 15, 23, 0.82);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--emerald));
  color: #06101c; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand-tld { color: var(--accent); }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 14px; transition: color .15s; }
.nav-links a:hover { color: var(--text); }
.account-bar { display: flex; align-items: center; gap: 10px; }
.account-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px;
}
.account-pill strong { color: var(--emerald); font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 9px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all .15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-primary { background: var(--accent); color: #05111f; }
.btn-primary:hover:not(:disabled) { background: #67d0fc; }
.btn-emerald { background: var(--emerald); color: #041911; }
.btn-emerald:hover:not(:disabled) { background: #34d399; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

/* Hero */
.hero { padding: 56px 0 36px; border-bottom: 1px solid rgba(37, 48, 71, 0.5); }
.hero-grid { display: grid; grid-template-columns: 1.35fr 0.95fr; gap: 28px; align-items: center; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--accent); margin-bottom: 12px;
}
h1 { margin: 0 0 14px; font-size: clamp(28px, 3.8vw, 42px); line-height: 1.18; letter-spacing: -0.02em; }
.accent { color: var(--accent); }
.hero-desc { color: var(--muted); font-size: 15px; margin: 0 0 22px; max-width: 60ch; }
.hero-desc strong { color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.dataset-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(56, 189, 248, 0.12); color: var(--accent); border: 1px solid rgba(56, 189, 248, 0.25);
}
.badge-warn { background: rgba(245, 158, 11, 0.14); color: var(--amber); border-color: rgba(245, 158, 11, 0.3); }
.badge-ok { background: rgba(16, 185, 129, 0.14); color: var(--emerald); border-color: rgba(16, 185, 129, 0.3); }
.badge-danger { background: rgba(244, 63, 94, 0.14); color: var(--rose); border-color: rgba(244, 63, 94, 0.3); }

.hero-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.hero-card-header {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.hero-card-header .mono { margin-left: auto; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.check-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.check-list li span { color: var(--muted); }
.check-list li strong { color: var(--text); text-align: right; }

/* Sections & Panels */
.section { padding: 40px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0 0 4px; font-size: 22px; }
.section-head p { margin: 0; font-size: 14px; }
.report-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.panel h3 { margin: 0 0 12px; font-size: 16px; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-title-row h3 { margin: 0; }

/* Builder */
.builder-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 20px; align-items: start; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
textarea, select, input[type="email"], input[type="number"] {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; font-size: 14px; font-family: inherit;
}
textarea:focus, select:focus, input:focus { outline: none; border-color: var(--accent); }
.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 16px; }
.chip {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.controls-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 12px; align-items: end; }
.controls-row.compact { grid-template-columns: 1fr 1fr; margin-bottom: 12px; }

.empty-box {
  padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px;
  border: 1px dashed var(--border); border-radius: 10px;
}
.summary-box {
  margin: 0 0 12px; padding: 12px 14px; border-radius: 9px; font-size: 14px;
  background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.22);
}
.warn-list, .note-list { display: grid; gap: 6px; margin-bottom: 10px; }
.warn-item {
  font-size: 13px; padding: 8px 11px; border-radius: 8px;
  background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.25); color: #fcd34d;
}
.note-item { font-size: 12.5px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--border); }
.dsl-details { margin: 12px 0; font-size: 13px; color: var(--muted); }
.dsl-details summary { cursor: pointer; }
.code-box {
  margin: 8px 0 0; padding: 12px; border-radius: 8px; background: #080c14;
  border: 1px solid var(--border); font-family: var(--mono); font-size: 12px;
  overflow-x: auto; color: #93c5fd;
}
.run-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 14px; margin-top: 12px; border-top: 1px solid var(--border);
}
.price-inline strong { font-size: 18px; color: var(--emerald); }

/* KPI & Charts */
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kpi-val { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.pos { color: var(--emerald); }
.neg { color: var(--rose); }
.warn { color: var(--amber); }

.charts-grid { display: grid; grid-template-columns: 1.35fr 0.85fr; gap: 18px; margin-bottom: 18px; }
.chart-wrap { width: 100%; min-height: 240px; }
.chart-wrap svg { width: 100%; height: auto; display: block; }

.friction-list { display: grid; gap: 10px; margin-bottom: 18px; }
.friction-row { display: grid; grid-template-columns: 92px 1fr 86px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 9px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-pos { background: var(--emerald); }
.bar-neg { background: var(--rose); }
.bar-warn { background: var(--amber); }
.friction-num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }

.regime-block h4 { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.regime-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.regime-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 10px; text-align: center;
}
.regime-card .r-name { font-size: 12px; color: var(--muted); }
.regime-card .r-val { font-size: 16px; font-weight: 700; margin: 3px 0; font-variant-numeric: tabular-nums; }
.regime-card .r-bars { font-size: 11px; color: var(--muted); }

/* Table */
.table-panel { margin-top: 18px; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
  padding: 10px 12px; border-bottom: 1px solid rgba(37, 48, 71, 0.65); text-align: left; white-space: nowrap;
}
.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.data-table td.num, .data-table th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.price-card h3 { margin: 10px 0 6px; }
.price-big { font-size: 26px; font-weight: 800; color: var(--emerald); margin-bottom: 12px; }
.price-big span { font-size: 14px; font-weight: 500; color: var(--muted); }
.plain-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; display: grid; gap: 6px; }
.note-box {
  padding: 12px; border-radius: 9px; font-size: 13px; color: #cbd5e1;
  background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.22);
}
.order-box {
  margin-top: 12px; padding: 12px; border-radius: 9px; font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--border); word-break: break-all;
}

/* Alerts & Modal */
.alert { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.alert-danger { background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.35); color: #fda4af; }

.modal {
  border: none; padding: 0; border-radius: var(--radius); background: transparent; max-width: 430px; width: 92vw;
}
.modal::backdrop { background: rgba(4, 7, 13, 0.72); backdrop-filter: blur(4px); }
.modal-card {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.footer { border-top: 1px solid var(--border); padding: 26px 0; margin-top: 32px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; }

@media (max-width: 960px) {
  .hero-grid, .builder-grid, .charts-grid, .pricing-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .controls-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
