:root {
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --ink: #17202a;
  --muted: #435166;
  --line: #c7beaf;
  --accent: #0a6c74;
  --accent-soft: #d6eeef;
  --positive: #186a3b;
  --negative: #8e2d2d;
  --neutral: #786a56;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Calibri, Candara, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(10, 108, 116, 0.08), transparent 30%),
    linear-gradient(180deg, #f9f5ee 0%, var(--bg) 100%);
}

.comparables-page,
.expectations-page {
  --muted: #33465a;
  --line: #bdb19f;
}

.page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px 22px 32px;
}

.hero,
.panel,
.metric-card {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(31, 37, 48, 0.06);
}

.hero {
  border-radius: 24px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 3.3vw, 46px);
  line-height: 0.98;
  font-family: Calibri, Candara, "Segoe UI", Arial, sans-serif;
  font-weight: 700;
}

h2,
h3,
.primary,
th {
  font-family: Calibri, Candara, "Segoe UI", Arial, sans-serif;
}

.lede {
  max-width: 720px;
  color: var(--muted);
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.28;
}

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

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 14px;
}

.two-up {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.metric-card {
  border-radius: 20px;
  padding: 16px 18px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 28px;
  line-height: 1;
  margin: 0;
}

.metric-value-small {
  font-size: 22px;
}

.panel {
  border-radius: 22px;
  padding: 14px 16px 10px;
  margin-bottom: 14px;
}

.workspace-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
}

.workspace-nav-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace-nav-header {
  min-width: 220px;
}

.workspace-nav-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.workspace-nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.auth-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.auth-status strong {
  color: var(--ink);
  font-weight: 700;
}

.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.auth-link:hover {
  text-decoration: underline;
}

.workspace-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.1;
}

.workspace-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.workspace-tab:disabled {
  opacity: 0.65;
  cursor: default;
}

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

.login-shell {
  width: min(100%, 560px);
}

.login-panel {
  padding: 24px;
}

.login-copy {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.login-provider-list {
  display: grid;
  gap: 12px;
}

.login-provider-button {
  width: 100%;
  justify-content: center;
}

.login-message {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}

.login-message.error {
  background: rgba(142, 45, 45, 0.08);
  border: 1px solid rgba(142, 45, 45, 0.18);
  color: var(--negative);
}

.login-message.info {
  background: rgba(10, 108, 116, 0.08);
  border: 1px solid rgba(10, 108, 116, 0.18);
  color: var(--accent);
}

.buildout-panel {
  padding-bottom: 14px;
}

.buildout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.buildout-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  padding: 14px 14px 12px;
}

.buildout-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.buildout-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.22;
}

.buildout-kicker {
  color: var(--accent) !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px !important;
  font-weight: 700;
  margin-bottom: 8px !important;
}

.buildout-card-active {
  background: rgba(214, 238, 239, 0.42);
  border-color: rgba(10, 108, 116, 0.28);
}

.guide-panel details[open],
.collapsible-panel details[open] {
  padding-bottom: 8px;
}

.guide-panel summary,
.collapsible-panel summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.guide-panel summary::-webkit-details-marker,
.collapsible-panel summary::-webkit-details-marker {
  display: none;
}

.guide-panel summary::after,
.collapsible-panel summary::after {
  content: " +";
  color: var(--accent);
}

.guide-panel details[open] summary::after,
.collapsible-panel details[open] summary::after {
  content: " -";
}

.collapsible-copy {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.22;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.guide-grid p {
  color: var(--muted);
  margin-bottom: 10px;
}

.guide-grid strong {
  color: var(--ink);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 10px;
}

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

.builder-form {
  display: grid;
  gap: 12px;
}

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

.field-group {
  display: grid;
  gap: 6px;
  grid-column: span 3;
}

.field-group-wide {
  grid-column: span 5;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.builder-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.builder-advanced {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.builder-advanced summary {
  cursor: pointer;
  font-weight: 600;
}

.builder-help {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.builder-advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  align-items: center;
}

.builder-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  min-height: 38px;
}

.checkbox-field input {
  min-width: auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

.status-banner {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.22;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.status-banner.success {
  border-color: rgba(24, 106, 59, 0.28);
  background: #edf8f0;
  color: var(--positive);
}

.status-banner.error {
  border-color: rgba(142, 45, 45, 0.28);
  background: #fdf0f0;
  color: var(--negative);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.quick-filter-row {
  margin-top: -2px;
}

input,
select,
.button,
.ghost-button {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  font: inherit;
  background: #fff;
}

input {
  min-width: 220px;
}

#search {
  flex: 1 1 280px;
}

#date_from,
#date_to,
#signal,
#sort_by {
  flex: 1 1 160px;
}

.button,
.ghost-button,
input,
select {
  font-size: 13px;
  line-height: 1.15;
}

input,
select {
  color: var(--ink);
}

input::placeholder {
  color: #5f6c7d;
  opacity: 1;
}

.button {
  cursor: pointer;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.ghost-button {
  cursor: pointer;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.92);
}

.ghost-button.is-active {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
}

.detail-panel[hidden] {
  display: none;
}

.detail-metrics {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.trend-story {
  margin: -2px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.8);
}

.trend-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.decision-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.decision-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  padding: 12px 14px;
}

.decision-primary {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.08;
  font-weight: 700;
  color: var(--ink);
}

.decision-secondary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.22;
}

.trend-subsection h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.trend-subsection .table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.55);
}

