:root {
  --bg: #edf3f5;
  --panel: #ffffff;
  --panel-soft: #f7f9fb;
  --panel-strong: #e9eef3;
  --ink: #18212b;
  --muted: #677483;
  --line: #cbd3dc;
  --line-soft: #e4e9ef;
  --nav: #063b77;
  --nav-dark: #061d4f;
  --nav-active: #0aa867;
  --accent: #075fe4;
  --accent-2: #0aa867;
  --gold: #d9b556;
  --warn: #b95d21;
  --danger: #b33a3a;
  --shadow: 0 12px 32px rgba(6, 29, 79, 0.12);
  --premium-shadow: 0 22px 70px rgba(6, 29, 79, 0.18);
  --scroll-shift: 0px;
}

body.dark {
  --bg: #161a1d;
  --panel: #20262b;
  --panel-soft: #252d33;
  --panel-strong: #2e3840;
  --ink: #eff4f7;
  --muted: #aab6c1;
  --line: #3c4853;
  --line-soft: #303941;
  --nav: #132d3c;
  --nav-dark: #0f202d;
  --nav-active: #0aa867;
  --accent: #68a0ff;
  --accent-2: #57d994;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  scroll-behavior: smooth;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(260px, 1fr) minmax(500px, auto);
  gap: 14px;
  align-items: center;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

body.dark .topbar {
  background: rgba(32, 38, 43, 0.92);
}

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

.brand-link {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0;
}

.brand-link:hover .brand-name {
  color: var(--accent);
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 2px solid var(--gold);
  box-shadow: 0 4px 14px rgba(6, 29, 79, 0.18);
}

.brand-name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.global-search {
  position: relative;
  display: flex;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.global-search input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.global-search button {
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0 14px;
  background: linear-gradient(#ffffff, #dce6ec);
  color: #173652;
  font-weight: 700;
}

body.dark .global-search button {
  background: var(--panel-soft);
  color: var(--ink);
}

.search-results {
  display: none;
  position: absolute;
  top: 43px;
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow: auto;
  z-index: 30;
}

.search-results.open {
  display: block;
}

.search-hit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 11px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.search-hit:hover {
  background: var(--panel-soft);
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.navrail {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  background: linear-gradient(var(--nav), var(--nav-dark));
  border-bottom: 1px solid #0b1f2c;
}

.nav-item {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  border-right: 1px solid rgba(0, 0, 0, 0.28);
  padding: 0 16px;
  color: white;
  background: transparent;
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
}

.nav-item.active,
.nav-item:hover {
  background: linear-gradient(#12bb77, var(--nav-active));
}

.shell {
  padding: 16px;
  max-width: 1720px;
  margin: 0 auto;
}

.launch-ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid rgba(217, 181, 86, 0.45);
  background: linear-gradient(90deg, rgba(217, 181, 86, 0.18), rgba(10, 168, 103, 0.08));
  padding: 10px 12px;
  color: var(--ink);
}

.launch-ribbon strong {
  color: #795d13;
  white-space: nowrap;
}

body.dark .launch-ribbon strong {
  color: #f1d478;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn 360ms ease-out both;
}

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

.home-hero {
  display: grid;
  grid-template-columns: minmax(520px, 1.18fr) minmax(390px, 0.82fr);
  gap: 28px;
  min-height: 520px;
  align-items: stretch;
  background:
    linear-gradient(120deg, rgba(3, 24, 54, 0.98), rgba(7, 72, 172, 0.92) 52%, rgba(10, 135, 96, 0.88)),
    url("assets/aimfiinsight-logo.png");
  background-size: cover;
  background-position: center calc(50% + var(--scroll-shift));
  border: 1px solid rgba(217, 181, 86, 0.7);
  color: #ffffff;
  padding: 44px;
  box-shadow: var(--premium-shadow);
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(217, 181, 86, 0.28);
  pointer-events: none;
}

.home-hero::after {
  content: "";
  position: absolute;
  left: 42%;
  top: -18%;
  width: 28%;
  height: 140%;
  background: linear-gradient(180deg, rgba(255,255,255,0.13), rgba(255,255,255,0.02));
  transform: skewX(-13deg) translateY(calc(var(--scroll-shift) * -0.4));
  pointer-events: none;
}

.home-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 980px;
  position: relative;
  z-index: 1;
}

.home-copy .eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.home-copy h1 {
  margin: 0;
  font-size: 54px;
  line-height: 1.04;
  max-width: 930px;
  letter-spacing: 0;
}

.home-copy p {
  margin: 16px 0 0;
  max-width: 760px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 16px;
  line-height: 1.55;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.home-visual-stack {
  position: relative;
  display: grid;
  align-content: center;
  gap: 18px;
  z-index: 1;
  perspective: 1100px;
}

.home-card {
  align-self: center;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border: 1px solid rgba(217, 181, 86, 0.7);
  padding: 16px;
  min-height: 280px;
  box-shadow: 0 24px 60px rgba(2, 18, 44, 0.28);
  transform: translateY(calc(var(--scroll-shift) * -0.12));
}

.terminal-3d {
  height: 190px;
  position: relative;
  transform-style: preserve-3d;
  animation: terminalFloat 7s ease-in-out infinite;
}

.terminal-plane {
  position: absolute;
  border: 1px solid rgba(217, 181, 86, 0.55);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}

.plane-a {
  width: 72%;
  height: 126px;
  right: 10%;
  top: 22px;
  transform: rotateY(-24deg) rotateX(12deg) translateZ(42px);
}

.plane-b {
  width: 48%;
  height: 90px;
  left: 6%;
  top: 74px;
  transform: rotateY(29deg) rotateX(-8deg) translateZ(70px);
}

.plane-c {
  width: 56%;
  height: 104px;
  right: 0;
  top: 88px;
  transform: rotateY(-35deg) rotateX(-11deg) translateZ(12px);
}

.terminal-plane::before {
  content: "";
  position: absolute;
  inset: 14px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.36) 0 28%, transparent 28% 100%),
    repeating-linear-gradient(180deg, rgba(255,255,255,0.24) 0 2px, transparent 2px 18px);
  opacity: 0.7;
}

.terminal-ticker {
  position: absolute;
  right: 8%;
  top: 78px;
  min-width: 128px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border: 1px solid rgba(217, 181, 86, 0.75);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
  transform: rotateY(-18deg) translateZ(108px);
}

.terminal-ticker span,
.terminal-ticker b {
  display: block;
}

.terminal-ticker span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.terminal-ticker b {
  margin-top: 4px;
  font-size: 24px;
  color: var(--accent);
}

@keyframes terminalFloat {
  0%, 100% {
    transform: rotateX(0deg) rotateY(0deg) translateY(0);
  }
  50% {
    transform: rotateX(2deg) rotateY(-4deg) translateY(-8px);
  }
}

.home-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.home-card-head span {
  color: var(--muted);
  font-weight: 700;
}

.home-card-head strong {
  color: var(--accent-2);
}

.home-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.home-metrics .metric {
  min-height: 92px;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.home-analytics-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.35fr) minmax(280px, 0.82fr) minmax(280px, 0.82fr);
  gap: 12px;
  margin-top: 14px;
}

.analytics-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: 0;
}

