:root {
  --bg: #050d1a;
  --bg-elevated: rgba(10, 22, 42, 0.72);
  --bg-inner: rgba(8, 18, 36, 0.85);
  --gold: #c9a84c;
  --gold-soft: rgba(201, 168, 76, 0.35);
  --gold-faint: rgba(201, 168, 76, 0.14);
  --text: #f4f6f8;
  --text-muted: #8b97a8;
  --border: rgba(201, 168, 76, 0.28);
  --green: #3d9b6e;
  --green-bg: rgba(61, 155, 110, 0.15);
  --amber: #c9a24a;
  --amber-bg: rgba(201, 162, 74, 0.15);
  --red: #c45c5c;
  --red-bg: rgba(196, 92, 92, 0.15);
  --font: "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --radius: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(201, 168, 76, 0.08), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(40, 80, 140, 0.12), transparent 45%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem 1.75rem;
  border-bottom: 1px solid var(--gold-faint);
  background: rgba(5, 13, 26, 0.9);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
  justify-content: flex-end;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.logo-text {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text);
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}

.compare-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  user-select: none;
}

.compare-toggle input {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
}

/* Session API key (welcoming onboarding) */
.api-key-section {
  margin-bottom: 1.15rem;
  padding: 1rem 1.05rem 1.1rem;
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-radius: 10px;
  background:
    radial-gradient(ellipse 80% 120% at 0% 0%, rgba(201, 168, 76, 0.08), transparent 55%),
    rgba(8, 18, 36, 0.55);
}

.api-key-form-wrap[hidden],
.api-key-confirmed[hidden] {
  display: none !important;
}

.api-key-welcome {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
  line-height: 1.35;
}

.api-key-hint {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.api-key-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
}

.api-key-input-wrap {
  display: block;
  width: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.api-key-input-wrap input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(201, 168, 76, 0.28);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.65rem 0.8rem;
  outline: none;
}

.api-key-input-wrap input::placeholder {
  color: rgba(139, 151, 168, 0.85);
  font-family: var(--font);
}

.api-key-input-wrap input:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.06);
}

.api-key-save {
  width: 100%;
  margin-top: 0;
  box-sizing: border-box;
  white-space: nowrap;
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: none;
  border-radius: 8px;
}

.api-key-link {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 168, 76, 0.4);
  font-weight: 500;
}

.api-key-link:hover {
  border-bottom-color: var(--gold);
  color: var(--text);
}

.api-key-error {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--red);
}

.api-key-confirmed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}

.api-key-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  border: 1px solid rgba(61, 155, 110, 0.4);
  background: var(--green-bg);
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.api-key-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(61, 155, 110, 0.55);
}

.api-key-confirmed-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.api-key-change {
  background: transparent;
  border: none;
  color: var(--gold);
  font-family: var(--font);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: auto;
}

.api-key-change:hover {
  color: var(--text);
}

/* Layout */
.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(280px, 320px);
  gap: 1rem;
  padding: 1rem 1.25rem 1.5rem;
  align-items: start;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.25rem;
}

.glass {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.glass-inner {
  background: var(--bg-inner);
  border: 1px solid var(--gold-faint);
  border-radius: 8px;
}

.panel-header {
  margin-bottom: 1rem;
}

.panel-header.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.panel-header.compact {
  margin-bottom: 0.65rem;
}

.panel-header h2,
.panel-header h3 {
  margin: 0 0 0.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel-header h2 {
  font-size: 1.05rem;
  color: var(--text);
}

.panel-header h3 {
  font-size: 0.9rem;
  color: var(--gold);
}

.panel-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Forms */
.fields-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--gold-faint);
}