.trend-story p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.comparison-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 2px 0 14px;
}

.trail-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.trail-chip.is-active {
  background: rgba(10, 108, 116, 0.08);
  border-color: rgba(10, 108, 116, 0.35);
}

.trail-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trail-value {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
}

.trail-detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.trail-separator {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.decision-driver-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.decision-driver-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  padding: 12px 14px;
}

.opportunity-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.opportunity-panel {
  margin-bottom: 0;
  padding: 12px 14px;
}

.opportunity-list {
  display: grid;
  gap: 8px;
}

.opportunity-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
}

.opportunity-item:hover,
.opportunity-item:focus-visible {
  background: rgba(10, 108, 116, 0.05);
  outline: 2px solid rgba(10, 108, 116, 0.18);
  outline-offset: 0;
}

.opportunity-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.decision-driver-primary {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--ink);
}

.decision-peer-examples {
  margin-top: 10px;
}

.compact-header {
  margin-bottom: 8px;
}

.compact-header h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.compact-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.filing-summary-metrics {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 0 0 10px;
}

.filing-summary-card {
  padding: 12px 14px;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

#filingsTable {
  min-width: 1360px;
  table-layout: fixed;
  font-size: 12.5px;
}

#filingsTable th:nth-child(1),
#filingsTable td:nth-child(1) {
  width: 9%;
}

#filingsTable th:nth-child(2),
#filingsTable td:nth-child(2) {
  width: 11%;
}

#filingsTable th:nth-child(3),
#filingsTable td:nth-child(3) {
  width: 24%;
}

#filingsTable th:nth-child(4),
#filingsTable td:nth-child(4) {
  width: 7%;
}

#filingsTable th:nth-child(5),
#filingsTable td:nth-child(5) {
  width: 21%;
}

#filingsTable th:nth-child(6),
#filingsTable td:nth-child(6) {
  width: 8%;
}

#filingsTable th:nth-child(7),
#filingsTable td:nth-child(7) {
  width: 8%;
}

#filingsTable th:nth-child(8),
#filingsTable td:nth-child(8) {
  width: 12%;
}

#companyTrendTable {
  min-width: 1200px;
}

#companyEventFamilyTable,
#companyProgressionTable,
#reliabilityTable,
#eventFamilyTable,
#progressionTable {
  min-width: 760px;
}

#cohortMembersTable,
#comparablesTable {
  min-width: 1120px;
}

#comparablesTable tbody tr.is-selected-row td {
  background: rgba(10, 108, 116, 0.08);
}

.cohort-history-button {
  white-space: nowrap;
}

#filingsTable tbody tr.clickable-row,
#cohortMembersTable tbody tr.clickable-row,
#comparablesPeerExamplesTable tbody tr.clickable-row {
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

#filingsTable tbody tr.clickable-row:hover td,
#filingsTable tbody tr.clickable-row:focus-visible td,
#cohortMembersTable tbody tr.clickable-row:hover td,
#cohortMembersTable tbody tr.clickable-row:focus-visible td,
#comparablesPeerExamplesTable tbody tr.clickable-row:hover td,
#comparablesPeerExamplesTable tbody tr.clickable-row:focus-visible td {
  background: rgba(10, 108, 116, 0.05);
}

#filingsTable tbody tr.clickable-row:focus-visible,
#cohortMembersTable tbody tr.clickable-row:focus-visible,
#comparablesPeerExamplesTable tbody tr.clickable-row:focus-visible {
  outline: 2px solid rgba(10, 108, 116, 0.35);
  outline-offset: 2px;
}

