:root {
  /* COLORS */
  --canvas: #f4f1ea;
  --canvas-deep: #ece5da;
  --paper: rgba(255, 252, 246, 0.94);
  --paper-strong: #fffdf9;
  --paper-muted: #efe6d7;
  --paper-accent: #e7dac7;
  --ink: #2b241d;
  --ink-soft: #5b4d40;
  --ink-muted: #7c6a58;
  --line: #d6c4b2;
  --line-strong: #a99078;
  --brown: #7d5c45;
  --brown-strong: #5c4436;
  --terracotta: #b86d3c;
  --forest: #1d6c53;
  --rust: #a83d2e;
  --shadow-soft: 0 18px 40px rgba(54, 39, 26, 0.08);
  --shadow-strong: 0 28px 68px rgba(54, 39, 26, 0.14);

  /* TYPOGRAPHY */
  --font-sans: "Aptos", "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Aptos", "Segoe UI Variable Display", "Segoe UI", Arial, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;

  /* LAYOUT */
  --gutter: clamp(16px, 3vw, 28px);
  --panel-radius: 24px;
  --tight-radius: 14px;

  /* AUTHORITATIVE SIZE VARIABLES - JS and layout code read these */
  /* WIDTH hierarchy: infinite page/container, fixed spine, computed panels/orbit */
  --max-panel-width: 980px;                 /* upper clamp for computed panel widths */
  --panel-default-width: 448px;             /* default/fallback panel width */
  --workspace-spine-width: 360px;           /* fixed pixel width for center spine (anchor) */
  --orbit-world-min-width: 2600px;          /* minimum orbital world width */

  /* HEIGHT hierarchy: viewport-fill page, flexible container, computed orbit/panels */
  --orbit-world-min-height: 2500px;         /* minimum orbital world height */
  --workspace-orbit-min-height: 480px;      /* minimum orbit container height (when empty) */
  --orbit-world-padding: 520px;             /* padding used when computing world extents */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: none;
}

html {
  overflow-x: visible;
  overflow-y: visible;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
  /* Allow full horizontal expansion; no maximum width */
  width: auto;
  max-width: none;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(184, 109, 60, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(29, 108, 83, 0.1), transparent 24%),
    linear-gradient(180deg, #f7f3eb 0%, var(--canvas) 42%, #eee6da 100%);
  line-height: 1.5;
  overscroll-behavior-x: auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(106, 119, 99, 0.035) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 18%, rgba(67, 80, 68, 0.04) 100%);
  opacity: 0.85;
  z-index: 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(39, 48, 40, 0.52);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 1100;
}

.modal-container {
  width: min(1080px, calc(100vw - 32px));
  max-height: min(88vh, 980px);
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: linear-gradient(180deg, rgba(252, 250, 245, 0.98), rgba(238, 234, 225, 0.98));
  border: 1px solid rgba(106, 119, 99, 0.22);
  border-radius: 24px;
  box-shadow: 0 28px 72px rgba(43, 36, 29, 0.24);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  background: rgba(231, 224, 210, 0.72);
  border-bottom: 1px solid rgba(106, 119, 99, 0.14);
}

.modal-header h3 {
  font-family: "Aptos", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #435044;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(106, 119, 99, 0.22);
  background: rgba(255, 253, 249, 0.92);
  color: #435044;
  cursor: pointer;
  font-size: 1.2rem;
}

.modal-body {
  padding: 20px 22px 24px;
  overflow: auto;
  color: #273028;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid rgba(106, 119, 99, 0.14);
  border-bottom: 0;
}

.modal-footer .btn {
  min-width: 120px;
}

@media (max-width: 720px) {
  .modal-overlay {
    padding: 12px;
  }

  .modal-container {
    border-radius: 18px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}


/* Magnetic | Gravitational Orbit */
.workspace-orbit {
  position: relative;
  display: block;
  width: 100%;
  /* Height grows with content; computed world height via --orbit-world-height sets pseudo-element size */
  min-height: var(--workspace-orbit-min-height, 480px);
  overflow: auto;
  padding: 0;
  scroll-padding-inline: var(--orbit-scroll-padding, 72px);
  scroll-padding-block: var(--orbit-scroll-padding, 72px);
  overscroll-behavior: none;
  touch-action: none;
  cursor: grab;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.34), transparent 42%),
    repeating-linear-gradient(0deg, rgba(106, 119, 99, 0.05) 0 1px, transparent 1px 180px),
    repeating-linear-gradient(90deg, rgba(180, 110, 67, 0.05) 0 1px, transparent 1px 180px),
    linear-gradient(180deg, rgba(255, 252, 246, 0.18), rgba(231, 224, 210, 0.14));
}