.company-b {
  margin-top: 1.25rem;
  padding-top: 0.25rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field.full {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.field input,
.field textarea {
  width: 100%;
  background: rgba(3, 8, 16, 0.65);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.55rem 0.7rem;
  outline: none;
  transition: border-color 0.2s ease;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--gold);
}

.field textarea {
  min-height: 72px;
}

.btn-primary,
.btn-secondary {
  width: 100%;
  margin-top: 1rem;
  border: none;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: linear-gradient(180deg, #d4b55a 0%, var(--gold) 100%);
  color: #0a1424;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.92;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gold-faint);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* History */
.history-section {
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--gold-faint);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
}

.history-list li {
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 6px;
  margin-bottom: 0.35rem;
}

.history-list li.history-item {
  cursor: pointer;
  background: rgba(3, 8, 16, 0.4);
  border-color: rgba(201, 168, 76, 0.12);
}

.history-list li.history-item:hover {
  border-color: var(--border);
}

.history-item .h-name {
  display: block;
  font-weight: 500;
  font-size: 0.85rem;
}

.history-item .h-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.history-empty {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.4rem 0 !important;
}

/* Dashboard — height follows active tab content (no tall empty glass) */
.dashboard-panel {
  min-height: 0;
  align-self: start;
  width: 100%;
}

.tab-panels {
  min-height: 0;
}

/* Premium multi-stage analysis loader */
.analysis-loader {
  display: none;
  margin: 0 0 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    radial-gradient(ellipse 70% 80% at 50% 0%, rgba(201, 168, 76, 0.1), transparent 55%),
    rgba(6, 14, 28, 0.92);
  overflow: hidden;
}

.analysis-loader:not([hidden]) {
  display: block;
  animation: loaderShellIn 0.4s ease both;
}

.analysis-loader-inner {
  padding: 1.75rem 1.5rem 1.45rem;
  text-align: center;
}

.loader-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
  animation: logoPulse 2.2s ease-in-out infinite;
}

.loader-logo-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.25);
}

.loader-logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text);
}

.loader-eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

.loader-stage-wrap {
  min-height: 1.6rem;
  margin-bottom: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-stage-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--gold);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.loader-stage-text.is-fading {
  opacity: 0;
  transform: translateY(4px);
}

.loader-stage-text.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.loader-progress {
  width: min(100%, 360px);
  height: 3px;
  margin: 0 auto 1.15rem;
  background: rgba(201, 168, 76, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.loader-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(201, 168, 76, 0.45), var(--gold), rgba(201, 168, 76, 0.75));
  border-radius: 2px;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(201, 168, 76, 0.35);
}

.loader-stage-list {
  list-style: none;
  margin: 0 auto 0.95rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 0.85rem;
  max-width: 520px;
}

.loader-stage-list li {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(139, 151, 168, 0.45);
  transition: color 0.35s ease, opacity 0.35s ease;
  position: relative;
  padding-left: 0.85rem;
}

.loader-stage-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: rgba(139, 151, 168, 0.35);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

.loader-stage-list li.is-done {
  color: rgba(201, 168, 76, 0.55);
}

.loader-stage-list li.is-done::before {
  background: rgba(201, 168, 76, 0.55);
}

.loader-stage-list li.is-active {
  color: var(--gold);
}

.loader-stage-list li.is-active::before {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.55);
}

.loader-caption {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.dashboard-panel.is-loading .tabs,
.dashboard-panel.is-loading .tab-panels {
  opacity: 0.28;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

@keyframes logoPulse {
  0%,
  100% {
    opacity: 0.72;
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(201, 168, 76, 0));
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
    filter: drop-shadow(0 0 10px rgba(201, 168, 76, 0.28));
  }
}

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

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--gold-faint);
  margin-bottom: 1rem;
  padding-bottom: 0.15rem;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel .content-block {
  display: block;
}

.tab-panel .content-block[hidden],
.tab-panel .empty-state[hidden] {
  display: none !important;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 1.35rem 1.1rem;
  text-align: center;
  border: 1px dashed rgba(201, 168, 76, 0.18);
  border-radius: 8px;
  max-width: 28rem;
  margin: 0.25rem 0 0;
}

.section-block {
  margin-bottom: 1.35rem;
}

.section-block:last-child {
  margin-bottom: 0;
}

/* Compact narrative tabs — card frames content instead of leaving void space */
.narrative-panel .content-block {
  background: var(--bg-inner);
  border: 1px solid var(--gold-faint);
  border-radius: 8px;
  padding: 1.15rem 1.25rem 1.25rem;
}