th,
td {
  padding: 8px 7px;
  vertical-align: top;
  border-top: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-top: none;
}

.primary {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.15;
}

.secondary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-top: 3px;
  line-height: 1.18;
}

.filing-summary,
.notes-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.filing-summary {
  -webkit-line-clamp: 3;
  max-height: 4.1em;
  overflow-wrap: anywhere;
}

.notes-preview {
  -webkit-line-clamp: 3;
  max-height: 3.7em;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  text-transform: capitalize;
  background: #efe7d9;
  color: var(--neutral);
}

.pill.positive {
  background: #ddf4e5;
  color: var(--positive);
}

.pill.negative {
  background: #f7dddd;
  color: var(--negative);
}

.pill.neutral {
  background: #efe7d9;
  color: var(--neutral);
}

.pill.high {
  background: #d8efe1;
  color: #0f6b44;
}

.pill.medium {
  background: #f3ead7;
  color: #8a5b11;
}

.pill.low {
  background: #e7e5e1;
  color: #5b6474;
}

.pill.timing-pre-market {
  background: #e4eefc;
  color: #2558a8;
}

.pill.timing-market-hours {
  background: #def5e4;
  color: #177245;
}

.pill.timing-after-hours {
  background: #ede4fb;
  color: #6a3eb0;
}

.pill.timing-weekend,
.pill.timing-unknown {
  background: #ece8e0;
  color: #6a675f;
}

.pill.relevance-reacted {
  background: #ddf4e5;
  color: #0f6b44;
}

.pill.relevance-pending {
  background: #fff1d9;
  color: #9b6113;
}

.pill.relevance-intraday {
  background: #e3f0ff;
  color: #2558a8;
}

.pill.relevance-session {
  background: #ebe5d7;
  color: #7c602d;
}

.pill.relevance-unknown {
  background: #ece8e0;
  color: #6a675f;
}

.inline-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.comparables-page .pill,
.expectations-page .pill {
  background: #ffffff;
  border: 1px solid rgba(199, 190, 175, 0.95);
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.04);
}

.comparables-page .pill.positive,
.expectations-page .pill.positive {
  background: #ffffff;
  border-color: rgba(24, 106, 59, 0.25);
}

.comparables-page .pill.negative,
.expectations-page .pill.negative {
  background: #ffffff;
  border-color: rgba(142, 45, 45, 0.25);
}

.comparables-page .pill.neutral,
.expectations-page .pill.neutral {
  background: #ffffff;
  border-color: rgba(120, 106, 86, 0.25);
}

.comparables-page .pill.high,
.expectations-page .pill.high {
  background: #ffffff;
  border-color: rgba(15, 107, 68, 0.25);
}

.comparables-page .pill.medium,
.expectations-page .pill.medium {
  background: #ffffff;
  border-color: rgba(138, 91, 17, 0.25);
}

.comparables-page .pill.low,
.expectations-page .pill.low {
  background: #ffffff;
  border-color: rgba(91, 100, 116, 0.25);
}

.expectations-page .pill.support-strong {
  background: #ffffff;
  color: #0f6b44;
  border-color: rgba(15, 107, 68, 0.25);
}

.expectations-page .pill.support-weak {
  background: #ffffff;
  color: #8a5b11;
  border-color: rgba(138, 91, 17, 0.25);
}

.expectations-page .pill.support-none {
  background: #ffffff;
  color: #5b6474;
  border-color: rgba(91, 100, 116, 0.25);
}

.comparables-page .chip-surface,
.expectations-page .chip-surface {
  background: #ffffff;
  border: 1px solid rgba(177, 165, 145, 0.95);
  border-radius: 10px;
  padding: 4px 6px;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.06);
}

.comparables-page .chip-surface + .chip-surface,
.expectations-page .chip-surface + .chip-surface {
  margin-top: 4px;
}

.comparables-page .workspace-nav-copy,
.comparables-page .lede,
.comparables-page .guide-grid p,
.comparables-page .builder-help,
.comparables-page .checkbox-field,
.comparables-page .compact-header p,
.comparables-page .decision-secondary,
.comparables-page .trail-detail,
.comparables-page .trail-label,
.comparables-page .secondary,
.expectations-page .workspace-nav-copy,
.expectations-page .lede,
.expectations-page .guide-grid p,
.expectations-page .builder-help,
.expectations-page .checkbox-field,
.expectations-page .compact-header p,
.expectations-page .decision-secondary,
.expectations-page .trail-detail,
.expectations-page .trail-label,
.expectations-page .secondary {
  color: #33465a;
}

