:root {
  --bg: #eef2f6;
  --bg-alt: #e3e8ef;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --text: #172033;
  --muted: #5d6b82;
  --border: #d8e0ea;
  --navy: #163155;
  --navy-2: #1f4778;
  --header-navy: #0d223d;
  --sidebar-navy: #1f4a76;
  --sidebar-navy-deep: #183a63;
  --blue: #2e66a7;
  --green: #1c8c5a;
  --green-soft: #e4f5eb;
  --yellow: #b58b00;
  --yellow-soft: #fff6da;
  --red: #c43b3b;
  --red-soft: #fde7e7;
  --shadow: 0 12px 32px rgba(17, 34, 68, 0.08);
  --shadow-sm: 0 4px 14px rgba(17, 34, 68, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.95), transparent 42%),
    linear-gradient(180deg, var(--bg) 0%, #f4f7fb 40%, #eef3f7 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

textarea {
  resize: vertical;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 0.22s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 96px minmax(0, 1fr);
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  width: 290px;
  padding: 20px 18px 18px;
  background: linear-gradient(180deg, var(--sidebar-navy) 0%, var(--sidebar-navy-deep) 100%);
  color: #eaf0fb;
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.12), 10px 0 24px rgba(12, 31, 55, 0.06);
}

.sidebar.collapsed {
  width: 96px;
  padding-inline: 14px;
}

.sidebar-toggle-wrap {
  margin-top: auto;
  padding: 18px 0 12px;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #eef4fb;
  border-radius: 14px;
  padding: 12px 14px;
  line-height: 1;
  width: 100%;
  min-height: 48px;
  margin: 0;
  opacity: 0.96;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
  transform: translateX(2px);
}

.sidebar-toggle-label {
  color: #eef4fb;
  font-weight: 800;
  white-space: nowrap;
}

.sidebar-copy {
  margin: 0;
  line-height: 1.55;
  color: rgba(234,240,251,0.82);
  font-size: 0.95rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.045);
  color: #eef4fb;
  padding: 10px 14px;
  border-radius: 14px;
  text-align: left;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.13);
  border-color: rgba(255,255,255,0.22);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(113, 166, 226, 0.28) 0%, rgba(255,255,255,0.12) 100%);
  border-color: rgba(172, 207, 245, 0.48);
  box-shadow: inset 3px 0 0 #a9d1ff;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 22px;
  color: currentColor;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-toggle .sidebar-toggle-icon-open {
  display: none;
}

.nav-label {
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-copy,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-toggle-label {
  display: none;
}

.sidebar.collapsed .sidebar-toggle-wrap {
  padding-top: 18px;
}

.sidebar.collapsed .sidebar-toggle {
  justify-content: center;
  padding: 12px;
  width: 48px;
  height: 48px;
  margin: 0 auto;
}

.sidebar.collapsed .sidebar-toggle .sidebar-toggle-icon-close {
  display: none;
}

.sidebar.collapsed .sidebar-toggle .sidebar-toggle-icon-open {
  display: inline-grid;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .nav {
  gap: 10px;
}

.sidebar.collapsed .nav-icon {
  margin: 0;
}

.sidebar-footer {
  margin-top: 0;
  display: grid;
  gap: 10px;
}

.sidebar-legal {
  display: none;
}

.sidebar-status-card {
  background: linear-gradient(180deg, #f7fafc 0%, #e7ecf2 100%);
  color: var(--text);
  border: 1px solid rgba(216, 224, 234, 0.95);
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: 0 8px 22px rgba(4, 13, 30, 0.12);
}

.sidebar-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}

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

.sidebar-status-row span {
  color: var(--text);
  font-weight: 600;
}

.sidebar-status-row strong {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  text-align: right;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 8px;
}

.status-dot-green {
  background: #20bf7a;
}

.status-dot-blue {
  background: #22a7f2;
}

.sidebar-legal {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 10px;
  text-align: center;
  color: rgba(234, 240, 251, 0.78);
  font-size: 0.78rem;
  line-height: 1.55;
}

.sidebar-legal p {
  margin: 0 0 2px;
}

.powered-line {
  white-space: nowrap;
  font-size: 0.74rem;
}

.sidebar-legal nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  margin-top: 6px;
}

.sidebar-legal a {
  color: rgba(234, 240, 251, 0.88);
  text-decoration: none;
}

.sidebar-legal a:hover {
  color: #fff;
  text-decoration: underline;
}

.content {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  padding: 22px;
  overflow: auto;
  overscroll-behavior: contain;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  min-height: 112px;
  padding: 20px 28px;
  background: linear-gradient(180deg, var(--header-navy) 0%, #08192f 100%);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  color: #eef4fb;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.10), 0 10px 28px rgba(15, 33, 64, 0.10);
}

.app-header-brand {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-width: 0;
}

.app-header-icon,
.app-footer-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(4, 13, 30, 0.32);
}

.app-header-copy {
  min-width: 0;
}

.app-header-kicker {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.76rem;
  font-weight: 800;
  color: rgba(234,240,251,0.72);
  margin-bottom: 5px;
}

.topbar h2 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.12;
  color: #ffffff;
}

.topbar p {
  margin: 8px 0 0;
  color: rgba(234,240,251,0.82);
}

.topbar-subtitle {
  line-height: 1.45;
  max-width: none;
  white-space: nowrap;
}

.project-runtime-targets {
  display: none;
}

.app-content-footer {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 78px;
  padding: 14px 20px;
  background: #ffffff;
  border-top: 4px solid var(--header-navy);
  box-shadow: 0 -8px 22px rgba(17, 34, 68, 0.06);
}

.app-footer-brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.app-footer-brand span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.app-footer-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(22, 49, 85, 0.16);
}

.app-content-footer strong {
  display: block;
  color: var(--navy);
  font-size: 0.88rem;
  line-height: 1.25;
}

.app-footer-legal {
  text-align: right;
}

.app-footer-legal p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
}

.app-footer-legal nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.app-footer-legal a {
  color: var(--navy);
  text-decoration: none;
}