.workspace-orbit.is-panning {
  cursor: grabbing;
}

.workspace-orbit.is-panning,
.workspace-orbit.is-panning * {
  user-select: none;
}

.workspace-orbit::before {
  content: "";
  display: block;
  /* The orbital world size is driven by JS via --orbit-world-width/height */
  width: var(--orbit-world-width, auto);
  height: var(--orbit-world-height, var(--orbit-world-min-height));
}

.workspace-spine {
  position: absolute;
  gap: 18px;
  width: clamp(320px, 28vw, 430px);
  min-width: 300px;
  max-width: 430px;
  z-index: 2;
}

.workspace-orbit .tab-content.active {
  position: absolute;
  width: var(--panel-measured-width, 448px);
  min-width: 0;
  max-width: none;
  z-index: 2;
  transition: opacity 0.24s ease, transform 0.24s ease, width 0.28s ease, top 0.3s ease, left 0.3s ease, box-shadow 0.24s ease;
}

.workspace-orbit .tab-content.active:hover {
  box-shadow: 0 26px 60px rgba(36, 43, 34, 0.14);
}

.workspace-orbit {
  scrollbar-color: rgba(106, 119, 99, 0.5) rgba(231, 224, 210, 0.6);
  scrollbar-width: thin;
}

.workspace-orbit::-webkit-scrollbar {
  height: 12px;
}

.workspace-orbit::-webkit-scrollbar-thumb {
  background: rgba(106, 119, 99, 0.42);
  border-radius: 999px;
}

.workspace-orbit::-webkit-scrollbar-track {
  background: rgba(231, 224, 210, 0.58);
  border-radius: 999px;
}



.orbit-detail-panel {
  background:
    linear-gradient(180deg, rgba(252, 250, 245, 0.99), rgba(240, 235, 225, 0.98));
}

.detail-panel-head {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding-right: 90px;
}

.detail-panel-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.detail-panel-copy {
  color: var(--ink-soft);
}

.detail-panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-panel-meta span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(106, 119, 99, 0.18);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

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

.detail-panel-block {
  grid-column: span 12;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(106, 119, 99, 0.16);
  background: rgba(255, 255, 255, 0.56);
}

.detail-panel-block-wide {
  grid-column: span 12;
}

.detail-panel-block h3 {
  margin-bottom: 6px;
}

.detail-panel-chart {
  display: grid;
  gap: 12px;
}

.detail-panel-chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.detail-chart-axis,
.detail-chart-grid {
  fill: none;
  stroke: rgba(106, 119, 99, 0.18);
  stroke-width: 1;
}

.detail-chart-axis {
  stroke: rgba(67, 80, 68, 0.3);
}

.detail-chart-axis-label {
  fill: var(--ink-muted);
  font-size: 11px;
}

.detail-chart-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-chart-dot {
  stroke: #fff;
  stroke-width: 1.25;
}