.comparables-page .metric-label,
.comparables-page .field-label,
.comparables-page .builder-advanced summary,
.comparables-page .panel-header p,
.expectations-page .metric-label,
.expectations-page .field-label,
.expectations-page .builder-advanced summary,
.expectations-page .panel-header p {
  color: #41566d;
  font-weight: 700;
}

.comparables-page input::placeholder,
.comparables-page select,
.expectations-page input::placeholder,
.expectations-page select {
  color: #586c82;
}

.comparables-page .decision-card,
.comparables-page .decision-driver-card,
.comparables-page .trail-chip,
.expectations-page .decision-card,
.expectations-page .decision-driver-card,
.expectations-page .trail-chip {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(177, 165, 145, 0.95);
}

.comparables-page .primary,
.comparables-page .decision-driver-primary,
.comparables-page .trail-value,
.expectations-page .primary,
.expectations-page .decision-driver-primary,
.expectations-page .trail-value {
  color: #16212d;
}

#expectationsTable {
  min-width: 1420px;
  table-layout: fixed;
  font-size: 13px;
}

#expectationsTable th:nth-child(1),
#expectationsTable td:nth-child(1) {
  width: 10%;
}

#expectationsTable th:nth-child(2),
#expectationsTable td:nth-child(2) {
  width: 11%;
}

#expectationsTable th:nth-child(3),
#expectationsTable td:nth-child(3) {
  width: 18%;
}

#expectationsTable th:nth-child(4),
#expectationsTable td:nth-child(4) {
  width: 13%;
}

#expectationsTable th:nth-child(5),
#expectationsTable td:nth-child(5) {
  width: 12%;
}

#expectationsTable th:nth-child(6),
#expectationsTable td:nth-child(6) {
  width: 12%;
}

#expectationsTable th:nth-child(7),
#expectationsTable td:nth-child(7) {
  width: 10%;
}

#expectationsTable th:nth-child(8),
#expectationsTable td:nth-child(8) {
  width: 14%;
}

.expectations-layout {
  align-items: start;
}

.expectation-summary-card {
  padding: 12px 14px;
  border-radius: 16px;
}