.topbar-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.topbar-actions .btn {
  min-height: 34px;
  padding: 7px 13px;
  font-size: 0.88rem;
  line-height: 1.15;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(180deg, #1e4e84 0%, #163155 100%);
  color: white;
}

.btn-secondary {
  background: #eef3f8;
  color: var(--navy);
  border: 1px solid var(--border);
}

.btn-success {
  background: var(--green);
  color: #fff;
}

.btn-ai-run {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 999px;
  animation: smart-risk-spin 0.8s linear infinite;
}

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

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-help-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-mini-icon {
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 17px;
}

.btn-mini-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-strip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 0 4px 4px;
  margin: 0 0 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-soft {
  background: #edf2f7;
  color: var(--navy);
}

.badge-neutral {
  background: #f2f5fa;
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-success {
  background: var(--green-soft);
  color: var(--green);
}

.badge-warning {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.badge-danger {
  background: var(--red-soft);
  color: var(--red);
}

.main-grid {
  display: grid;
  gap: 18px;
}

.view-section {
  display: none;
  gap: 16px;
}

.view-section.active {
  display: grid;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.section-header h3 {
  margin: 0;
  font-size: 1.32rem;
  color: var(--navy);
}

.section-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

#dashboard-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.launcher-card {
  padding: 20px;
  margin-bottom: 16px;
}

.launcher-eyebrow {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  align-items: stretch;
  grid-auto-rows: 1fr;
}

.launcher-item {
  border: 1px solid rgba(26, 58, 108, 0.09);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(247, 249, 252, 0.92);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 92px;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.launcher-item span {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.launcher-item strong {
  color: var(--navy);
  font-size: 0.98rem;
  line-height: 1.4;
  text-align: center;
}

.launcher-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.launcher-actions {
  margin-top: 14px;
}

.metric-card {
  padding: 18px 18px 16px;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(246,248,251,0.98) 100%);
}

.metric-label {
  color: var(--muted);
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin-top: 8px;
}

.metric-sub {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 8px;
}

.delta-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.3;
  font-size: 1rem;
  font-family: inherit;
}

.delta-value,
.delta-symbol,
.delta-result {
  font: inherit;
  color: inherit;
}

.delta-value {
  font-size: 0.82em;
  font-weight: 600;
  color: rgba(35, 50, 77, 0.78);
}

.delta-symbol {
  font-size: 0.82em;
  font-weight: 600;
  color: rgba(35, 50, 77, 0.78);
}

.delta-result {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
}

.insight-grid,
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.analysis-grid > article {
  height: 100%;
}

.dashboard-stack {
  display: grid;
  gap: 16px;
}

.uncertainty-stack {
  display: grid;
  gap: 16px;
}

.next-step-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-color: rgba(46, 102, 167, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
}

.next-step-card h4 {
  margin: 10px 0 8px;
  color: var(--navy);
  font-size: 1.08rem;
}

.next-step-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 780px;
}

.uncertainty-flow-list {
  display: grid;
  gap: 7px;
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.45;
  font-size: 0.9rem;
}

.next-step-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.dashboard-distribution {
  padding: 20px;
}

.callout {
  padding: 22px;
}

.callout h4,
.card-head h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--navy);
}

.callout p,
.callout li {
  color: var(--text);
  line-height: 1.55;
}

.callout ul {
  margin: 14px 0 0;
  padding-left: 18px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

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

.chart-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.chart-panel-head strong {
  color: var(--navy);
  font-size: 0.95rem;
}

.chart-panel-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

canvas {
  width: 100%;
  display: block;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
  border: 1px solid var(--border);
}

.form-card,
.table-card,
.action-panel {
  padding: 20px;
}

.model-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding: 18px 20px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
}

.model-hero-formula {
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.model-hero-formula span {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.model-hero-formula strong {
  color: var(--navy);
  font-size: 0.96rem;
  line-height: 1.4;
  word-break: break-word;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.module-column {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.synced-fields-card {
  display: grid;
  gap: 12px;
}

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

.synced-field-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  text-align: center;
  justify-items: center;
}

.synced-field-card strong {
  color: var(--navy);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.synced-field-card span {
  color: var(--text);
  font-weight: 700;
}

.synced-field-card small {
  color: var(--muted);
  font-size: 0.76rem;
}

.model-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

.model-result-card {
  margin-top: 14px;
}

.model-source-card,
.model-workspace-card {
  margin-top: 18px;
}

.model-source-head,
.model-workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.model-source-head p,
.model-workspace-head p {
  margin: -6px 0 0;
  color: var(--muted);
  line-height: 1.45;
  max-width: 760px;
  font-size: 0.9rem;
}

.model-workspace-head h3 {
  margin: -4px 0 6px;
  color: var(--navy);
  font-size: 1.1rem;
}

.model-source-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: #edf3fa;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.model-source-tab {
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  box-shadow: none;
}

.model-source-tab.is-active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 4px 14px rgba(17, 34, 68, 0.08);
}

.model-source-panel {
  display: none;
}

.model-source-panel.is-active {
  display: block;
}

.model-result-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--green);
  margin-top: 8px;
}

.model-result-explanation {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.model-result-explanation strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
  font-size: 0.86rem;
}

.model-result-explanation p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.model-result-explanation code {
  display: block;
  color: var(--navy);
  background: #eef4fb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  white-space: normal;
  line-height: 1.35;
}

.card-soft {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  padding: 16px;
}

.toolbar-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.token-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
}

.token-grid-compact {
  gap: 4px 5px;
}

.token-group {
  display: grid;
  gap: 8px;
}

.token-group + .token-group {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.token-group-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.token-empty {
  display: inline-flex;
  padding: 6px 2px;
  font-size: 0.78rem;
  color: var(--muted);
}

.formula-library {
  margin-top: 12px;
}

.formula-library-full {
  margin-top: 18px;
}

.model-library-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.model-library-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  text-align: center;
  justify-items: center;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #f6f9fc 100%);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  min-height: 100%;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.model-library-card strong {
  color: var(--navy);
  font-size: 0.95rem;
}

.model-library-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.model-library-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: #253454;
  white-space: normal;
  word-break: break-word;
}

.model-library-card small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.model-library-card:hover,
.model-library-card.is-active {
  transform: translateY(-1px);
  border-color: rgba(28, 140, 90, 0.28);
  box-shadow: 0 10px 24px rgba(17, 34, 68, 0.08);
}