.detail-chart-line-0 { stroke: #435044; fill: #435044; }
.detail-chart-line-1 { stroke: #b46e43; fill: #b46e43; }
.detail-chart-line-2 { stroke: #77875f; fill: #77875f; }
.detail-chart-line-3 { stroke: #915745; fill: #915745; }
.detail-chart-line-4 { stroke: #67725b; fill: #67725b; }
.detail-chart-line-5 { stroke: #8a907f; fill: #8a907f; }
.detail-chart-line-6 { stroke: #6d7466; fill: #6d7466; }
.detail-chart-line-7 { stroke: #a99078; fill: #a99078; }

.detail-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.detail-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.detail-chart-legend-swatch {
  width: 16px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}

.detail-chart-empty {
  padding: 18px;
  border-radius: 14px;
  background: rgba(231, 224, 210, 0.45);
  color: var(--ink-muted);
}

.detail-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.detail-flow-step {
  display: grid;
  gap: 4px;
  min-width: 160px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(106, 119, 99, 0.16);
}

.detail-flow-step span {
  color: var(--ink-soft);
  font-size: 12px;
}

.detail-flow-arrow {
  color: var(--ink-muted);
  font-weight: 700;
}

@media (min-width: 920px) {
  .detail-panel-block {
    grid-column: span 6;
  }

  .detail-panel-block-wide {
    grid-column: span 12;
  }
}

/* Global element styles */
a,
button,
input,
select,
textarea {
  font: inherit;
}

.header {
  position: relative;
  overflow: hidden;
  padding: 4px var(--gutter) 4px;
  color: #f8f3ec;
  background:
    linear-gradient(135deg, rgba(92, 68, 54, 0.98), rgba(125, 92, 69, 0.95)),
    linear-gradient(90deg, rgba(184, 109, 60, 0.22), transparent 35%);
  box-shadow: var(--shadow-strong);
  border-bottom: 1px solid rgba(255, 248, 240, 0.16);
}

.header::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.08) 36%, transparent 46%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 42px);
  pointer-events: none;
}

.masthead {
  position: relative;
  z-index: 1;
  max-width: none;
  min-height: 84px;
  margin: 0 auto;
}

.eyebrow {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.74;
}

.header h1 {
  font-family: var(--font-sans);
  font-size: clamp(1.85rem, 3.2vw, 2.7rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  max-width: 14ch;
}

.container {
  position: relative;
  z-index: 1;
  /* Dynamic content container: do not constrain width here; let panels drive layout */
  width: auto;
  min-width: 0;
  max-width: none;
  margin: 0 auto;
}

.top-panel {
  display: grid;
  gap: 18px;
  margin-bottom: 0;
  max-width: none;
}
.brief-sheet,
.tab-content,
.report-display {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.66);
}

.brief-sheet {
  padding: clamp(22px, 4vw, 34px);
  background: linear-gradient(180deg, rgba(252, 250, 245, 0.98), rgba(239, 235, 226, 0.96));
}

.brief-head {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.brief-kicker,
.dossier-label,
.meta-label,
label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.brief-head h2,
.section-title,
.report-panel-title,
.ledger-subtitle {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--brown-strong);
}

.brief-head h2 {
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1.12;
}

.brief-summary,
.section-copy,
.section-lead,
.muted,
.help-text {
  color: var(--ink-soft);
}

.brief-ledger {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.brief-ledger > div {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid rgba(169, 144, 120, 0.24);
}

.brief-ledger dt {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.brief-ledger dd {
  font-family: var(--font-sans);
  font-size: clamp(0.98rem, 1.6vw, 1.18rem);
  color: var(--ink);
}

.quick-actions,
.btn-group,
.company-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-tabs {
  display: grid;
  gap: 12px;
  padding: clamp(18px, 4vw, 24px);
  background: linear-gradient(180deg, rgba(250, 247, 240, 0.96), rgba(232, 224, 210, 0.96));
  border: 1px solid rgba(169, 144, 120, 0.25);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow-soft);
}

.dossier-link,
.nav-tabs .tab-btn {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: var(--tight-radius);
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--ink-soft);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.dossier-link:hover,
.nav-tabs .tab-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(169, 144, 120, 0.28);
}

.dossier-link.active,
.nav-tabs .tab-btn.active {
  background: linear-gradient(135deg, rgba(106, 119, 99, 0.14), rgba(180, 110, 67, 0.11));
  border-color: rgba(106, 119, 99, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
  color: var(--brown-strong);
}

.dossier-link__seq {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--terracotta);
}

.dossier-link__copy {
  display: grid;
  gap: 2px;
}

.dossier-link__title {
  font-size: 14px;
  font-weight: 700;
}

.dossier-link__meta {
  font-size: 12px;
  color: var(--ink-muted);
}

.hidden {
  display: none !important;
}

.status {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--tight-radius);
  border: 1px solid transparent;
  font-size: 13px;
}

.status.info {
  background: rgba(255, 250, 242, 0.92);
  border-color: rgba(169, 144, 120, 0.28);
  color: var(--ink);
}

.status.success {
  background: rgba(29, 108, 83, 0.12);
  border-color: rgba(29, 108, 83, 0.24);
  color: var(--forest);
}

.status.error {
  background: rgba(168, 61, 46, 0.12);
  border-color: rgba(168, 61, 46, 0.24);
  color: var(--rust);
}

.tab-content {
  display: none;
  padding: clamp(20px, 4vw, 32px);
}

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

.section-title {
  margin-top: clamp(1.18rem, 1.8vw, 1.65rem);
  margin-bottom: 10px;
  font-size: clamp(1rem, 1.7vw, 1.26rem);
  line-height: 1.12;
  text-transform: none;
}

.tab-content.active > .section-title:first-child,
.tab-content.active .panel-close + .section-title {
  margin-top: 0;
}

.section-copy,
.section-lead {
  margin-bottom: 16px;
  max-width: 92ch;
  font-size: 14px;
}

.surface-callout,
.note-block,
.import-guidance,
.report-toolbar,
.report-context-grid,
.table-scroll,
.empty-note {
  background: rgba(255, 252, 246, 0.74);
  border: 1px solid rgba(169, 144, 120, 0.24);
  border-radius: var(--tight-radius);
}

.note-block,
.import-guidance,
.report-toolbar,
.report-context-grid,
.empty-note {
  padding: 14px 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-row,
.ecosystem-meta-grid,
.report-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 7px;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(169, 144, 120, 0.34);
  border-radius: 12px;
  background: rgba(255, 252, 246, 0.96);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(125, 92, 69, 0.58);
  box-shadow: 0 0 0 3px rgba(184, 109, 60, 0.12);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brown), var(--forest));
  color: #fff9f3;
  box-shadow: 0 12px 28px rgba(67, 80, 68, 0.18);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--forest), var(--brown));
}