.narrative-panel .section-block h3 {
  margin-bottom: 0.65rem;
}

.narrative-panel .prose {
  max-width: 52rem;
}

#tab-recommendation.narrative-panel .content-block {
  padding-top: 1rem;
}

#tab-recommendation .rec-banner {
  margin-bottom: 1rem;
}

#tab-recommendation .section-block {
  margin-bottom: 0;
}

.section-block h3 {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.prose {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.prose p {
  margin: 0 0 0.75rem;
}

/* Financials */
.score-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.health-score {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.9rem 1.15rem;
  min-width: 180px;
}

.score-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.score-value {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 500;
  color: var(--gold);
  line-height: 1.2;
  margin: 0.2rem 0;
}

.score-tier {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.score-tier.strong {
  color: var(--green);
}

.score-tier.adequate {
  color: var(--amber);
}

.score-tier.weak {
  color: var(--red);
}

.score-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  max-width: 320px;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.25rem;
  border: 1px solid var(--gold-faint);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: rgba(3, 8, 16, 0.7);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--gold-faint);
}

.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(201, 168, 76, 0.08);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.data-table td:first-child {
  font-family: var(--font);
  color: var(--text);
  font-weight: 500;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: rgba(201, 168, 76, 0.04);
}

.metric-strong {
  color: var(--green);
}

.metric-moderate {
  color: var(--amber);
}

.metric-weak {
  color: var(--red);
}

.metric-na {
  color: var(--text-muted);
}

.metric-context {
  margin-top: 0.35rem;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-muted);
  max-width: 280px;
}

/* Risks */
.overall-risk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.1rem;
  background: var(--bg-inner);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.overall-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

.severity-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.severity-badge.low {
  color: var(--green);
  background: var(--green-bg);
  border-color: rgba(61, 155, 110, 0.35);
}

.severity-badge.medium {
  color: var(--amber);
  background: var(--amber-bg);
  border-color: rgba(201, 162, 74, 0.35);
}

.severity-badge.high {
  color: var(--red);
  background: var(--red-bg);
  border-color: rgba(196, 92, 92, 0.35);
}

.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.risk-card {
  background: var(--bg-inner);
  border: 1px solid var(--gold-faint);
  border-radius: 8px;
  padding: 0.95rem 1rem;
}

.risk-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.risk-card h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.risk-card p {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.risk-mitigation {
  font-size: 0.78rem;
  color: var(--text);
  border-top: 1px solid var(--gold-faint);
  padding-top: 0.5rem;
}

.risk-mitigation strong {
  color: var(--gold);
  font-weight: 500;
}

/* Recommendation */
.rec-banner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.95rem 1.05rem;
  margin-bottom: 1.15rem;
  background: rgba(3, 8, 16, 0.45);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.narrative-panel .rec-banner {
  background: rgba(3, 8, 16, 0.55);
}

.rec-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rec-rating {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.rec-rating.strong-buy,
.rec-rating.buy {
  color: var(--green);
}

.rec-rating.hold {
  color: var(--amber);
}

.rec-rating.sell,
.rec-rating.strong-sell {
  color: var(--red);
}

/* Comparison */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.compare-col {
  background: var(--bg-inner);
  border: 1px solid var(--gold-faint);
  border-radius: 8px;
  padding: 1rem;
}

.compare-col h3 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.compare-col .compare-block {
  margin-bottom: 0.9rem;
}

.compare-col .compare-block h4 {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.compare-col .compare-block .prose {
  font-size: 0.82rem;
}

/* Report panel */
.report-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 110px);
}

.report-preview {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  background: rgba(3, 8, 16, 0.45);
  border: 1px solid var(--gold-faint);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.8rem;
}

.report-preview .rp-letterhead {
  border-bottom: 1px solid var(--gold);
  padding-bottom: 0.65rem;
  margin-bottom: 0.85rem;
}

.report-preview .rp-brand {
  font-weight: 700;
  letter-spacing: 0.2em;
  font-size: 1rem;
  color: var(--gold);
}

.report-preview .rp-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.35rem;
}