.analytics-card canvas {
  min-height: 190px;
}

.readiness-bars {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.readiness-row span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.readiness-track {
  height: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}

.readiness-fill {
  height: 100%;
  width: var(--value);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left;
  animation: fillIn 900ms ease-out both;
}

@keyframes fillIn {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.workflow-river {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  background: var(--line);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workflow-river div {
  min-height: 150px;
  padding: 18px;
  background: linear-gradient(var(--panel), var(--panel-soft));
  position: relative;
}

.workflow-river div::after {
  content: "";
  position: absolute;
  right: -18px;
  top: 50%;
  width: 36px;
  height: 36px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: inherit;
  transform: translateY(-50%) rotate(45deg);
  z-index: 1;
}

.workflow-river div:last-child::after {
  display: none;
}

.workflow-river span {
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.workflow-river strong,
.workflow-river p {
  display: block;
  position: relative;
  z-index: 2;
}

.workflow-river strong {
  margin: 8px 0;
  font-size: 18px;
}

.workflow-river p {
  color: var(--muted);
  line-height: 1.45;
}

.premium-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 650ms ease, transform 650ms ease;
}

.premium-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.home-feature-grid article {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
  min-height: 145px;
}

.home-feature-grid strong,
.home-feature-grid span {
  display: block;
}

.home-feature-grid strong {
  color: var(--accent);
  font-size: 15px;
  margin-bottom: 8px;
}

.home-feature-grid span {
  color: var(--muted);
  line-height: 1.5;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.7fr) minmax(300px, 0.8fr);
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel.nested {
  box-shadow: none;
  margin: 12px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--panel), var(--panel-soft));
}

.panel-header.compact {
  padding: 10px 12px;
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-weight: 700;
}

.panel-header h1 {
  font-size: 24px;
}

.panel-header h2 {
  font-size: 16px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.subject-panel {
  grid-row: span 2;
}

.subject-details {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px;
  padding: 12px 14px 0;
}

.quote-card {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 10px;
}

.quote-card span,
.metric span,
.metric-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.quote-card strong {
  display: block;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.quote-card em {
  color: var(--accent-2);
  font-style: normal;
  font-weight: 700;
}

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

.profile-cell,
.metric {
  border: 1px solid var(--line-soft);
  background: var(--panel-soft);
  padding: 8px;
  min-width: 0;
}

.profile-cell b,
.metric strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

canvas {
  width: 100%;
  display: block;
  padding: 12px;
}

.watchlist-strip {
  display: grid;
  gap: 7px;
  padding: 10px;
  max-height: 260px;
  overflow: auto;
}

.watch-row,
.alert-row,
.provider-card,
.score-card {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 9px;
}

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

.watch-row strong,
.alert-row strong,
.provider-card strong {
  display: block;
}

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

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

.valuation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 10px 0;
}

.valuation-pill {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 8px;
}

.valuation-pill span {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.valuation-pill b {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.selected-peers {
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.peer-chip {
  display: grid;
  grid-template-columns: 1fr 24px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 7px;
  margin-bottom: 6px;
  background: var(--panel-soft);
}

.peer-chip button {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

.metric-grid {
  display: grid;
  gap: 8px;
  padding: 10px;
}

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

.market-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.market-tile {
  min-height: 86px;
  padding: 9px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.market-tile strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.screener-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select,
.panel-header select {
  min-height: 34px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 6px 8px;
}

.toggle-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.toggle-strip label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.template-strip,
.case-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
}

.case-strip {
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel-soft);
}

.template-chip {
  min-height: 32px;
  border: 1px solid var(--line);
  background: linear-gradient(var(--panel), var(--panel-soft));
  color: var(--ink);
  padding: 0 10px;
  font-weight: 700;
}

.template-chip:hover,
.template-chip.active {
  border-color: rgba(20, 108, 148, 0.5);
  color: var(--accent);
  background: rgba(20, 108, 148, 0.08);
}

.insight-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.insight-card {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 10px;
  line-height: 1.45;
}

.insight-card strong {
  display: block;
  margin-bottom: 4px;
}

.table-wrap {
  overflow: auto;
  max-height: 560px;
}

.table-wrap.tall {
  max-height: calc(100vh - 230px);
}

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

.score-card {
  min-height: 112px;
}

.score-card span {
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.score-card b {
  font-size: 22px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: #dfe7ee;
  color: #1f4056;
  white-space: nowrap;
}

body.dark .data-table th {
  background: #2c3842;
  color: var(--ink);
}

.data-table td {
  padding: 7px 8px;
  border: 1px solid var(--line-soft);
  vertical-align: top;
}

.data-table tr:nth-child(even) td {
  background: var(--panel-soft);
}

.data-table tr.selected td {
  background: rgba(28, 140, 100, 0.12);
}

.data-table tfoot td {
  background: var(--panel-soft);
  font-weight: 700;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.score {
  display: inline-block;
  min-width: 38px;
  padding: 2px 5px;
  text-align: right;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(28, 140, 100, 0.32);
  color: var(--accent-2);
  background: rgba(28, 140, 100, 0.09);
  padding: 4px 8px;
  font-weight: 700;
}

.primary-btn,
.secondary-btn,
.icon-btn {
  min-height: 34px;
  border: 1px solid var(--line);
  padding: 0 12px;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(#126cf0, #074db4);
  border-color: #074db4;
  color: white;
}

.secondary-btn,
.icon-btn {
  background: linear-gradient(var(--panel), var(--panel-soft));
  color: var(--ink);
}

.icon-btn {
  min-width: 70px;
  width: auto;
  padding: 0 12px;
  white-space: nowrap;
  overflow: visible;
}

.full {
  width: calc(100% - 20px);
  margin: 0 10px 10px;
}

.full-clean {
  width: 100%;
}

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

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

.launch-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(520px, 1.22fr);
  gap: 12px;
  padding: 12px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.pricing-card,
.proof-list article {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 12px;
  min-width: 0;
}

.pricing-card.featured {
  border-color: rgba(10, 168, 103, 0.6);
  background: linear-gradient(var(--panel), rgba(10, 168, 103, 0.08));
}

.pricing-card span {
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
}

.pricing-card strong {
  display: block;
  margin: 6px 0;
  font-size: 18px;
}

.pricing-card p {
  min-height: 70px;
  color: var(--muted);
  line-height: 1.45;
}

.pricing-card b {
  color: var(--accent-2);
}

.proof-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.proof-list strong,
.proof-list span {
  display: block;
}

.proof-list span {
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.45;
}

.launch-wide {
  grid-column: 1 / -1;
}

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

.sales-asset-grid article {
  border: 1px solid var(--line);
  background: linear-gradient(var(--panel), var(--panel-soft));
  padding: 12px;
  min-height: 128px;
}

.sales-asset-grid strong,
.sales-asset-grid span {
  display: block;
}

.sales-asset-grid strong {
  color: var(--accent);
  margin-bottom: 6px;
  font-size: 14px;
}

.sales-asset-grid span {
  color: var(--muted);
  line-height: 1.45;
}

.report-stage {
  padding: 18px;
  background: var(--panel-soft);
}

.tearsheet {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
}

.tearsheet-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #ffffff;
  background: linear-gradient(90deg, #063b77, #075fe4 55%, #0aa867);
  padding: 18px;
  border: 1px solid rgba(217, 181, 86, 0.6);
}

.tearsheet-hero img {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border: 2px solid var(--gold);
}

.tearsheet-hero span {
  display: block;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.tearsheet-hero h2,
.tearsheet-hero p,
.tearsheet h3 {
  margin: 0;
}

.tearsheet-hero h2 {
  margin-top: 4px;
  font-size: 28px;
}

.tearsheet-hero p {
  margin-top: 4px;
  opacity: 0.9;
}

.tearsheet-note {
  margin-top: 12px;
  border: 1px solid rgba(217, 181, 86, 0.45);
  background: rgba(217, 181, 86, 0.12);
  padding: 10px;
  color: var(--muted);
}

.tearsheet-kpis,
.tearsheet-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

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

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

.tearsheet-kpis div,
.tearsheet section:not(.tearsheet-note) {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px;
}

.tearsheet-kpis span {
  display: block;
  color: var(--muted);
}

.tearsheet-kpis b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.tearsheet h3 {
  margin-bottom: 8px;
  color: var(--accent);
}

.tearsheet p {
  color: var(--muted);
  line-height: 1.5;
}

.tearsheet footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.valuation-grid,
.watchlist-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.7fr);
  gap: 12px;
  padding: 12px;
}

.assumption-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.valuation-cards {
  padding: 0;
}

.sensitivity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
}

.sensitivity-cell {
  border: 1px solid var(--line-soft);
  background: var(--panel-soft);
  padding: 7px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sensitivity-cell.header {
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}

.alert-form {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.alerts-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  max-height: 330px;
  overflow: auto;
}

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

.provider-card {
  min-height: 138px;
}

.provider-card .status-pill {
  margin-top: 10px;
}

.data-quality-panel {
  margin-top: 0;
}

.roadmap-grid article {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 14px;
  min-height: 160px;
}

.roadmap-grid h3 {
  margin: 0 0 8px;
}

.roadmap-grid p {
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1150px) {
  .topbar {
    grid-template-columns: minmax(240px, 1fr) auto;
    height: auto;
  }

  .global-search {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .top-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .workspace-grid,
  .home-hero,
  .home-analytics-grid,
  .workflow-river,
  .screener-form,
  .deal-form,
  .roadmap-grid,
  .provider-grid,
  .score-grid,
  .home-feature-grid,
  .launch-grid,
  .pricing-grid,
  .proof-list,
  .sales-asset-grid,
  .tearsheet-kpis,
  .tearsheet-grid,
  .valuation-grid,
  .watchlist-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
    position: static;
    gap: 12px;
    padding: 18px 16px;
  }

  .global-search {
    grid-column: auto;
    grid-row: auto;
  }

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

  .brand-logo {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
  }

  .brand-name {
    font-size: 21px;
    line-height: 1.15;
  }

  .brand-subtitle {
    font-size: 13px;
    margin-top: 2px;
  }

  .global-search input {
    min-height: 44px;
    font-size: 16px;
  }

  .global-search button {
    min-width: 88px;
    font-size: 15px;
  }

  .workspace-grid,
  .home-hero,
  .home-analytics-grid,
  .workflow-river,
  .screener-form,
  .deal-form,
  .roadmap-grid,
  .provider-grid,
  .score-grid,
  .home-feature-grid,
  .launch-grid,
  .pricing-grid,
  .proof-list,
  .sales-asset-grid,
  .tearsheet-kpis,
  .tearsheet-grid,
  .valuation-grid,
  .watchlist-layout,
  .assumption-grid,
  .subject-details,
  .mini-profile,
  .market-map,
  .valuation-summary {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-actions button {
    width: 100%;
    min-height: 44px;
    flex: initial;
  }

  .top-actions #exportWorkspaceBtn {
    grid-column: 1 / -1;
  }

  .navrail {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .navrail::-webkit-scrollbar {
    height: 4px;
  }

  .navrail::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 0 18px;
    font-size: 15px;
    scroll-snap-align: start;
  }

  .launch-ribbon {
    align-items: flex-start;
    gap: 8px;
    padding: 14px;
  }

  .launch-ribbon strong {
    min-width: 110px;
  }

  .home-hero {
    min-height: auto;
    padding: 30px 24px;
    gap: 22px;
  }

  .home-hero::before {
    inset: 14px;
  }

  .home-copy h1 {
    font-size: 32px;
    line-height: 1.08;
  }

  .home-copy p {
    font-size: 15px;
  }

  .home-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .home-actions button {
    min-height: 42px;
  }

  .terminal-3d {
    min-height: 210px;
  }

  .workflow-river div::after {
    display: none;
  }

  .analytics-card canvas {
    min-height: 150px;
    padding: 8px;
  }

  .report-stage {
    padding: 10px 0;
    overflow: hidden;
  }

  .tearsheet {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    overflow: hidden;
  }

  .tearsheet-hero {
    align-items: flex-start;
    padding: 14px;
    gap: 12px;
  }

  .tearsheet-hero img {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
  }

  .tearsheet-hero h2 {
    font-size: 24px;
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .tearsheet-kpis b {
    font-size: 18px;
  }

  .tearsheet section {
    min-width: 0;
  }

  .tearsheet .data-table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .tearsheet .data-table th {
    position: static;
  }

  .panel-header {
    align-items: flex-start;
    gap: 10px;
  }

  .panel-header .button-row {
    width: 100%;
  }

  .panel-header .button-row button {
    flex: 1;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding: 16px 14px;
  }

  .brand-name {
    font-size: 19px;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .home-copy h1 {
    font-size: 29px;
  }

  .home-hero {
    padding: 26px 20px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .navrail,
  .launch-ribbon,
  .panel-header,
  .view:not(#reportView) {
    display: none !important;
  }

  .shell,
  .report-stage,
  .tearsheet {
    padding: 0;
    margin: 0;
    max-width: none;
    border: 0;
    box-shadow: none;
    background: #ffffff;
  }

  #reportView,
  #reportView.view {
    display: block !important;
  }

  .tearsheet {
    color: #14202b;
  }
}
