@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=DM+Serif+Display:ital@0;1&display=swap");

:root {
  --navy: #0d1b2a;
  --navy-mid: #1b2a4a;
  --navy-light: #2a3f5f;
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --charcoal: #1e1e2e;
  --surface: #16213e;
  --surface-raised: #1a2744;
  --text-primary: #f0f4f8;
  --text-secondary: #8fa3b8;
  --text-muted: #4a6080;
  --border: rgba(201, 168, 76, 0.15);
  --border-active: rgba(201, 168, 76, 0.4);
  --success: #2ecc71;
  --danger: #e74c3c;
  --radius: 8px;
  --radius-lg: 12px;
}

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

html {
  scrollbar-color: var(--gold) var(--navy);
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: var(--text-primary);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  margin: 0 0 0.5rem;
}

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

a:hover {
  text-decoration: underline;
}

.site-header {
  flex-shrink: 0;
}

.nav-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 56px;
  padding: 0 1.25rem;
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.45);
}

.brand-name {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.25rem;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.65rem;
}

.main-content {
  flex: 1;
  padding: 2rem 1.25rem 2.5rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.site-footer {
  flex-shrink: 0;
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
}

.copyright {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* —— Upload screen —— */

.upload-screen-header {
  margin-bottom: 1.75rem;
}

.page-title {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 0.65rem;
  color: var(--text-primary);
}

.page-subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.drop-zone {
  position: relative;
  min-height: 220px;
  padding: 2rem 1.5rem;
  background: var(--surface);
  border: 2px dashed var(--border-active);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  outline: none;
  background: var(--surface-raised);
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.25);
}

.drop-zone--active {
  background: var(--surface-raised);
  border-color: var(--gold-light);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.2);
}

.drop-zone-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  pointer-events: none;
}

.drop-zone-icon {
  width: 72px;
  height: auto;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

.drop-zone-text {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.drop-zone-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 28rem;
  line-height: 1.4;
}

.field-group {
  margin-top: 1.75rem;
}

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.ticker-input {
  width: 100%;
  height: 44px;
  padding: 0 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--charcoal);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.ticker-input::placeholder {
  color: var(--text-muted);
}

.ticker-input:hover {
  border-color: var(--border-active);
}

.ticker-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

.file-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

@keyframes file-card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--surface-raised);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  animation: file-card-in 0.38s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
  .file-card {
    animation: none;
  }
}

.file-card-icon {
  flex-shrink: 0;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.file-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card-size {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-card-remove {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.file-card-remove:hover {
  color: var(--danger);
  background: rgba(231, 76, 60, 0.12);
}

.upload-feedback {
  margin: 1rem 0 0;
  min-height: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.upload-feedback--error {
  color: var(--danger);
}

.btn-analyse {
  margin-top: 1.75rem;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--gold);
  color: var(--navy);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease;
}

.btn-analyse:hover:not(:disabled) {
  background: var(--gold-light);
  transform: scale(1.02);
}

.btn-analyse:active:not(:disabled) {
  transform: scale(1);
}

.btn-analyse:disabled {
  background: rgba(201, 168, 76, 0.28);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.btn-analyse.btn-analyse--loading:disabled {
  background: var(--gold);
  color: var(--navy);
  cursor: wait;
  opacity: 1;
}

.btn-analyse--loading {
  pointer-events: none;
}

.btn-analyse-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid rgba(13, 27, 42, 0.25);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .btn-analyse:hover:not(:disabled) {
    transform: none;
  }

  .spinner {
    animation: none;
    border-top-color: transparent;
    border-color: var(--navy);
    opacity: 0.6;
  }
}

/* —— Analyse screen —— */

.main-content--analyse {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  width: 100%;
}

.analyse-page {
  width: 100%;
}

.analyse-company-bar {
  background: var(--surface);
  padding: 24px 1.25rem;
  border-bottom: 1px solid var(--border);
}

.analyse-company-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.65rem 1rem;
  margin-bottom: 0.85rem;
}

.analyse-ticker {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 1.1;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.analyse-company-name {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.analyse-doc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.doc-pill {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analyse-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.5rem;
  align-items: start;
  padding: 1.5rem 1.25rem 2.5rem;
}

@media (max-width: 960px) {
  .analyse-grid {
    grid-template-columns: 1fr;
  }
}

.analyse-output-col {
  min-width: 0;
}

.analyse-output-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.output-panel {
  position: relative;
  min-height: min(58vh, 560px);
  max-height: calc(100vh - 220px);
  background: var(--charcoal);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.output-copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  transition:
    border-color 0.2s ease,
    color 0.2s ease,
    background 0.2s ease;
}

.output-copy-btn:hover {
  border-color: var(--border-active);
  color: var(--gold-light);
}

.output-copy-feedback {
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
}

.output-copy-icon {
  flex-shrink: 0;
  display: block;
}

.output-panel-empty,
.output-panel-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}

.output-panel-body {
  flex: 1;
  overflow: auto;
  padding: 28px 52px 28px 28px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

@keyframes pulse-gold-dot {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.35);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
    box-shadow: 0 0 12px 2px rgba(201, 168, 76, 0.25);
  }
}

.output-empty-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  margin-bottom: 1rem;
  animation: pulse-gold-dot 2s ease-in-out infinite;
}

.output-empty-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .output-empty-dot {
    animation: none;
    opacity: 0.75;
  }
}