.report-preview h4 {
  margin: 0.9rem 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.report-preview p,
.report-preview .rp-body {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.78rem;
}

.report-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.72rem;
}

.report-preview th,
.report-preview td {
  border: 1px solid var(--gold-faint);
  padding: 0.35rem 0.45rem;
  text-align: left;
}

.report-preview .rp-rec {
  margin-top: 0.85rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--gold);
  font-weight: 600;
}

.report-preview .rp-divider {
  border: none;
  border-top: 1px solid var(--gold);
  margin: 1.25rem 0;
  opacity: 0.45;
}

/* Export PDF root — Goldman-style equity research note
   Kept off-flow for storage; PDF capture mounts a visible clone (see report.js). */
.report-export {
  position: absolute;
  left: 0;
  top: 0;
  width: 794px;
  background: #ffffff;
  color: #1a1a1a;
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  padding: 36px 48px 44px;
  box-sizing: border-box;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
  height: 0;
}

/* Visible capture clone used only during PDF generation */
.report-export.report-export-capture {
  visibility: visible !important;
  pointer-events: none !important;
  z-index: auto !important;
  overflow: visible !important;
  height: auto !important;
  position: relative !important;
  left: auto !important;
  top: auto !important;
}

/* Avoid flex pitfalls in html2canvas where possible */
.report-export-capture .ex-lh-top,
.report-export-capture .ex-rating-banner {
  display: block;
}

.report-export-capture .ex-lh-right {
  text-align: left;
  margin-top: 8px;
}

.report-export-capture .ex-rating-left,
.report-export-capture .ex-rating-right {
  display: block;
  text-align: left;
}

.report-export-capture .ex-rating-right {
  margin-top: 10px;
}

.report-export .ex-letterhead {
  margin-bottom: 18px;
}

.report-export .ex-lh-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.report-export .ex-brand {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #0b1f3a;
  line-height: 1;
}

.report-export .ex-brand-sub {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7399c6;
}

.report-export .ex-lh-right {
  text-align: right;
}

.report-export .ex-desk {
  font-size: 11px;
  font-weight: 600;
  color: #0b1f3a;
  letter-spacing: 0.04em;
}

.report-export .ex-desk-sub {
  font-size: 10px;
  color: #5a6575;
  margin-top: 2px;
}

.report-export .ex-lh-bar {
  height: 3px;
  margin-top: 12px;
  background: linear-gradient(90deg, #0b1f3a 0%, #0b1f3a 62%, #c9a84c 62%, #c9a84c 100%);
}

.report-export .ex-lh-tag {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5a6575;
}

.report-export .ex-title-block {
  margin: 18px 0 14px;
}

.report-export .ex-company-name {
  font-size: 22px;
  font-weight: 700;
  color: #0b1f3a;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.report-export .ex-company-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #5a6575;
}

.report-export .ex-rating-banner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid #d5dbe3;
  background: #f5f7fa;
}

.report-export .ex-rating-banner.ex-rating-buy {
  border-left: 4px solid #1f7a4c;
  background: #f3faf6;
}

.report-export .ex-rating-banner.ex-rating-sell {
  border-left: 4px solid #b33b3b;
  background: #fbf4f4;
}

.report-export .ex-rating-banner.ex-rating-hold,
.report-export .ex-rating-banner.ex-rating-neutral {
  border-left: 4px solid #c9a84c;
  background: #faf8f2;
}

.report-export .ex-rating-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5a6575;
  font-weight: 600;
}

.report-export .ex-rating-value {
  font-size: 22px;
  font-weight: 700;
  color: #0b1f3a;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.report-export .ex-rating-buy .ex-rating-value {
  color: #1f7a4c;
}

.report-export .ex-rating-sell .ex-rating-value {
  color: #b33b3b;
}

.report-export .ex-rating-right {
  font-size: 10.5px;
  color: #3a4555;
  line-height: 1.7;
  text-align: right;
}