@media (max-width: 1200px) {
  .page {
    padding: 16px 14px 28px;
  }

  .hero,
  .panel-header,
  .workspace-nav {
    flex-direction: column;
  }

  .hero {
    padding: 22px 18px;
    border-radius: 18px;
  }

  .workspace-nav {
    align-items: stretch;
  }

  .workspace-nav-tabs {
    justify-content: stretch;
  }

  .panel {
    padding: 16px 14px 10px;
    border-radius: 18px;
  }

  .metric-card {
    border-radius: 16px;
    padding: 16px;
  }

  .metrics,
  .two-up,
  .detail-metrics {
    grid-template-columns: 1fr;
  }

  .filters,
  .preset-row {
    width: 100%;
  }

  .builder-form {
    width: 100%;
  }

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

  .field-group,
  .field-group-wide {
    grid-column: auto;
  }

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

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

  input {
    min-width: 0;
    width: 100%;
  }

  select,
  .button,
  .ghost-button {
    width: 100%;
  }

  #search {
    grid-column: 1 / -1;
  }

  #date_from,
  #date_to,
  #signal,
  #sort_by,
  #filters .button {
    min-width: 0;
  }

  #filingsTable,
  #focusTable,
  #targetsTable,
  #reliabilityTable,
  #eventFamilyTable,
  #progressionTable,
  #comparablesTable,
  #companyEventFamilyTable,
  #companyProgressionTable,
  #companyTrendTable,
  #cohortMembersTable {
    min-width: 0;
    table-layout: auto;
  }

  #filingsTable thead,
  #focusTable thead,
  #targetsTable thead,
  #reliabilityTable thead,
  #eventFamilyTable thead,
  #progressionTable thead,
  #comparablesTable thead,
  #companyEventFamilyTable thead,
  #companyProgressionTable thead,
  #companyTrendTable thead,
  #cohortMembersTable thead {
    display: none;
  }

  #filingsTable,
  #focusTable,
  #targetsTable,
  #reliabilityTable,
  #eventFamilyTable,
  #progressionTable,
  #comparablesTable,
  #companyEventFamilyTable,
  #companyProgressionTable,
  #cohortMembersTable,
  #companyTrendTable,
  #filingsTable tbody,
  #focusTable tbody,
  #targetsTable tbody,
  #reliabilityTable tbody,
  #eventFamilyTable tbody,
  #progressionTable tbody,
  #comparablesTable tbody,
  #companyEventFamilyTable tbody,
  #companyProgressionTable tbody,
  #cohortMembersTable tbody,
  #companyTrendTable tbody,
  #filingsTable tr,
  #focusTable tr,
  #targetsTable tr,
  #reliabilityTable tr,
  #eventFamilyTable tr,
  #progressionTable tr,
  #comparablesTable tr,
  #companyEventFamilyTable tr,
  #companyProgressionTable tr,
  #cohortMembersTable tr,
  #companyTrendTable tr,
  #filingsTable td,
  #focusTable td,
  #targetsTable td,
  #reliabilityTable td,
  #eventFamilyTable td,
  #progressionTable td,
  #comparablesTable td,
  #companyEventFamilyTable td,
  #companyProgressionTable td,
  #cohortMembersTable td,
  #companyTrendTable td {
    display: block;
    width: 100%;
  }

  #filingsTable tr,
  #focusTable tr,
  #targetsTable tr,
  #reliabilityTable tr,
  #companyEventFamilyTable tr,
  #companyProgressionTable tr,
  #cohortMembersTable tr,
  #companyTrendTable tr {
    border-top: 1px solid var(--line);
    padding: 12px 0 8px;
    display: grid;
    gap: 6px 14px;
    background: rgba(255, 253, 248, 0.92);
    border-radius: 16px;
    margin-bottom: 12px;
  }

  #filingsTable tr,
  #companyTrendTable tr {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  #focusTable tr,
  #targetsTable tr,
  #reliabilityTable tr,
  #eventFamilyTable tr,
  #progressionTable tr,
  #comparablesTable tr,
  #companyEventFamilyTable tr,
  #companyProgressionTable tr,
  #cohortMembersTable tr {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  #filingsTable td,
  #focusTable td,
  #targetsTable td,
  #reliabilityTable td,
  #eventFamilyTable td,
  #progressionTable td,
  #comparablesTable td,
  #companyEventFamilyTable td,
  #companyProgressionTable td,
  #cohortMembersTable td,
  #companyTrendTable td {
    border-top: none;
    padding: 10px 10px 12px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(215, 208, 195, 0.85);
    border-radius: 14px;
    min-width: 0;
    width: auto;
  }

  #filingsTable td[data-label="Filing"],
  #filingsTable td[data-label="Notes"],
  #comparablesTable td[data-label="Filing"],
  #comparablesTable td[data-label="Notes"],
  #companyTrendTable td[data-label="Filing"],
  #companyTrendTable td[data-label="History"] {
    grid-column: 1 / -1;
  }

  #filingsTable td::before,
  #focusTable td::before,
  #targetsTable td::before,
  #reliabilityTable td::before,
  #eventFamilyTable td::before,
  #progressionTable td::before,
  #comparablesTable td::before,
  #companyEventFamilyTable td::before,
  #companyProgressionTable td::before,
  #cohortMembersTable td::before,
  #companyTrendTable td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
    text-transform: uppercase;
  }

  #filingsTable .primary,
  #companyTrendTable .primary,
  #focusTable .primary,
  #targetsTable .primary,
  #reliabilityTable .primary,
  #eventFamilyTable .primary,
  #progressionTable .primary,
  #comparablesTable .primary,
  #companyEventFamilyTable .primary,
  #companyProgressionTable .primary,
  #cohortMembersTable .primary {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #filingsTable .secondary,
  #companyTrendTable .secondary,
  #focusTable .secondary,
  #targetsTable .secondary,
  #reliabilityTable .secondary,
  #eventFamilyTable .secondary,
  #progressionTable .secondary,
  #comparablesTable .secondary,
  #companyEventFamilyTable .secondary,
  #companyProgressionTable .secondary,
  #cohortMembersTable .secondary {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .filing-summary,
  .notes-preview {
    -webkit-line-clamp: 5;
    max-height: none;
  }
}

@media (max-width: 520px) {
  .filters,
  .preset-row,
  #filingsTable tr,
  #companyTrendTable tr {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 36px;
  }

  .lede,
  .panel > p,
  .panel-header p {
    font-size: 15px;
  }

  .primary {
    font-size: 15px;
  }

  .secondary {
    font-size: 14px;
  }

  .metric-value {
    font-size: 28px;
  }
}