.output-loading-text {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.typing-indicator {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.35;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%,
  60%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing-indicator span {
    animation: none;
    opacity: 0.55;
  }
}

.markdown-body :first-child {
  margin-top: 0;
}

.markdown-body :last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  font-family: "DM Serif Display", Georgia, serif;
  color: var(--text-primary);
  margin-top: 1.25em;
  margin-bottom: 0.5em;
}

.markdown-body h1 {
  font-size: 1.5rem;
}

.markdown-body h2 {
  font-size: 1.25rem;
}

.markdown-body h3 {
  font-size: 1.1rem;
}

.markdown-body p {
  margin: 0 0 1em;
}

.markdown-body a {
  color: var(--gold-light);
}

.markdown-body code {
  font-size: 0.9em;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold-light);
}

.markdown-body pre {
  margin: 1em 0;
  padding: 1rem;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--navy);
  border: 1px solid var(--border);
}

.markdown-body pre code {
  padding: 0;
  background: none;
  color: var(--text-primary);
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1em;
  padding-left: 1.35em;
}

.markdown-body blockquote {
  margin: 1em 0;
  padding-left: 1rem;
  border-left: 3px solid var(--gold);
  color: var(--text-secondary);
}

.analyse-actions-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

.analysis-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.analysis-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  background: var(--surface-raised);
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.analysis-card:hover:not(:disabled):not(.analysis-card--active) {
  border-color: var(--border-active);
  background: #1f2d4a;
}

.analysis-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.analysis-card--active {
  border-color: var(--border);
  border-left-color: var(--gold);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.analysis-card:disabled {
  opacity: 0.65;
  cursor: wait;
}

.analysis-card--signature {
  padding-top: 2.5rem;
}

.analysis-card-badge {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--border-active);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: rgba(201, 168, 76, 0.08);
}

.analysis-card-icon {
  color: var(--gold);
  margin-bottom: 0.65rem;
  opacity: 0.95;
}

.analysis-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.analysis-card-desc {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.analyse-actions-footer {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 0.25rem;
}

.export-pdf-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  align-self: flex-start;
}

.export-pdf-link:hover {
  color: var(--gold-light);
  text-decoration: underline;
}

.btn-save-companies {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.btn-save-companies:hover {
  background: rgba(201, 168, 76, 0.12);
  border-color: var(--gold-light);
  color: var(--gold-light);
}

/* Sources panel & new analysis */

.sources-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--charcoal);
  overflow: hidden;
}

.sources-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 14px 16px;
  border: none;
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease;
}

.sources-toggle:hover {
  background: var(--surface-raised);
}

.sources-toggle-label {
  flex: 1;
}

.sources-chevron {
  flex-shrink: 0;
  color: var(--gold);
  transition: transform 0.25s ease;
}

.sources-section--open .sources-chevron {
  transform: rotate(180deg);
}

.sources-list {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.source-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.source-card-file {
  margin: 0 0 0.35rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
}

.source-card-section {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.source-card-excerpt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.btn-new-analysis {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-active);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.btn-new-analysis:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.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;
}

/* —— Companies library —— */

.main-content--companies {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  width: 100%;
}

.companies-page {
  width: 100%;
}

.companies-hero {
  margin-bottom: 1.75rem;
}

.companies-title {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
  color: var(--text-primary);
}

.companies-subtitle {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-secondary);
}

.companies-search-wrap {
  margin-bottom: 1.75rem;
}

.companies-search {
  width: 100%;
  max-width: 420px;
  height: 44px;
  padding: 0 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--charcoal);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.companies-search::placeholder {
  color: var(--text-muted);
}

.companies-search:hover {
  border-color: var(--border-active);
}

.companies-search:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

@media (max-width: 960px) {
  .company-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .company-grid {
    grid-template-columns: 1fr;
  }
}

.company-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.company-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-active);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.company-card-ticker {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--gold);
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.company-card-name {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
  line-height: 1.35;
}

.company-card-name--placeholder {
  color: var(--text-muted);
}

.company-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.analysis-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.45rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.analysis-badge--on {
  background: rgba(201, 168, 76, 0.22);
  color: var(--navy);
  border-color: rgba(201, 168, 76, 0.45);
}

