:root {
  --bg: #f4efe6;
  --bg-soft: #fbf8f3;
  --panel: rgba(255, 252, 247, 0.88);
  --panel-strong: rgba(255, 250, 244, 0.96);
  --line: rgba(27, 48, 56, 0.12);
  --line-strong: rgba(27, 48, 56, 0.2);
  --text: #1b3038;
  --muted: #5d6f74;
  --accent: #0f766e;
  --accent-soft: #d4efe8;
  --accent-strong: #0a4f51;
  --warning: #a16207;
  --warning-soft: #f5e5bb;
  --danger: #b42318;
  --danger-soft: #f8d6d3;
  --shadow: 0 18px 50px rgba(49, 67, 74, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --display-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --body-font: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  --mono-font: "Cascadia Code", "Consolas", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.1), transparent 28%),
    radial-gradient(circle at bottom left, rgba(180, 83, 9, 0.09), transparent 32%),
    linear-gradient(180deg, #f6f2ea 0%, #efe8dc 100%);
  color: var(--text);
  font-family: var(--body-font);
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  min-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(19, 46, 52, 0.94), rgba(10, 31, 39, 0.96));
  color: #f7f1e8;
  box-shadow: var(--shadow);
  padding: 26px 20px;
}

.brand {
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
}

.brand-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(247, 241, 232, 0.72);
}

.brand-title {
  font-family: var(--display-font);
  font-size: 2rem;
  line-height: 0.98;
}

.brand-copy {
  font-size: 0.92rem;
  color: rgba(247, 241, 232, 0.72);
  line-height: 1.5;
}

.nav-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 24px 0;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  color: rgba(247, 241, 232, 0.8);
  transition: background 120ms ease, transform 120ms ease, color 120ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(247, 241, 232, 0.1);
  color: #fff;
  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(211, 239, 232, 0.18), rgba(255, 240, 204, 0.12));
  color: #fff;
}

.nav-meta {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.nav-meta-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(247, 241, 232, 0.08);
  border: 1px solid rgba(247, 241, 232, 0.12);
}

.nav-meta-card dt {
  margin: 0 0 4px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(247, 241, 232, 0.56);
}

.nav-meta-card dd {
  margin: 0;
  font-size: 1rem;
}

.main {
  min-width: 0;
  display: grid;
  gap: 22px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 250, 244, 0.96), rgba(244, 250, 248, 0.92));
  box-shadow: var(--shadow);
}

.page-head > :first-child {
  flex: 1 1 28rem;
}

.page-head > .stack {
  flex: 0 1 auto;
  justify-items: end;
}

.page-head h1 {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(2rem, 2.8vw, 3rem);
  line-height: 0.95;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: min(70ch, 100%);
  line-height: 1.5;
}

.head-badges,
.button-row,
.pill-row,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill,
.status-badge,
.nav-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.pill,
.nav-count {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-strong);
}

.status-badge.neutral {
  background: rgba(27, 48, 56, 0.08);
  color: var(--text);
}

