:root {
  --canvas: #f5f5f0;
  --paper: #ffffff;
  --ink: #18231e;
  --ink-soft: #34423b;
  --muted: #68736d;
  --faint: #8d9691;
  --line: #dfe3df;
  --line-strong: #c9d0cb;
  --accent: #1f664b;
  --accent-dark: #174d39;
  --accent-soft: #e8f1ec;
  --warm: #9d5f20;
  --warning-soft: #f8efe3;
  --danger: #a13d36;
  --danger-soft: #f8eae8;
  --success: #2f7759;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-menu: 0 18px 50px rgba(24, 35, 30, 0.14);
  --font-body: "Avenir Next", "Segoe UI", sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --font-data: "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
summary:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(31, 102, 75, 0.25);
  outline-offset: 2px;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:visited {
  color: #6a4f76;
}

code {
  font-family: var(--font-data);
  font-size: 0.78rem;
}

.shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1200px) / 2));
  background: rgba(250, 250, 247, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: white;
  background: var(--ink);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.eyebrow,
.menu-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand .eyebrow {
  margin-bottom: 3px;
  font-size: 0.61rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-button,
.manage-menu > summary {
  min-height: 40px;
  padding: 9px 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  list-style: none;
}

.manage-menu > summary::-webkit-details-marker {
  display: none;
}

.nav-button:hover,
.manage-menu > summary:hover,
.manage-menu[open] > summary {
  color: var(--ink);
  background: #ecefe9;
}

.nav-button.active {
  color: white;
  background: var(--ink);
}

.header-refresh {
  min-height: 38px;
  margin-left: 8px;
  padding: 8px 13px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid #bdd3c6;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
}

.header-refresh:hover {
  background: #dcebe2;
}

.header-refresh:disabled {
  cursor: wait;
  opacity: 0.7;
}

.manage-menu {
  position: relative;
}

.manage-menu > summary::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 0 3px 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.manage-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(340px, calc(100vw - 24px));
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-menu);
}

.manage-popover .nav-button {
  display: block;
  width: 100%;
  text-align: left;
}

.manage-popover .nav-button.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.menu-label {
  padding: 4px 12px 8px;
}

.menu-divider {
  height: 1px;
  margin: 12px 0;
  background: var(--line);
}

.connection-state {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 12px;
}

.status-dot,
.signal-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(47, 119, 89, 0.12);
}

.connection-state strong {
  font-size: 0.85rem;
}

.connection-state p {
  margin: 2px 0 5px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.connection-state code {
  display: block;
  max-width: 270px;
  overflow: hidden;
  color: var(--faint);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.sidebar-actions .ghost-button:first-child {
  grid-column: 1 / -1;
}

.workspace {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding: 44px 0 88px;
}

.topbar {
  display: grid;
  grid-template-columns: 180px minmax(0, 720px);
  align-items: end;
  gap: 28px;
  margin-bottom: 32px;
}

.topbar h2,
.workspace h3,
.workspace h4 {
  margin: 0;
  color: var(--ink);
}

.topbar h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.top-search {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 56px;
  padding: 5px 6px 5px 18px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 5px 20px rgba(24, 35, 30, 0.04);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.top-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 102, 75, 0.09);
}

.search-icon {
  position: relative;
  display: block;
  width: 15px;
  height: 15px;
  border: 1.8px solid var(--muted);
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 7px;
  height: 1.8px;
  background: var(--muted);
  transform: rotate(45deg);
}

.top-search input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 1rem;
}

.top-search button,
.action-button {
  min-height: 44px;
  padding: 10px 18px;
  color: white;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  transition: background 150ms ease, transform 150ms ease;
}

.top-search button:hover,
.action-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.ghost-button,
.table-row-button,
.quick-searches button {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

.ghost-button:hover,
.table-row-button:hover,
.quick-searches button:hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: #b9cfc2;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-enter 220ms ease-out both;
}