.btn-secondary {
  background: rgba(255, 252, 246, 0.92);
  border-color: rgba(169, 144, 120, 0.34);
  color: var(--ink);
}

.btn-secondary:hover {
  background: rgba(239, 230, 215, 0.92);
}

.btn-success {
  background: linear-gradient(135deg, var(--forest), #154c3a);
  color: #f7f3eb;
}

.btn-warning {
  background: rgba(184, 109, 60, 0.14);
  color: var(--terracotta);
  border-color: rgba(184, 109, 60, 0.26);
}

.btn-warning:hover {
  background: rgba(184, 109, 60, 0.2);
}

.btn-danger {
  background: rgba(145, 87, 69, 0.12);
  color: var(--rust);
  border-color: rgba(168, 61, 46, 0.26);
}

.btn-danger:hover {
  background: rgba(168, 61, 46, 0.16);
}

.btn-sm {
  min-height: 30px;
  padding: 7px 10px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  background: rgba(255, 252, 246, 0.78);
  border: 1px solid rgba(169, 144, 120, 0.22);
  border-radius: 16px;
  overflow: hidden;
}

th,
td {
  border-bottom: 1px solid rgba(169, 144, 120, 0.16);
}

th {
  padding: 11px 12px;
  background: rgba(239, 230, 215, 0.86);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
}

td {
  padding: 10px 12px;
  font-size: 13px;
}

tr:hover td {
  background: rgba(239, 230, 215, 0.38);
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.number,
code,
.audit-code {
  font-family: var(--font-mono);
}

.number {
  text-align: right;
}

.badge,
.entity-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-primary,
.entity-pill-forprofit {
  background: rgba(125, 92, 69, 0.12);
  color: var(--brown);
}

.entity-pill-nonprofit {
  background: rgba(184, 109, 60, 0.12);
  color: var(--terracotta);
}

.report-sub-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px 8px 0;
  padding: 10px 12px;
  border: 1px solid rgba(169, 144, 120, 0.24);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.78);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.report-sub-tab:hover,
.report-sub-tab.active {
  transform: translateY(-1px);
}

.report-sub-tab.active {
  background: linear-gradient(135deg, rgba(125, 92, 69, 0.14), rgba(184, 109, 60, 0.12));
  border-color: rgba(125, 92, 69, 0.34);
  color: var(--brown-strong);
}

.report-display {
  margin-top: 14px;
  padding: 16px;
  background: rgba(252, 250, 245, 0.96);
}

.report-panel-title {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.report-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.report-window-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.report-window-periods {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--brown-strong);
}

.report-meta-note {
  font-size: 12px;
  color: var(--ink-muted);
}

.report-table {
  font-size: 12px;
}

.report-table th,
.report-table td {
  padding: 7px 9px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.report-table tbody tr {
  break-inside: avoid;
}

.report-section-row td {
  padding-top: 12px;
  background: rgba(239, 230, 215, 0.52);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  color: var(--brown-strong);
}

.report-total-row td {
  background: rgba(239, 230, 215, 0.44);
  font-weight: 700;
}

.report-emphasis-row td {
  background: rgba(29, 108, 83, 0.1);
  font-weight: 700;
}

.report-drill {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: right;
  font: inherit;
  cursor: pointer;
}

.report-drill:hover {
  color: var(--brown-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.report-drill-label {
  width: 100%;
  text-align: left;
}

.report-drill-cell,
.detail-drill-row,
.detail-chart-hit {
  cursor: pointer;
}

.report-drill-cell:hover {
  background: rgba(239, 230, 215, 0.46);
}

.detail-drill-row:hover td {
  background: rgba(239, 230, 215, 0.46);
}

.detail-chart-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.report-empty {
  padding: 18px;
  color: var(--ink-muted);
}

.warning-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(168, 61, 46, 0.1);
  border: 1px solid rgba(168, 61, 46, 0.2);
  color: var(--rust);
}

.import-dropzone {
  padding: 26px;
  text-align: center;
  border: 2px dashed rgba(125, 92, 69, 0.34);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.92), rgba(239, 230, 215, 0.62));
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.import-dropzone:hover {
  transform: translateY(-1px);
}

.import-dropzone strong {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-sans);
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--brown-strong);
}