.status-badge.positive {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-badge.warning {
  background: var(--warning-soft);
  color: #7d4a03;
}

.status-badge.negative {
  background: var(--danger-soft);
  color: var(--danger);
}

.surface {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.surface-pad {
  padding: 22px 24px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head > *,
.section-head > *,
.hero-grid > *,
.split > *,
.grid-2 > *,
.grid-3 > *,
.grid-4 > *,
.forms-grid > *,
.stack > * {
  min-width: 0;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-family: var(--display-font);
  line-height: 1;
}

.section-copy {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: min(70ch, 100%);
  line-height: 1.45;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 18px;
  align-items: start;
}

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

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

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

.metric-card,
.mini-card {
  padding: 18px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(27, 48, 56, 0.08);
}

.metric-card {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 156px;
}

.metric-card-run {
  min-width: 0;
}

.metric-label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.metric-value {
  margin: 12px 0 4px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 0.95;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.metric-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.metric-value-run {
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.positive {
  color: var(--accent-strong);
}

.negative {
  color: var(--danger);
}

.warning {
  color: #8a4a00;
}

.neutral {
  color: var(--text);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.field,
.field-inline {
  display: grid;
  gap: 8px;
}

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

.field label,
.field-inline label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.button {
  background: linear-gradient(135deg, #0f766e, #0a4f51);
  color: #f8f6f2;
}

.button.warning {
  background: linear-gradient(135deg, #a16207, #7c4a03);
  color: #fff7eb;
}

.button.danger {
  background: linear-gradient(135deg, #c2410c, #9a3412);
  color: #fff7f5;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  border-color: var(--line);
}

.button:hover,
.ghost-button:hover,
.button:focus-visible,
.ghost-button:focus-visible {
  transform: translateY(-1px);
}

.inline-form {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(27, 48, 56, 0.08);
  background: rgba(255, 255, 255, 0.46);
}

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

th,
td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(27, 48, 56, 0.08);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: rgba(247, 242, 235, 0.94);
  z-index: 1;
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

tbody tr:hover {
  background: rgba(15, 118, 110, 0.04);
}

.table-compact {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.ticker-link {
  display: inline-block;
  max-width: 100%;
  font-weight: 800;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.mono {
  font-family: var(--mono-font);
}

.muted,
.mono,
.nav-meta-card dd,
.notice,
.empty-state,
.bullet-list li,
td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bullet-list li {
  line-height: 1.5;
}

.report-card {
  display: grid;
  gap: 12px;
  height: 100%;
}

.report-link {
  justify-self: start;
  font-size: 0.82rem;
}

.report-sections {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.report-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(27, 48, 56, 0.08);
  background: rgba(255, 255, 255, 0.42);
}

.report-title {
  display: block;
  overflow-wrap: anywhere;
}

.report-lines {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.report-line {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.fundamentals-list {
  gap: 14px;
}

.fundamental-label {
  display: inline-block;
  margin-bottom: 6px;
}

.fundamental-value {
  color: var(--text);
  line-height: 1.5;
}

.chart-canvas {
  width: 100%;
  min-height: 260px;
  height: 260px;
  display: block;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(248, 244, 238, 0.9)),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 46px,
      rgba(27, 48, 56, 0.04) 46px,
      rgba(27, 48, 56, 0.04) 47px
    );
}

.stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.list-reset,
.bullet-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.artifacts-list {
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.bullet-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(27, 48, 56, 0.06);
}

.notice {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 248, 221, 0.9);
  border: 1px solid rgba(161, 98, 7, 0.18);
  color: #6d4706;
}

.tabs {
  padding-bottom: 12px;
}

.tab-link {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(27, 48, 56, 0.08);
  font-weight: 700;
}

.tab-link.active {
  background: rgba(15, 118, 110, 0.13);
  color: var(--accent-strong);
  border-color: rgba(15, 118, 110, 0.18);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(27, 48, 56, 0.08);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
}

.empty-state {
  padding: 20px;
  border-radius: 18px;
  border: 1px dashed rgba(27, 48, 56, 0.18);
  background: rgba(255, 255, 255, 0.42);
  color: var(--muted);
}

.footer-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(540px, 100%);
  padding: 28px;
}

@media (max-width: 1280px) {
  .shell,
  .hero-grid,
  .split,
  .grid-4,
  .grid-3,
  .grid-2,
  .forms-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }
}

@media (max-width: 860px) {
  .shell {
    padding: 16px;
    gap: 16px;
  }

  .sidebar {
    width: 100%;
    border-radius: 24px;
    padding: 20px 16px;
  }

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

  .brand-copy,
  .nav-meta-card {
    max-width: 100%;
  }

  .nav-meta-card:first-child {
    grid-column: 1 / -1;
  }

  .brand-title {
    font-size: 1.6rem;
  }

  .nav-link {
    padding: 10px 12px;
  }

  .page-head,
  .surface-pad {
    padding: 18px;
  }

  .page-head {
    display: grid;
    gap: 14px;
  }

  .page-head > .stack {
    justify-items: start;
  }

  .page-subtitle,
  .section-copy {
    max-width: 100%;
  }

  .head-badges,
  .button-row,
  .pill-row,
  .tabs {
    width: 100%;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 8px;
  }

  .tab-link {
    flex: 0 0 auto;
  }

  .chart-canvas {
    min-height: 220px;
    height: 220px;
  }

  table {
    min-width: 560px;
  }

  th,
  td {
    padding: 11px 12px;
  }
}