.report-export .ex-k {
  display: inline-block;
  min-width: 110px;
  color: #7a8594;
  font-weight: 500;
  text-align: left;
  margin-right: 8px;
}

.report-export .ex-snapshot {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  margin: 0 0 18px;
}

.report-export .ex-snapshot th {
  width: 18%;
  background: #0b1f3a;
  color: #ffffff;
  font-weight: 600;
  text-align: left;
  padding: 7px 8px;
  border: 1px solid #0b1f3a;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 9px;
}

.report-export .ex-snapshot td {
  width: 32%;
  padding: 7px 8px;
  border: 1px solid #d5dbe3;
  color: #1a2332;
  background: #fff;
}

.report-export .ex-rating-inline.ex-rating-buy {
  color: #1f7a4c;
  font-weight: 700;
}

.report-export .ex-rating-inline.ex-rating-sell {
  color: #b33b3b;
  font-weight: 700;
}

.report-export .ex-section {
  margin-bottom: 16px;
}

.report-export h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #0b1f3a;
  border-bottom: 1px solid #0b1f3a;
  padding-bottom: 6px;
  margin: 0 0 10px;
  font-weight: 700;
}

.report-export .ex-sec-num {
  color: #c9a84c;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.report-export .ex-body {
  font-size: 11px;
  line-height: 1.65;
  color: #1a2332;
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.report-export .ex-table-caption {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5a6575;
  margin: 10px 0 6px;
}

.report-export table.ex-data {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  margin: 0 0 12px;
}

.report-export table.ex-data th {
  background: #eef2f7;
  text-align: left;
  padding: 7px 8px;
  border: 1px solid #cfd6e0;
  color: #0b1f3a;
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-export table.ex-data td {
  padding: 7px 8px;
  border: 1px solid #dce2ea;
  color: #1a2332;
  vertical-align: top;
}

.report-export table.ex-data tr:nth-child(even) td {
  background: #fafbfd;
}

.report-export .ex-metric-name {
  font-weight: 600;
  color: #0b1f3a;
}

.report-export .ex-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.report-export .ex-risk-overall {
  font-size: 11px;
  color: #3a4555;
  margin-bottom: 8px;
}

.report-export .ex-sev {
  display: inline-block;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
}

.report-export .ex-sev-low {
  color: #1f7a4c;
  background: #e7f5ee;
}

.report-export .ex-sev-medium {
  color: #8a6a12;
  background: #f8f1d8;
}

.report-export .ex-sev-high {
  color: #b33b3b;
  background: #f8e8e8;
}

.report-export .ex-rec {
  margin: 8px 0 12px;
  padding: 12px 14px;
  border: 1px solid #0b1f3a;
  background: #f5f7fa;
}

.report-export .ex-rec.ex-rating-buy {
  border-color: #1f7a4c;
  background: #f3faf6;
}

.report-export .ex-rec.ex-rating-sell {
  border-color: #b33b3b;
  background: #fbf4f4;
}

.report-export .ex-rec-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5a6575;
  font-weight: 600;
}

.report-export .ex-rec-value {
  font-size: 18px;
  font-weight: 700;
  color: #0b1f3a;
  margin-top: 3px;
}

.report-export .ex-footer {
  margin-top: 28px;
  padding-top: 12px;
  border-top: 2px solid #0b1f3a;
}

.report-export .ex-footer-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0b1f3a;
  margin-bottom: 6px;
}

.report-export .ex-footer p {
  margin: 0;
  font-size: 8.5px;
  line-height: 1.5;
  color: #6b7380;
}

.report-export .ex-company-block {
  margin-top: 8px;
}

.report-export .ex-page-break {
  page-break-before: always;
  break-before: page;
  height: 0;
  margin: 0;
  padding: 0;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.45s ease both;
}

.tab-panel.active .content-block {
  animation: fadeIn 0.35s ease both;
}

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

/* Responsive */
@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr 1fr;
  }

  .report-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }

  .report-preview {
    max-height: 360px;
  }
}

@media (max-width: 820px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 0.75rem;
  }

  .dashboard-panel,
  .report-panel {
    min-height: 0;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}