.model-library-card.is-active {
  background: linear-gradient(180deg, #f1fbf5 0%, #e7f7ed 100%);
}

.custom-formula-section {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.custom-formula-library-card {
  margin-top: 18px;
  padding: 20px;
}

.custom-formula-intro {
  margin: -4px 0 2px;
  max-width: 760px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.custom-formula-builder {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.custom-formula-main,
.custom-formula-side {
  display: grid;
  gap: 14px;
  min-width: 0;
}

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

.custom-token-panel {
  padding: 14px;
}

.formula-board-note {
  border: 1px solid rgba(46, 102, 167, 0.22);
  border-radius: 16px;
  background: #eef5ff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.formula-board-note > strong {
  color: var(--navy);
}

.formula-board-example {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(46, 102, 167, 0.18);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
}

.formula-board-example span {
  color: var(--navy);
  font-weight: 800;
}

.formula-board-example b {
  color: var(--muted);
}

.formula-board-example code {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: normal;
  word-break: break-word;
}

.formula-field-guide {
  margin: 0;
  display: grid;
  gap: 8px;
}

.formula-field-guide div {
  display: grid;
  gap: 2px;
}

.formula-field-guide dt {
  color: var(--navy);
  font-weight: 800;
  font-size: 0.84rem;
}

.formula-field-guide dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.custom-value-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.custom-value-panel p {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

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

.custom-value-field {
  min-height: 112px;
  grid-template-rows: 20px 54px minmax(34px, auto);
}

.custom-value-field label {
  display: flex;
  align-items: flex-end;
}

.custom-rule-card,
.custom-parameter-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
  padding: 14px;
}

.custom-rule-card strong,
.custom-parameter-card > strong {
  display: block;
  color: var(--navy);
  margin-bottom: 8px;
}

.custom-rule-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.custom-rule-card li + li {
  margin-top: 5px;
}

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

.custom-parameter-chip {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.custom-parameter-chip.is-new {
  border-color: rgba(46, 102, 167, 0.25);
  background: #f2f7fd;
}

.custom-parameter-chip strong {
  color: var(--navy);
  font-size: 0.9rem;
}

.custom-parameter-chip span,
.custom-parameter-empty {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.custom-formula-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.custom-formula-card {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
  align-content: start;
  text-align: center;
  justify-items: center;
  min-height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.custom-formula-card:hover {
  transform: translateY(-1px);
  border-color: rgba(46, 102, 167, 0.28);
  box-shadow: 0 8px 20px rgba(17, 34, 68, 0.06);
}

.custom-formula-card > div:first-child {
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.custom-formula-card strong {
  color: var(--navy);
  font-size: 0.92rem;
}

.custom-formula-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.custom-formula-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  color: #253454;
  white-space: normal;
  word-break: break-word;
}

.custom-formula-card small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.42;
}

.formula-library-categories {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.formula-library-groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  align-items: start;
}

.formula-library-group {
  display: grid;
  gap: 12px;
  align-content: start;
}

.formula-library-category {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
}

.formula-library-category strong {
  color: var(--navy);
  font-size: 0.92rem;
}

.formula-library-category span {
  color: var(--muted);
  font-size: 0.8rem;
}

.formula-library-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.formula-library-item {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  align-content: start;
  justify-items: center;
  text-align: center;
  min-height: 100%;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.formula-library-item:hover {
  transform: translateY(-1px);
  border-color: rgba(46, 102, 167, 0.28);
  box-shadow: 0 8px 20px rgba(17, 34, 68, 0.06);
}

.formula-library-item.is-active {
  background: linear-gradient(180deg, #eefbf4 0%, #dff6e8 100%);
  border-color: rgba(28, 140, 90, 0.3);
  box-shadow: 0 0 0 1px rgba(28, 140, 90, 0.15), 0 10px 24px rgba(28, 140, 90, 0.16);
}

.formula-library-item.is-active::after {
  content: "Aktiv";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(28, 140, 90, 0.14);
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.formula-library-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(22, 49, 85, 0.08);
  color: var(--navy-2);
  font-size: 0.72rem;
  font-weight: 700;
}

.formula-library-item strong {
  font-size: 0.92rem;
  color: var(--navy);
}

.formula-library-item code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  color: #253454;
  white-space: normal;
  word-break: break-word;
}

.formula-library-item span {
  font-size: 0.82rem;
  color: var(--muted);
}

.chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.chip.is-active {
  background: var(--green-soft);
  border-color: rgba(28, 140, 90, 0.24);
  color: var(--green);
  box-shadow: 0 0 0 3px rgba(28, 140, 90, 0.08);
}

.chip-parameter.is-active {
  background: var(--green-soft);
  border-color: rgba(28, 140, 90, 0.24);
  color: var(--green);
  box-shadow: 0 0 0 3px rgba(28, 140, 90, 0.08);
}

.chip-risk.is-active {
  background: rgba(199, 124, 27, 0.12);
  border-color: rgba(199, 124, 27, 0.22);
  color: #9b5d10;
  box-shadow: 0 0 0 3px rgba(199, 124, 27, 0.08);
}

.formula-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
}

.formula-preview strong {
  font-size: 0.92rem;
}

.formula-preview span {
  font-size: 0.9rem;
  color: inherit;
}

.model-workflow-note {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.form-grid.custom-value-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-column > .form-grid > .field {
  min-height: 118px;
  grid-template-rows: 20px 54px minmax(34px, auto);
  align-content: start;
}

.module-column > .form-grid > .field > label {
  display: flex;
  align-items: flex-end;
}

.module-column > .form-grid > .field > .field-help {
  line-height: 1.25;
}

.model-workspace-card .module-column > .form-grid > .field input,
.model-workspace-card .module-column > .form-grid > .field select,
.model-workspace-card .module-column > .form-grid > .field textarea {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 8px 0 9px;
}

.model-workspace-card .module-column > .form-grid > .field input:focus,
.model-workspace-card .module-column > .form-grid > .field select:focus,
.model-workspace-card .module-column > .form-grid > .field textarea:focus {
  border-bottom-color: #2e66a7;
  box-shadow: none;
}

.project-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-description-field {
  grid-column: 1 / -1;
}

.project-scope-field {
  grid-column: 1 / -1;
}

.simulation-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.simulation-form-grid > .field {
  min-height: 112px;
  align-content: start;
}

.simulation-form-grid > .field:not([style*="grid-column"]) {
  grid-template-rows: 20px 54px minmax(34px, auto);
}

.simulation-form-grid > .field > label {
  display: flex;
  align-items: flex-end;
}

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

.simulation-settings-explainer > div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(46, 102, 167, 0.16);
  background: #f8fbff;
  border-radius: 14px;
  align-content: start;
}

.simulation-settings-explainer strong {
  color: var(--navy);
  font-size: 0.9rem;
}

.simulation-settings-explainer span {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.84rem;
}

.simulation-start-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(46, 102, 167, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
  border-radius: 18px;
}

.simulation-start-panel h4 {
  margin: 10px 0 6px;
  color: var(--navy);
}

.simulation-start-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.simulation-start-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.simulation-completion-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(28, 140, 90, 0.28);
  background: linear-gradient(180deg, #f7fffb 0%, #e8f7ef 100%);
  border-radius: 18px;
}

.simulation-completion-panel h4 {
  margin: 10px 0 6px;
  color: var(--navy);
}

.simulation-completion-panel p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.simulation-completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.readonly-field .readonly-value {
  min-height: 54px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfdff 0%, #f3f7fc 100%);
  color: var(--navy);
  border-radius: 12px;
  padding: 0 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}

.simulation-progress-card {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px;
}

.simulation-progress-card .card-head {
  margin-bottom: 0;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e7edf6;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(22, 49, 85, 0.05);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--navy) 0%, var(--blue) 100%);
  transition: width 0.2s ease;
}

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

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 66px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fbfdff;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  font-size: 0.8rem;
}

.progress-step span {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #e7edf6;
  color: var(--navy);
  font-weight: 800;
  flex: 0 0 20px;
  font-size: 0.74rem;
}

.progress-step.is-active {
  border-color: rgba(46, 102, 167, 0.35);
  background: #eef5ff;
  color: var(--navy);
}

.progress-step.is-active span {
  background: var(--blue);
  color: #fff;
}

.progress-step.is-complete {
  border-color: rgba(28, 140, 90, 0.35);
  background: var(--green-soft);
  color: var(--green);
}

.progress-step.is-complete span {
  background: var(--green);
  color: #fff;
}

.simulation-target-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  align-items: center;
  min-height: 54px;
}

.simulation-target-inline select {
  min-width: 0;
}

.simulation-progress-card .field-help {
  text-align: left;
}

.simulation-progress-help {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(46, 102, 167, 0.16);
  background: #f6f9fd;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
}

.simulation-progress-help strong {
  color: var(--navy);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .data-management-grid {
    grid-template-columns: 1fr;
  }

  .data-action-head {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .data-action-icon {
    width: 40px;
    height: 40px;
  }

  .ai-capability-grid {
    grid-template-columns: 1fr;
  }

  .ai-task-grid {
    grid-template-columns: 1fr;
  }

  .ai-task-head {
    flex-direction: column;
  }

  .ai-task-grid select,
  .ai-task-grid textarea {
    min-height: 96px;
  }

  .progress-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .simulation-target-inline {
    grid-template-columns: 1fr;
  }
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input,
.field select {
  min-height: 54px;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #7ea6d8;
  box-shadow: 0 0 0 3px rgba(46, 102, 167, 0.12);
}

.field-help {
  font-size: 0.78rem;
  color: var(--muted);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 32px;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

.table-wrap {
  overflow-x: auto;
  display: grid;
  gap: 12px;
}

.register-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.register-meta {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.register-wrapper {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(22, 49, 85, 0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,249,253,0.98) 100%);
  box-shadow: 0 14px 30px rgba(17, 34, 68, 0.07);
  border-radius: 22px;
}

.register-wrapper .toolbar-label {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--navy);
}

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

.register-meta-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
  justify-items: center;
  text-align: center;
}

.register-meta-item strong {
  color: var(--navy);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.register-meta-item span {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}

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

.info-chip {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  justify-items: center;
  text-align: center;
}

.info-chip strong {
  color: var(--navy);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.info-chip span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.register-cell-meta {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.register-cell-meta strong {
  color: var(--navy);
  margin-right: 4px;
}

.register-cell-meta input,
.register-cell-meta textarea {
  width: 100%;
  min-width: 0;
  margin-top: 4px;
}

.register-stat {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #f7f9fc 100%);
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
}

.register-stat strong {
  color: var(--navy);
  font-size: 1.2rem;
}

.register-stat span {
  color: var(--muted);
  font-size: 0.82rem;
}

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

th, td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: center;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

tbody tr:hover {
  background: rgba(235, 241, 248, 0.55);
}

tfoot th,
tfoot td {
  background: #eef5ff;
  color: var(--navy);
  border-top: 2px solid rgba(46, 102, 167, 0.28);
  border-bottom: 0;
  font-weight: 800;
}

tfoot td {
  font-variant-numeric: tabular-nums;
}

.parameter-sum-row td:last-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
}

td input,
td select,
td textarea {
  width: 100%;
  min-width: 110px;
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 10px;
  border-radius: 10px;
  text-align: center;
}

td textarea {
  min-height: 58px;
  resize: vertical;
}

.money-input {
  min-width: 0;
}

.percent-input {
  min-width: 0;
}

.workflow-rail {
  padding: 6px 4px 4px;
  margin: 2px 0 14px;
  overflow-x: auto;
}

.workflow-stepper {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  gap: 0;
  min-width: 760px;
  padding-top: 2px;
}

.workflow-stepper::before {
  content: "";
  position: absolute;
  left: calc(100% / 12);
  right: calc(100% / 12);
  top: 19px;
  height: 3px;
  border-radius: 999px;
  background: #cbd7e6;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.72);
  z-index: 0;
}

.workflow-stepper-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: #111827;
  text-align: center;
}

.workflow-stepper-index {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #edf3f9;
  border: 1px solid #cbd7e6;
  color: #4d5d73;
  font-weight: 800;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 5px #eef2f6;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.workflow-stepper-label {
  position: relative;
  z-index: 1;
  min-height: 24px;
  color: #172033;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.15;
}

.workflow-stepper-status {
  position: relative;
  z-index: 1;
  min-width: 72px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef3f8;
  border: 1px solid #d5dfeb;
  color: #607086;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.workflow-stepper-item.is-complete .workflow-stepper-index {
  background: #15865b;
  border-color: #15865b;
  color: #ffffff;
  box-shadow: 0 0 0 5px #e2f3eb;
}

.workflow-stepper-item.is-complete .workflow-stepper-status {
  background: #e2f3eb;
  border-color: #b9e1cc;
  color: #13704c;
}

.workflow-stepper-item.is-active .workflow-stepper-index {
  background: #15365f;
  border-color: #15365f;
  color: #ffffff;
  box-shadow: 0 0 0 5px #dfeafa, 0 8px 18px rgba(21, 54, 95, 0.18);
}

.workflow-stepper-item.is-active .workflow-stepper-label {
  color: #15365f;
}

.workflow-stepper-item.is-active .workflow-stepper-status {
  background: #dfeafa;
  border-color: #b9cdeb;
  color: #15365f;
}

td input:focus,
td select:focus,
td textarea:focus {
  background: #fff;
  border-color: #9db7d8;
  box-shadow: 0 0 0 3px rgba(46, 102, 167, 0.08);
}

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

.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.8rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-green {
  background: var(--green-soft);
  color: var(--green);
}

.status-yellow {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.status-red {
  background: var(--red-soft);
  color: var(--red);
}

.analysis-grid article {
  padding: 20px;
}

.scenario-explainer {
  padding: 18px;
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

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

.scenario-explainer-grid > div,
.scenario-help-grid > div {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 100%;
}

.scenario-explainer-grid strong,
.scenario-help-grid strong {
  color: var(--navy);
  font-size: 0.94rem;
}

.scenario-explainer-grid span,
.scenario-help-grid span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.scenario-help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.scenario-help-grid > div {
  background: #f8fbff;
}

.percentile-table,
.simple-list {
  display: grid;
  gap: 10px;
}

.analysis-note {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(46, 102, 167, 0.18);
  border-radius: 14px;
  background: #f3f8ff;
}

.analysis-note strong {
  color: var(--navy);
  line-height: 1.25;
}

.analysis-note span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.percentile-row,
.compare-row,
.list-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.percentile-row {
  grid-template-columns: 48px minmax(138px, 0.95fr) minmax(132px, 1fr) minmax(108px, 0.75fr);
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 12px 14px;
}

.percentile-label {
  color: var(--navy);
  font-size: 0.95rem;
}

.percentile-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.percentile-note {
  color: var(--muted);
  line-height: 1.25;
  font-size: 0.9rem;
  min-width: 0;
}

.percentile-type {
  justify-self: end;
  max-width: 100%;
  border: 1px solid rgba(46, 102, 167, 0.16);
  background: #ffffff;
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

.compare-row {
  grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
}

.list-row {
  grid-template-columns: 1.4fr 0.7fr 1fr;
}

.compare-row strong,
.list-row strong {
  color: var(--navy);
}

.sensitivity-list {
  display: grid;
  gap: 10px;
}

.sensitivity-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-color: rgba(46, 102, 167, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
}

.sensitivity-hero-card.is-warning {
  border-color: rgba(181, 139, 0, 0.26);
  background: var(--yellow-soft);
}

.sensitivity-hero-card h4 {
  margin: 10px 0 8px;
  color: var(--navy);
  font-size: 1.2rem;
}

.sensitivity-hero-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.sensitivity-hero-meter {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 150px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(46, 102, 167, 0.18);
  background: #ffffff;
}

.sensitivity-hero-meter strong {
  color: var(--navy);
  font-size: 2rem;
  line-height: 1;
}

.sensitivity-hero-meter span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.sensitivity-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(130px, 1fr) minmax(120px, 0.72fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.sensitivity-row-recommendation {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(23, 32, 51, 0.08);
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.84rem;
}

.sensitivity-row strong {
  color: var(--navy);
  line-height: 1.25;
}

.sensitivity-row span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.sensitivity-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce6f2;
}

.sensitivity-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--navy);
}

.sensitivity-row.is-negative .sensitivity-bar span {
  background: var(--red);
}

.sensitivity-values {
  display: grid;
  gap: 2px;
  justify-items: end;
  text-align: right;
}

.sensitivity-management-card {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(46, 102, 167, 0.2);
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
  border-radius: 16px;
}

.sensitivity-management-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

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

.sensitivity-action-grid > div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: #fbfdff;
  border: 1px solid var(--border);
}

.sensitivity-action-grid strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  font-size: 0.78rem;
}

.sensitivity-action-grid span {
  color: var(--navy);
  font-weight: 700;
  line-height: 1.25;
  font-size: 0.82rem;
}

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

.sensitivity-insight-grid > div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #fbfdff;
  border-radius: 14px;
}

.sensitivity-insight-grid span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sensitivity-insight-grid strong {
  color: var(--navy);
  line-height: 1.35;
  font-size: 0.9rem;
}

.target-assessment {
  display: grid;
  gap: 14px;
}

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

.target-kpi {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(90px, auto);
  gap: 8px 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.target-kpi span {
  color: var(--navy);
  font-weight: 750;
  line-height: 1.25;
}

.target-kpi strong {
  color: var(--text);
  text-align: right;
  font-weight: 750;
}

.target-kpi small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.35;
  font-size: 0.82rem;
}

.target-interpretation {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 12px;
  background: #f8fbff;
}

.target-interpretation.is-green {
  border-color: rgba(28, 140, 90, 0.28);
  background: var(--green-soft);
}

.target-interpretation.is-yellow {
  border-color: rgba(181, 139, 0, 0.28);
  background: var(--yellow-soft);
}

.target-interpretation.is-red {
  border-color: rgba(196, 59, 59, 0.28);
  background: var(--red-soft);
}

.target-interpretation-head {
  display: grid;
  gap: 5px;
}

.target-interpretation-head span,
.target-next-step span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.target-interpretation-head strong {
  color: var(--navy);
  font-size: 1.05rem;
  line-height: 1.25;
}

.target-interpretation p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.target-next-step {
  border-top: 1px solid rgba(23, 32, 51, 0.1);
  padding-top: 12px;
  display: grid;
  gap: 4px;
}

.target-next-step strong {
  color: var(--navy);
  line-height: 1.45;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  grid-auto-rows: 1fr;
}

.scenario-card {
  padding: 18px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  height: 100%;
}

.scenario-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.scenario-active-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: #f8fbff;
  border-radius: 999px;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.scenario-active-control input {
  margin: 0;
  accent-color: var(--blue);
}

.scenario-card h4 {
  margin: 0;
  color: var(--navy);
}

.scenario-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.table-card .card-head p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.9rem;
  max-width: 720px;
}

.scenario-fields {
  display: grid;
  gap: 10px;
}

.scenario-fields .field {
  gap: 5px;
}

.report-output {
  display: grid;
  gap: 18px;
}

.report-cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 24px;
  align-items: end;
  padding: 28px;
  color: #eef4fb;
  background: linear-gradient(135deg, #0d223d 0%, #153f6a 100%);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 42px rgba(13, 34, 61, 0.18);
}

.report-eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  color: rgba(238, 244, 251, 0.72);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.report-cover h4 {
  margin: 0;
  color: #fff;
  font-size: 1.65rem;
  line-height: 1.16;
}

.report-cover p {
  max-width: 850px;
  margin: 10px 0 0;
  color: rgba(238, 244, 251, 0.84);
  line-height: 1.55;
}

.report-cover-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 14px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.report-cover-meta span {
  color: rgba(238, 244, 251, 0.68);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.report-cover-meta strong {
  min-width: 0;
  color: #fff;
  text-align: right;
}

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

.report-grid-main {
  grid-template-columns: minmax(360px, 0.86fr) minmax(520px, 1.14fr);
  align-items: stretch;
}

.report-grid-main > .report-panel {
  min-height: 248px;
}

.report-panel {
  padding: 22px;
  display: grid;
  gap: 16px;
}

.report-summary-panel {
  align-content: start;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.report-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-panel-head span {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #edf4fb;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
}

.report-panel-head h4 {
  margin: 0;
  color: var(--navy);
}

.report-panel p {
  margin: 0;
  color: var(--text);
  line-height: 1.58;
}

.report-status-box {
  display: grid;
  gap: 8px;
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  background: #f8fbff;
}

.report-status-box strong {
  color: var(--navy);
  font-size: 1.05rem;
}

.report-status-box.is-green {
  border-color: rgba(28, 140, 90, 0.28);
  background: var(--green-soft);
}

.report-status-box.is-warning {
  border-color: rgba(181, 139, 0, 0.28);
  background: var(--yellow-soft);
}

.report-status-box.is-red {
  border-color: rgba(196, 59, 59, 0.28);
  background: var(--red-soft);
}

.report-next-step {
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.report-next-step span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-next-step strong {
  color: var(--navy);
  line-height: 1.45;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(145px, 1fr));
  gap: 12px;
}

.report-kpi {
  min-height: 88px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fbff;
  padding: 12px;
  text-align: center;
}

.report-kpi span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.report-kpi strong {
  color: var(--navy);
  font-size: 0.98rem;
  line-height: 1.2;
  white-space: nowrap;
}

.report-kpi small {
  text-align: center;
}

.report-kpi small {
  color: var(--muted);
  line-height: 1.35;
}

.report-chart-panel canvas {
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fbff;
}

.report-table,
.report-driver-list {
  display: grid;
  gap: 10px;
}

.report-table-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.6fr) minmax(0, 1fr) minmax(160px, 0.9fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fbff;
  padding: 12px 14px;
}

.report-table-row strong,
.report-driver-row strong {
  color: var(--navy);
}

.report-table-row span {
  min-width: 0;
  color: var(--text);
  font-weight: 750;
}

.report-table-row small,
.report-driver-row small {
  color: var(--muted);
  line-height: 1.35;
}

.report-driver-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fbff;
  padding: 13px 14px;
}

.report-driver-row span {
  justify-self: end;
  border-radius: 999px;
  background: #edf4fb;
  color: var(--navy);
  padding: 5px 9px;
  font-size: 0.75rem;
  font-weight: 850;
}

.report-driver-row small {
  grid-column: 1 / -1;
}

.report-recommendations {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.55;
}

.report-recommendations li + li {
  margin-top: 9px;
}

.report-method-panel {
  border-left: 4px solid var(--navy-2);
}

.report-ai-panel {
  border-left: 4px solid #8b5cf6;
}

.report-ai-note {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(139, 92, 246, 0.22);
  background: #f5f0ff;
  color: var(--muted);
  line-height: 1.5;
}

.report-ai-note strong {
  color: var(--navy);
}

.report-ai-text {
  white-space: pre-wrap;
  line-height: 1.62;
  color: var(--text);
  border: 1px solid var(--border);
  background: #fbfdff;
  border-radius: 16px;
  padding: 16px;
}

.report-ai-empty {
  display: grid;
  gap: 10px;
  justify-items: start;
  border: 1px dashed #b8c7dc;
  background: #f8fbff;
  border-radius: 16px;
  padding: 16px;
}

.report-ai-empty strong {
  color: var(--navy);
}

.report-ai-empty p {
  color: var(--muted);
}

.ai-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.ai-panel {
  padding: 22px;
}

.ai-intro-panel .card-head {
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.ai-intro-panel .card-head p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
  max-width: 760px;
}

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

.ai-capability-grid > div {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fd 100%);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 7px;
}