.view[data-view="dashboard"] {
  display: none !important;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-home {
  max-width: 760px;
  padding: 30px 0 34px;
}

.search-home h3 {
  max-width: 680px;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.search-intro,
.hero-text {
  max-width: 660px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.quick-searches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
}

.quick-searches button {
  min-height: 34px;
  padding: 6px 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
}

.detail,
.stack-subtle {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.search-home .detail {
  margin: 20px 0 0;
}

.panel {
  min-width: 0;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.search-results-panel {
  padding: 0;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.search-results-panel > .section-header {
  align-items: center;
  margin: 0;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.section-header h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 5px 9px;
  color: var(--muted);
  background: #f1f3ef;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.search-result-card {
  padding: 25px 28px;
  border-bottom: 1px solid var(--line);
}

.search-result-card:last-child {
  border-bottom: 0;
}

.search-result-card:hover {
  background: #fafbf8;
}

.search-card-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 0.75rem;
}

.search-card-topline strong {
  margin-left: auto;
  color: var(--accent-dark);
  font-weight: 700;
  text-transform: capitalize;
}

.search-card-main {
  margin-top: 15px;
}

.search-card-main h4 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.search-card-main p {
  margin: 3px 0 0;
  color: var(--muted);
}

.search-card-recommendation {
  max-width: 880px;
  margin: 15px 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.search-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--faint);
  font-size: 0.74rem;
}

.search-card-footer > span:nth-of-type(3) {
  margin-left: auto;
}

.regulatory-link {
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.empty-state {
  padding: 38px 24px;
  color: var(--muted);
  text-align: center;
}

.forecast-workspace,
.analysis-layout,
.workspace-grid,
.panel-grid.two-up {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 20px;
}

.forecast-output-panel {
  position: sticky;
  top: 96px;
  align-self: start;
  min-height: 430px;
  background: #fbfcf9;
}

.editor-card {
  display: grid;
  gap: 17px;
}

.forecast-input-panel .editor-card,
.training-control .editor-card {
  padding: 0;
  background: transparent;
  border: 0;
}

.forecast-field-grid,
.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.form-field > span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fcfcfa;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: 0;
}

.form-field textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.55;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  background: var(--paper);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 102, 75, 0.08);
}

.optional-fields {
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}

.regulatory-lookup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 16px;
  background: #f6f8f5;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.regulatory-lookup strong {
  font-size: 0.9rem;
}

.regulatory-lookup p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.regulatory-result {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #fbfcf9;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.regulatory-result[hidden] {
  display: none;
}

.regulatory-result-header,
.regulatory-authority-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.regulatory-result-header > div {
  display: grid;
}

.regulatory-result-header > span {
  color: var(--faint);
  font-size: 0.7rem;
}

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

