:root {
  --ink: #030712;
  --navy: #07111f;
  --panel: #0c1728;
  --panel-2: #111d31;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f8fbff;
  --muted: #9aa9bd;
  --cyan: #25d6ff;
  --blue: #6f7bff;
  --violet: #a56cff;
  --green: #20d99b;
  --red: #ff5b6e;
  --amber: #f5b84b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select {
  font: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
  background: linear-gradient(135deg, #030712, #06111f 52%, #120c22);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(5, 12, 24, 0.86);
  padding: 18px 14px;
  overflow-y: auto;
}

.brand-logo {
  width: 194px;
  height: 72px;
  object-fit: contain;
  object-position: left center;
  margin-left: 2px;
}

nav {
  display: grid;
  gap: 5px;
  margin-top: 24px;
}

.nav-button {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.nav-button.active,
.nav-button:hover {
  border-color: rgba(37, 214, 255, 0.28);
  background: rgba(37, 214, 255, 0.08);
  color: var(--text);
}

.sidebar-note {
  display: grid;
  gap: 4px;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sidebar-note strong {
  color: var(--text);
  font-size: 13px;
}

main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 12, 24, 0.7);
  padding: 20px 28px;
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.04;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.badge {
  border: 1px solid rgba(32, 217, 155, 0.28);
  border-radius: 8px;
  background: rgba(32, 217, 155, 0.12);
  color: var(--green);
  padding: 8px 11px;
  font-size: 13px;
  white-space: nowrap;
}

.top-actions button {
  min-height: 40px;
  font-size: 14px;
  white-space: nowrap;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  cursor: pointer;
}

.primary {
  background: var(--cyan);
  color: #031018;
  font-weight: 700;
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

#page {
  padding: 26px 28px 42px;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(420px, 1fr);
  gap: 22px;
  align-items: stretch;
}

.landing-hero > div:first-child {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 214, 255, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(13, 25, 43, 0.94), rgba(9, 19, 34, 0.94));
  padding: 34px;
}

.landing-hero h2 {
  max-width: 780px;
  margin: 18px 0 16px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 0.98;
}

.landing-hero p {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.tier-card h3 {
  margin-top: 14px;
  font-size: 28px;
}

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

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 25, 43, 0.94), rgba(9, 19, 34, 0.94));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.20);
}

.card-inner {
  padding: 20px;
}

.card h3 {
  line-height: 1.18;
}

.metric {
  min-height: 116px;
}

.metric label {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1.05;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.chart {
  width: 100%;
  min-height: 320px;
}

.chart-subtitle {
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  width: 18px;
  height: 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  flex: 0 0 auto;
}

.legend-dashed {
  height: 0;
  border: 0;
  border-top: 2px dashed currentColor;
  border-radius: 0;
  background: transparent !important;
}

.section-title {
  margin: 28px 0 12px;
  color: #dbeafe;
}

.analysis-workbench {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.analysis-results .cols-2 {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
}

.analysis-controls {
  position: sticky;
  top: 18px;
}

.analysis-controls h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.analysis-results {
  min-width: 0;
}

.range-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.range-control {
  width: 100%;
  margin: 14px 0 16px;
  accent-color: var(--cyan);
}

.date-readout {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(37, 214, 255, 0.22);
  border-radius: 8px;
  background: rgba(37, 214, 255, 0.08);
  padding: 13px;
}

.date-readout span,
.date-readout small {
  color: var(--muted);
  font-size: 12px;
}

.date-readout strong {
  font-size: 22px;
}

.legend-card {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.insight-list {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.insight-list div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.insight-list strong {
  color: var(--cyan);
  font-size: 24px;
  line-height: 1;
}

.insight-list span {
  color: var(--muted);
  line-height: 1.45;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(37, 214, 255, 0.28);
  border-radius: 999px;
  background: rgba(37, 214, 255, 0.09);
  color: var(--cyan);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}

.compact-controls {
  margin-top: 14px;
}

.donut-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.legend-stack {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.legend-stack div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-stack span {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.feature-list {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.control {
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 10px 12px;
  min-height: 42px;
}

.auth-field {
  display: block;
  width: 100%;
  margin-top: 12px;
}

.auth-action {
  margin-top: 14px;
  width: 100%;
}

.auth-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.small-copy {
  margin-top: 14px;
  font-size: 13px;
}

.sidebar-action {
  margin-top: 8px;
  padding: 8px 10px;
  width: 100%;
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid rgba(37, 214, 255, 0.35);
  border-radius: 8px;
  background: rgba(3, 7, 18, 0.96);
  color: var(--text);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.positive { color: var(--green); }
.negative { color: var(--red); }
.muted { color: var(--muted); }
.warning { color: var(--amber); }

.plan {
  display: flex;
  min-height: 340px;
  flex-direction: column;
  justify-content: space-between;
}

.disclaimer {
  margin-top: 18px;
  border: 1px solid rgba(245, 184, 75, 0.25);
  border-radius: 8px;
  background: rgba(245, 184, 75, 0.08);
  color: #ffe3a6;
  padding: 13px 15px;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
  }
  .sidebar-note {
    position: static;
    margin-top: 16px;
  }
  .cols-2, .cols-3, .cols-4 {
    grid-template-columns: 1fr;
  }
  .landing-hero {
    grid-template-columns: 1fr;
  }
  .landing-hero > div:first-child {
    min-height: auto;
    padding: 24px;
  }
  .analysis-results .cols-2 {
    grid-template-columns: 1fr;
  }
  .analysis-workbench {
    grid-template-columns: 1fr;
  }
  .analysis-controls {
    position: static;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