.ai-capability-grid strong {
  color: var(--navy);
  font-size: 0.92rem;
}

.ai-capability-grid span {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.86rem;
}

.ai-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eef5ff;
  color: var(--navy);
  line-height: 1.45;
  font-size: 0.9rem;
}

.ai-task-panel {
  padding: 24px;
}

.ai-task-head {
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.ai-task-head h4 {
  margin-bottom: 5px;
}

.ai-task-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

.ai-task-head .badge {
  white-space: nowrap;
  margin-top: 2px;
}

.ai-task-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.ai-task-grid .field {
  align-content: start;
}

.ai-task-grid select,
.ai-task-grid textarea {
  min-height: 52px;
}

.ai-task-grid select {
  font-weight: 650;
  color: var(--navy);
}

.ai-task-grid textarea {
  min-height: 128px;
  line-height: 1.45;
}

.ai-task-description {
  border: 1px solid var(--border);
  background: #f8fbff;
  border-radius: 14px;
  padding: 12px 14px;
  display: grid;
  gap: 5px;
}

.ai-task-description strong {
  color: var(--navy);
  font-size: 0.9rem;
}

.ai-task-description span {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.86rem;
}

.ai-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.ai-warning {
  border: 1px solid rgba(181, 139, 0, 0.24);
  background: var(--yellow-soft);
  color: #6d5400;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  line-height: 1.5;
  font-size: 0.9rem;
}

.anthropic-key-panel .card-head {
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.anthropic-key-panel .card-head p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
  max-width: 720px;
}

.ai-context-head {
  align-items: flex-start;
  gap: 22px;
}

.ai-context-head > div {
  max-width: min(760px, calc(100% - 130px));
  min-width: 0;
}

.ai-context-head p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.ai-context-head .badge {
  flex: 0 0 auto;
}

.anthropic-key-control {
  display: grid;
  gap: 16px;
}

.anthropic-key-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 44px;
  gap: 8px;
  align-items: center;
}