.regulatory-authority {
  min-width: 0;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.regulatory-authority-title span {
  padding: 3px 7px;
  color: var(--muted);
  background: #eef0ed;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: right;
}

.regulatory-confirmed-approved-record .regulatory-authority-title span,
.regulatory-confirmed-authorised-record .regulatory-authority-title span {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.regulatory-source-unavailable .regulatory-authority-title span {
  color: var(--danger);
  background: var(--danger-soft);
}

.regulatory-matches {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.regulatory-matches article {
  display: grid;
  gap: 2px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.regulatory-matches span,
.regulatory-matches small,
.regulatory-matches p,
.regulatory-scope,
.regulatory-disclaimer,
.regulatory-notice {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.regulatory-matches p,
.regulatory-scope,
.regulatory-disclaimer {
  margin: 0;
}

.regulatory-matches a,
.regulatory-authority > a {
  width: fit-content;
  font-size: 0.72rem;
}

.regulatory-disclaimer {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

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

.optional-fields summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}

.optional-fields[open] summary {
  margin-bottom: 16px;
}

.optional-fields .form-field + .form-field,
.optional-fields .forecast-field-grid + .form-field {
  margin-top: 14px;
}

.forecast-result-card {
  padding: 20px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.forecast-result-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.forecast-result-main strong {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500;
  text-transform: capitalize;
}

.forecast-result-main span {
  color: var(--accent-dark);
  font-weight: 700;
}

.probability-grid,
.stack-list,
.pipeline-steps {
  display: grid;
  gap: 8px;
}

.probability-row {
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(80px, 1fr) 42px;
  align-items: center;
  gap: 10px;
}

.probability-bar,
.outcome-track {
  height: 6px;
  overflow: hidden;
  background: #e8ebe8;
  border-radius: 999px;
}

.probability-fill,
.outcome-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.outcome-pill {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  color: var(--ink-soft);
  background: #eef0ed;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
}

.outcome-approved,
.outcome-approved-with-conditions {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.outcome-rejected {
  color: var(--danger);
  background: var(--danger-soft);
}

.outcome-deferred {
  color: var(--warm);
  background: var(--warning-soft);
}

.panel-grid {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.analysis-hero,
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 28px;
  padding: 18px 0 28px;
  border-bottom: 1px solid var(--line-strong);
}

.analysis-hero h3,
.hero-copy h3 {
  max-width: 700px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.03;
}

.analysis-source-card {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 12px;
  min-width: 260px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.analysis-source-card p {
  margin: 2px 0 0;
}

.analysis-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.analysis-filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  grid-column: span 2;
}

.analysis-kpis,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.analysis-kpi,
.stat-card {
  min-width: 0;
  padding: 18px;
  background: var(--paper);
}

.analysis-kpi strong,
.stat-card h3 {
  display: block;
  margin: 8px 0 3px;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 500;
}

.analysis-kpi p,
.stat-card p {
  margin: 0;
}

.analysis-layout {
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.5fr);
  margin-bottom: 20px;
}

.analysis-chart {
  min-height: 330px;
  overflow-x: auto;
}

.chart-grid {
  stroke: #e5e8e5;
  stroke-width: 1;
}

.chart-axis,
.chart-label {
  fill: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
}

.chart-bar,
.chart-line,
.chart-point {
  fill: var(--accent);
  stroke: var(--accent);
}

.chart-line {
  fill: none;
  stroke-width: 3;
}

.stacked-chart {
  display: grid;
  gap: 14px;
}

.stacked-year {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.stacked-track {
  display: flex;
  height: 28px;
  overflow: hidden;
  background: #ecefeb;
  border-radius: 4px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.75rem;
}

.outcome-row {
  display: grid;
  gap: 7px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.outcome-row:last-child {
  border-bottom: 0;
}

.outcome-row-header,
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.analysis-methodology {
  margin-top: 18px;
  padding: 15px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}

.analysis-methodology p {
  margin: 3px 0 0;
}

.hero-side-card {
  min-width: 260px;
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.hero-side-card .form-field {
  margin: 15px 0;
}

.hero-side-card .action-button {
  width: 100%;
}

.list-row,
.pipeline-step {
  min-height: 52px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.list-row:last-child,
.pipeline-step:last-child {
  border-bottom: 0;
}

.list-meta {
  display: grid;
  min-width: 0;
}

.list-meta span {
  overflow-wrap: anywhere;
}

.pipeline-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pipeline-step p {
  margin: 3px 0 0;
}

.workspace-grid {
  align-items: start;
}

.workspace-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
}

.table-shell {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

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

th {
  color: var(--muted);
  background: #f6f7f4;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fafbf8;
}

.forecast-workspace + .panel-grid,
.view[data-view="review"] > .panel,
.view[data-view="ingestion"] > .panel,
.view[data-view="analysis"] > .panel {
  margin-top: 20px;
}

@media (max-width: 960px) {
  .workspace {
    width: min(100% - 32px, 760px);
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .topbar > div:first-child {
    display: none;
  }

  .forecast-workspace,
  .analysis-layout,
  .workspace-grid,
  .panel-grid.two-up {
    grid-template-columns: 1fr;
  }

  .forecast-output-panel {
    position: static;
  }

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

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

  .analysis-hero,
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .analysis-source-card,
  .hero-side,
  .hero-side-card {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .app-header {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }

  .nav {
    width: 100%;
    flex-wrap: wrap;
    overflow: visible;
  }

  .nav-button,
  .manage-menu > summary,
  .header-refresh {
    min-height: 38px;
    padding: 8px 11px;
    font-size: 0.8rem;
  }

  .manage-menu {
    margin-left: 0;
  }

  .header-refresh {
    order: 5;
    margin-left: 0;
  }

  .manage-popover {
    position: fixed;
    top: 118px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .workspace {
    width: calc(100% - 24px);
    padding: 24px 0 56px;
  }

  .topbar {
    margin-bottom: 20px;
  }

  .top-search {
    grid-template-columns: 20px minmax(0, 1fr);
    padding: 7px 12px 7px 16px;
  }

  .top-search button {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 4px;
  }

  .search-home {
    padding: 24px 2px 28px;
  }

  .search-home h3 {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: clamp(2.25rem, 11.5vw, 2.8rem);
    line-height: 1;
  }

  .search-intro,
  .hero-text,
  .search-home .detail {
    overflow-wrap: anywhere;
  }

  .panel,
  .search-result-card {
    padding: 18px;
  }

  .search-results-panel {
    padding: 0;
  }

  .search-results-panel > .section-header {
    padding: 17px 18px;
  }

  .search-card-topline strong,
  .search-card-footer > span:nth-of-type(3) {
    width: 100%;
    margin-left: 0;
  }

  .regulatory-lookup,
  .regulatory-result-header,
  .regulatory-authority-title {
    align-items: stretch;
    flex-direction: column;
  }

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

  .forecast-field-grid,
  .compact-grid,
  .analysis-filter-panel,
  .analysis-kpis,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .analysis-filter-actions {
    grid-column: auto;
  }

  .analysis-hero h3,
  .hero-copy h3 {
    font-size: 2.25rem;
  }

  .probability-row {
    grid-template-columns: minmax(95px, auto) 1fr 38px;
  }

  .panel-grid.two-up {
    gap: 12px;
  }

  .table-shell {
    border: 0;
    border-radius: 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    margin-bottom: 12px;
    padding: 10px;
    background: #fafbf8;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
  }

  td {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr);
    gap: 10px;
    padding: 7px;
    border: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