.analysis-badge--off {
  background: rgba(74, 96, 128, 0.25);
  color: var(--text-muted);
  border-color: var(--border);
}

.company-card-updated {
  margin: 0;
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.companies-empty {
  margin: 2rem 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* —— Company detail (saved analyses) —— */

.main-content--company-detail {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  width: 100%;
}

.company-detail-empty {
  padding: 2rem 0;
  color: var(--text-secondary);
}

.company-detail-empty a {
  color: var(--gold-light);
}

.company-detail-back {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.company-detail-back a {
  color: var(--gold-light);
  text-decoration: none;
}

.company-detail-back a:hover {
  text-decoration: underline;
}

.company-detail-header {
  margin-bottom: 1.25rem;
}

.company-detail-ticker {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  color: var(--gold);
  margin: 0 0 0.35rem;
}

.company-detail-name {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-secondary);
}

.company-detail-meta {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.company-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.company-tab {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.company-tab:hover {
  border-color: var(--border-active);
  color: var(--text-primary);
}

.company-tab--active {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold-light);
}

.company-output-panel.output-panel--static {
  min-height: 320px;
  max-height: none;
}

.company-output-panel .output-panel-body {
  padding: 28px;
  min-height: 280px;
}

.company-output-empty {
  margin: 0;
  padding: 2rem 28px;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
}

/* —— Peer comparison —— */

.main-content--compare {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  width: 100%;
}

.compare-hero {
  margin-bottom: 1.75rem;
}

.compare-title {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
  color: var(--text-primary);
}

.compare-subtitle {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-secondary);
}

.compare-selectors {
  margin-bottom: 2rem;
}

.compare-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 900px) {
  .compare-slots {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .compare-slots {
    grid-template-columns: 1fr;
  }
}

.compare-slot {
  position: relative;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.compare-slot:hover {
  border-color: var(--border-active);
}

.compare-slot-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.compare-slot-head {
  min-height: 1.75rem;
  margin-bottom: 0.5rem;
}

.compare-slot-ticker {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.35rem;
  color: var(--gold);
  font-weight: 400;
}

.compare-select {
  width: 100%;
  height: 40px;
  padding: 0 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--charcoal);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
}

.compare-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

.compare-selectors-actions {
  margin-top: 1rem;
}

.btn-add-company {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border-active);
  background: transparent;
  color: var(--gold);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.btn-add-company:hover {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.08);
}

.compare-output-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.compare-table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.compare-matrix {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.compare-matrix thead th {
  padding: 0.75rem 0.65rem;
  text-align: center;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--charcoal);
}

.compare-matrix-corner {
  width: 140px;
  background: var(--navy-mid);
}

.compare-matrix-ticker {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.1rem;
  color: var(--gold);
}

.compare-matrix-ticker--empty {
  color: var(--text-muted);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.9rem;
}

.compare-matrix tbody th[scope="row"] {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-right: 1px solid var(--border);
  background: var(--navy-mid);
  white-space: nowrap;
}

.compare-matrix tbody td {
  padding: 0.65rem 0.75rem;
  text-align: center;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.compare-matrix tbody tr:nth-child(odd) td {
  background: var(--surface);
}

.compare-matrix tbody tr:nth-child(even) td {
  background: var(--surface-raised);
}

.compare-difference-box {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  background: var(--surface);
  padding: 1.1rem 1.25rem;
}

.compare-difference-title {
  margin: 0 0 0.65rem;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--text-primary);
}

.compare-difference-body {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.compare-difference-box .markdown-body {
  font-size: 0.92rem;
}

.compare-difference-placeholder {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.compare-run-wrap {
  display: flex;
  justify-content: center;
}

.btn-run-compare {
  min-width: 220px;
  height: 48px;
  padding: 0 1.5rem;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--gold);
  color: var(--navy);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease;
}

.btn-run-compare:hover:not(:disabled) {
  background: var(--gold-light);
  transform: scale(1.02);
}

.btn-run-compare:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.compare-stream-panel {
  position: relative;
  min-height: 200px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--charcoal);
  overflow: hidden;
}

.compare-stream-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--charcoal);
}

.compare-stream-loading-text {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.compare-stream-body {
  padding: 1.25rem 1.35rem;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  min-height: 120px;
}

.compare-stream-body:empty {
  min-height: 0;
  padding: 0;
}

.compare-export-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.btn-compare-export {
  height: 44px;
  padding: 0 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.btn-compare-export:hover {
  background: rgba(201, 168, 76, 0.12);
  border-color: var(--gold-light);
  color: var(--gold-light);
}

.btn-compare-copy {
  height: 44px;
  padding: 0 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    color 0.2s ease;
}

.btn-compare-copy:hover {
  border-color: var(--border-active);
  color: var(--gold-light);
}

.compare-copy-feedback {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
}