.anthropic-key-input-wrap input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.01em;
}

.eye-btn,
.clear-key-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.clear-key-btn {
  color: var(--red);
  font-size: 1.28rem;
  font-weight: 800;
}

.anthropic-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-explain-box {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(46, 102, 167, 0.18);
  border-radius: 14px;
  background: #eef6ff;
  color: var(--muted);
  line-height: 1.45;
}

.ai-explain-box strong {
  color: var(--navy);
}

.ai-explain-box-warning {
  border-color: rgba(181, 139, 0, 0.22);
  background: var(--yellow-soft);
}

.ai-explain-box-strict {
  margin: 14px 0 0;
  border-color: rgba(28, 140, 90, 0.24);
  background: var(--green-soft);
}

.ai-context,
.ai-output {
  width: 100%;
  margin: 0;
  min-height: 220px;
  max-height: 460px;
  overflow: auto;
  resize: vertical;
  white-space: pre-wrap;
  border: 1px solid var(--border);
  background: #f8fbff;
  color: var(--text);
  border-radius: 16px;
  padding: 16px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.ai-context[readonly],
.ai-output[readonly] {
  cursor: default;
}

.ai-review-box {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.ai-review-textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: 16px;
  padding: 16px;
  line-height: 1.55;
  font-size: 0.94rem;
}

.ai-review-textarea:focus {
  outline: 3px solid rgba(46, 102, 167, 0.12);
  border-color: #8aa8cf;
}

.help-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 24px;
}