.import-dropzone small {
  color: var(--ink-muted);
}

.table-scroll {
  overflow: auto;
}

.company-cell strong {
  display: block;
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.company-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-muted);
}

.active-row td {
  background: rgba(125, 92, 69, 0.08);
}

.two-column {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.panel-close {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(106, 119, 99, 0.22);
  border-radius: 999px;
  background: rgba(252, 250, 245, 0.96);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.panel-close:hover {
  background: rgba(231, 224, 210, 0.98);
}

.detail-panel-body {
  display: grid;
  gap: 18px;
}

.meta-chip,
.stage-indicator,
.processing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(106, 119, 99, 0.12);
  color: var(--brown-strong);
  font-size: 11px;
  font-weight: 700;
}

.card,
.journal-card,
.je-modal-form,
.import-session-header,
.stage-content,
.file-item,
.normalization-item,
.je-preview {
  background: rgba(255, 252, 246, 0.88);
  border: 1px solid rgba(169, 144, 120, 0.2);
  border-radius: var(--tight-radius);
  box-shadow: var(--shadow-soft);
}

.journal-view,
.je-modal-form,
.normalization-details,
.journal-preview {
  display: grid;
  gap: 16px;
}

.journal-header,
.header-actions,
.stage-actions,
.import-session-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.journal-header,
.card,
.journal-card,
.je-modal-form,
.stage-content,
.je-preview {
  padding: 16px;
}

.je-lines-container,
.file-list,
.normalization-details {
  display: grid;
  gap: 12px;
}

.mt-1 {
  margin-top: 10px;
}

.jeLineError {
  min-height: 1.2em;
  color: var(--rust);
  font-size: 0.85em;
}

.import-session-header,
.stage-progress,
.stage-content,
.stage-actions,
.relation-summary {
  margin-top: 14px;
}

.stage-progress {
  display: grid;
  gap: 10px;
}

.progress-bar {
  overflow: hidden;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(169, 144, 120, 0.18);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--forest), var(--terracotta));
}

.duplicates-notice {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(168, 61, 46, 0.08);
  border: 1px solid rgba(168, 61, 46, 0.18);
  color: var(--rust);
}

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

@media (max-width: 1200px) {
  .workspace-spine {
    /* Keep the spine a fixed pixel width (authoritative via --workspace-spine-width) */
    width: var(--workspace-spine-width, 360px);
    min-width: var(--workspace-spine-width, 360px);
    max-width: var(--workspace-spine-width, 360px);
  }
}

@media (max-width: 900px) {
  .header {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .workspace-orbit {
    /* Maintain minimum height in responsive view (from CSS variable) */
    min-height: var(--workspace-orbit-min-height, 480px);
  }

  .workspace-spine {
    /* Center spine remains fixed; do not compute width in media queries */
    width: var(--workspace-spine-width, 360px);
    min-width: var(--workspace-spine-width, 360px);
    max-width: var(--workspace-spine-width, 360px);
  }

  .brief-sheet,
  .tab-content {
    padding: 18px;
    border-radius: 20px;
  }
}

@media (max-width: 680px) {
  .header h1 {
    max-width: none;
  }

  .quick-actions,
  .btn-group,
  .company-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-tabs .tab-btn,
  .dossier-link {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding-left: 8px;
    padding-right: 8px;
  }
}

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

  body::before,
  .header,
  .top-panel,
  .nav-tabs,
  #status,
  .btn-group,
  .report-sub-tab,
  .report-toolbar {
    display: none !important;
  }

  .tab-content,
  .report-display {
    box-shadow: none;
    border: 0;
    background: #fff;
    padding: 0;
  }

  .report-table {
    font-size: 10.5px;
  }

  .report-table th,
  .report-table td {
    padding: 4px 6px;
  }
}