.help-hero-card h4 {
  margin: 10px 0 8px;
  color: var(--navy);
  font-size: 1.2rem;
}

.help-hero-card p,
.help-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.help-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

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

.help-card {
  padding: 22px;
}

.help-card h4 {
  margin: 0 0 12px;
  color: var(--navy);
}

.help-card h5 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 0.95rem;
}

.help-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.55;
}

.help-steps li + li {
  margin-top: 8px;
}

.help-wide-card {
  display: grid;
  gap: 18px;
}

.help-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.help-two-column > div,
.help-mini-panel {
  border: 1px solid var(--border);
  background: #f8fbff;
  border-radius: 16px;
  padding: 16px;
}

.help-two-column p + p {
  margin-top: 10px;
}

.help-api-steps {
  border: 1px solid rgba(46, 102, 167, 0.22);
  background: #f2f7fd;
  border-radius: 16px;
  padding: 18px 18px 18px 38px;
}

.compact-help-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.help-mini-panel {
  display: grid;
  gap: 7px;
}

.help-mini-panel strong {
  color: var(--navy);
}

.help-page-content {
  display: grid;
  gap: 16px;
}

.help-chapter {
  display: grid;
  gap: 12px;
}

.help-chapter h4 {
  margin-bottom: 0;
}

.help-chapter h5 {
  margin: 8px 0 0;
}

.help-chapter ul,
.help-chapter ol {
  margin: 0;
  padding-left: 22px;
  color: var(--text);
  line-height: 1.55;
}

.help-chapter li + li {
  margin-top: 7px;
}

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

.help-mini-grid > div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  background: #f8fbff;
  border-radius: 14px;
  padding: 14px;
}

.help-mini-grid strong {
  color: var(--navy);
}

.help-mini-grid span {
  color: var(--muted);
  line-height: 1.45;
}

.help-callout {
  border: 1px solid #b9d8c7;
  background: #e9f7ef;
  border-radius: 16px;
  padding: 16px;
  color: var(--text);
}

.help-callout strong {
  color: #11623f;
}

.help-callout p + p {
  margin-top: 8px;
}

.help-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  visibility: hidden;
}

.help-panel.is-open {
  pointer-events: auto;
  visibility: visible;
}

.help-panel-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 17, 31, 0.36);
  opacity: 0;
  transition: opacity 180ms ease;
}

.help-panel.is-open .help-panel-backdrop {
  opacity: 1;
}

.help-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(980px, calc(100vw - 22px));
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  background: #f4f7fb;
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 45px rgba(15, 33, 64, 0.22);
  padding: 22px;
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.help-panel.is-open .help-drawer {
  transform: translateX(0);
}

.help-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.help-drawer-head h3 {
  margin: 8px 0 4px;
  color: var(--navy);
  font-size: 1.45rem;
}

.help-drawer-head p {
  margin: 0;
  color: var(--muted);
}

.help-search-wrap {
  display: grid;
  gap: 7px;
}

.help-search-wrap label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.help-search-wrap input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 0 16px;
  color: var(--text);
  font-size: 0.96rem;
}

.help-drawer-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.help-chapter-nav {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  gap: 8px;
  max-height: 100%;
  overflow: auto;
}

.help-chapter-nav a,
.help-chapter-nav span {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 10px 12px;
  color: var(--navy);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 800;
}

.help-chapter-nav a:hover {
  border-color: #9db7d8;
  background: #edf5ff;
}

.help-drawer-content {
  min-height: 0;
  display: grid;
  gap: 14px;
  overflow: auto;
  padding-right: 4px;
  scroll-behavior: smooth;
}

.help-chapter-compact {
  box-shadow: none;
  border-radius: 18px;
}

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

.data-action-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.data-action-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.data-action-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #eef5ff;
  color: var(--navy);
  border: 1px solid var(--border);
}

.data-action-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.data-action-card h4 {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
}

.data-action-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.9rem;
}

.data-card-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.data-card-list li + li {
  margin-top: 4px;
}

.data-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.data-danger-card {
  border-color: rgba(196, 59, 59, 0.2);
}

.data-danger-card .data-action-icon {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(196, 59, 59, 0.22);
}

.hidden {
  display: none !important;
}

.invalid input,
.invalid select,
.invalid textarea {
  border-color: rgba(196, 59, 59, 0.35) !important;
  background: #fffafa !important;
}

.error-text {
  color: var(--red);
  font-size: 0.78rem;
}

.muted {
  color: var(--muted);
}

@media (max-width: 1280px) {
  #dashboard-metrics,
  .metric-grid,
  .launcher-grid,
  .scenario-grid,
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .model-library-grid,
  .custom-formula-list,
  .custom-formula-form,
  .custom-formula-builder,
  .custom-value-grid,
  .formula-library-categories,
  .formula-library-grid,
  .help-grid,
  .compact-help-grid,
  .help-mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insight-grid,
  .analysis-grid,
  .report-grid,
  .report-grid-main,
  .report-cover,
  .help-hero-card,
  .help-two-column,
  .next-step-card,
  .simulation-settings-explainer,
  .simulation-start-panel,
  .simulation-completion-panel,
  .scenario-explainer-grid,
  .scenario-help-grid {
    grid-template-columns: 1fr;
  }

  .help-hero-actions,
  .next-step-actions,
  .simulation-start-actions,
  .simulation-completion-actions {
    justify-content: flex-start;
  }

  .help-drawer-layout {
    grid-template-columns: 1fr;
  }

  .help-chapter-nav {
    position: relative;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

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

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .sidebar {
    grid-column: 1;
    grid-row: 2;
    width: auto;
    height: auto;
    max-height: 36vh;
    min-height: 0;
    overflow: auto;
  }

  .content {
    grid-column: 1;
    grid-row: 3;
    min-height: 0;
  }

  .app-content-footer {
    grid-column: 1;
    grid-row: 4;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-item {
    flex: 1 1 180px;
  }

  .topbar,
  .section-header,
  .app-content-footer {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .app-content-footer {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .app-footer-legal {
    text-align: left;
  }

  .app-footer-legal nav {
    justify-content: flex-start;
  }

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

  .simulation-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .model-source-head,
  .model-workspace-head {
    flex-direction: column;
    align-items: stretch;
  }

  .model-source-tabs {
    width: 100%;
  }

  .model-source-tab {
    flex: 1 1 0;
  }

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

  .workflow-stepper {
    grid-template-columns: repeat(6, minmax(108px, 1fr));
  }

  .model-library-grid,
  .custom-formula-list,
  .custom-formula-form,
  .custom-formula-builder,
  .custom-value-grid,
  .formula-library-categories,
  .formula-library-grid {
    grid-template-columns: 1fr;
  }

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

  .progress-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .model-hero {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 14px;
  }

  #dashboard-metrics,
  .metric-grid,
  .launcher-grid,
  .scenario-grid,
  .help-grid,
  .compact-help-grid,
  .help-two-column,
  .help-mini-grid,
  .report-kpi-grid,
  .sensitivity-insight-grid,
  .sensitivity-action-grid,
  .sensitivity-hero-card {
    grid-template-columns: 1fr;
  }

  .help-drawer {
    width: 100vw;
    padding: 16px;
  }

  .help-drawer-head {
    flex-direction: column;
  }

  .help-drawer-head .btn {
    width: 100%;
  }

  .help-chapter-nav {
    grid-template-columns: 1fr;
  }

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

  .report-table-row,
  .report-driver-row {
    grid-template-columns: 1fr;
  }

  .report-cover-meta strong,
  .report-driver-row span {
    justify-self: start;
    text-align: left;
  }

  .workflow-stepper {
    grid-template-columns: repeat(6, minmax(104px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .workflow-stepper-item {
    min-width: 0;
    width: 100%;
  }

  .workflow-stepper-label {
    font-size: 0.78rem;
  }

  .workflow-stepper-status {
    min-width: 64px;
    padding-inline: 8px;
    font-size: 0.64rem;
  }

  .simulation-form-grid {
    grid-template-columns: 1fr;
  }

  .compare-row,
  .percentile-row,
  .list-row,
  .sensitivity-row {
    grid-template-columns: 1fr;
  }

  .percentile-value {
    text-align: left;
  }

  .percentile-type {
    justify-self: start;
  }

  .sensitivity-values {
    justify-items: start;
    text-align: left;
  }

  .progress-steps {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 18px;
  }

  .app-header-brand {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
  }

  .app-header-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .app-header-kicker,
  .app-footer-brand span {
    font-size: 0.68rem;
  }

  .topbar h2 {
    font-size: 1.2rem;
  }

  .topbar-subtitle {
    white-space: normal;
  }

  .app-footer-brand {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .app-footer-icon {
    width: 44px;
    height: 44px;
  }
}

@media print {
  html,
  body {
    height: auto;
    overflow: visible;
    background: #fff;
  }

  .app-shell {
    display: block;
    height: auto;
    overflow: visible;
  }

  .topbar,
  .sidebar,
  .workflow-rail,
  .status-strip,
  .section-header,
  .app-content-footer,
  .help-panel {
    display: none !important;
  }

  .content {
    display: block;
    padding: 0;
    overflow: visible;
  }

  .main-grid,
  .view-section,
  .view-section.active,
  .report-output {
    display: block;
  }

  .view-section:not([data-section="report"]) {
    display: none !important;
  }

  .report-cover,
  .report-grid,
  .report-panel {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-grid,
  .report-grid-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
  }

  .report-output {
    gap: 12px;
  }

  .card {
    box-shadow: none;
  }
}
