.app-shell {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 72px;
  display: grid;
  gap: 20px;
  overflow: visible;
}

.app-page-nav {
  position: fixed;
  top: 112px;
  left: max(12px, calc(50vw - 640px - 148px));
  display: grid;
  gap: 8px;
  z-index: 20;
  padding: 12px;
  border: 1px solid rgba(31, 41, 51, 0.08);
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(255, 251, 245, 0.9), rgba(246, 238, 226, 0.82));
  box-shadow: 0 18px 40px rgba(52, 38, 24, 0.1);
  backdrop-filter: blur(12px);
}

.app-page-nav-label {
  padding: 0 4px 4px;
  color: rgba(72, 56, 44, 0.7);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.app-page-nav a {
  display: block;
  padding: 10px 12px;
  border: 1px solid rgba(31, 41, 51, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
  color: rgba(72, 56, 44, 0.8);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.app-page-nav a:hover {
  background: rgba(255, 248, 240, 0.94);
  border-color: rgba(155, 61, 47, 0.16);
  color: var(--accent);
  transform: translateY(-1px);
}

.app-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  padding: 0;
  background: rgba(250, 245, 236, 0.92);
  border-bottom: 1px solid rgba(31, 41, 51, 0.08);
  backdrop-filter: blur(14px);
}

.app-toolbar-shell {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
}

.app-toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 12px 4px;
}

.app-toolbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app-toolbar-mark {
  flex: none;
  min-width: 78px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(155, 61, 47, 0.16);
  background:
    radial-gradient(circle at top left, rgba(155, 61, 47, 0.12), transparent 42%),
    linear-gradient(160deg, rgba(255, 252, 246, 0.95), rgba(243, 232, 214, 0.72));
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.7rem;
  line-height: 1;
  text-align: center;
}

.app-toolbar-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.app-toolbar-copy strong {
  font-size: 1rem;
  font-weight: 600;
}

.app-toolbar-copy span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.app-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.app-footer {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto 28px;
  padding-top: 4px;
}

.app-footer-shell {
  display: grid;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid rgba(31, 41, 51, 0.08);
  color: rgba(72, 56, 44, 0.72);
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.36), rgba(250, 244, 234, 0.12));
}

.app-footer-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(72, 56, 44, 0.82);
}

.app-footer-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.toolbar-link,
.toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  text-decoration: none;
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.toolbar-link {
  border: 1px solid rgba(31, 41, 51, 0.12);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
}

.toolbar-link:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
}

.toolbar-button {
  border: 1px solid rgba(155, 61, 47, 0.24);
  background: rgba(155, 61, 47, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.toolbar-button:hover {
  background: rgba(155, 61, 47, 0.16);
  transform: translateY(-1px);
}

.app-main {
  display: grid;
  gap: 24px;
  min-width: 0;
  padding-top: 0;
}

.app-section-group {
  display: grid;
  gap: 18px;
  padding: 20px 20px 22px;
  border: 1px solid rgba(31, 41, 51, 0.08);
  border-radius: 28px;
  min-width: 0;
}

.app-main > [id] {
  scroll-margin-top: 96px;
}

.app-section-group-entry {
  background:
    linear-gradient(160deg, rgba(250, 245, 236, 0.94), rgba(242, 234, 220, 0.86)),
    radial-gradient(circle at top left, rgba(155, 61, 47, 0.05), transparent 42%);
}

.app-section-group-workflow {
  background:
    linear-gradient(160deg, rgba(247, 242, 233, 0.94), rgba(239, 231, 217, 0.88)),
    radial-gradient(circle at top left, rgba(155, 61, 47, 0.04), transparent 44%);
}

.app-section-group-reports {
  background:
    linear-gradient(160deg, rgba(244, 239, 230, 0.94), rgba(236, 228, 214, 0.88)),
    radial-gradient(circle at top left, rgba(155, 61, 47, 0.03), transparent 44%);
}

.app-group-header {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.app-group-label {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app-group-copy {
  color: rgba(72, 56, 44, 0.72);
  font-size: 0.82rem;
  line-height: 1.5;
}

.app-hero {
  position: relative;
  overflow: visible;
  padding-top: 8px;
  min-width: 0;
}

.app-section-group .panel.app-hero {
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(31, 41, 51, 0.07);
  box-shadow: none;
}

.app-section-group-entry .panel.app-hero {
  background:
    linear-gradient(160deg, rgba(255, 252, 247, 0.82), rgba(250, 243, 231, 0.72));
}

.app-section-group-workflow .panel.app-hero {
  background:
    linear-gradient(160deg, rgba(254, 250, 244, 0.82), rgba(247, 240, 230, 0.74));
}

.app-section-group-reports .panel.app-hero {
  background:
    linear-gradient(160deg, rgba(252, 249, 243, 0.82), rgba(245, 239, 230, 0.74));
}

.app-entry-table-panel {
  margin-top: 10px;
  position: relative;
  z-index: 1;
  min-width: 0;
}

.app-entry-grid-shell {
  position: relative;
  min-width: 0;
  border-radius: 22px;
  overflow: hidden;
}

.app-entry-cover {
  position: absolute;
  inset: 0 0 auto 0;
  height: 560px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 28px;
  text-align: center;
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(251, 247, 240, 0.985), rgba(245, 236, 220, 0.975)),
    radial-gradient(circle at top left, rgba(155, 61, 47, 0.06), transparent 42%);
  backdrop-filter: blur(8px);
  box-shadow:
    inset 0 0 0 1px rgba(31, 41, 51, 0.06),
    0 10px 28px rgba(52, 38, 24, 0.08);
}

.app-start-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 640px;
  text-align: center;
}

.app-entry-cover.is-hidden {
  display: none;
}

.app-entry-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(155, 61, 47, 0.16);
  background: rgba(255, 255, 255, 0.58);
  color: var(--accent);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-section-group-entry .app-entry-label {
  border-color: rgba(155, 61, 47, 0.16);
  color: var(--accent);
}

.app-section-group-workflow .app-entry-label {
  border-color: rgba(155, 61, 47, 0.16);
  color: var(--accent);
}

.app-section-group-reports .app-entry-label {
  border-color: rgba(155, 61, 47, 0.16);
  color: var(--accent);
}

.app-entry-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-entry-asof {
  color: rgba(72, 56, 44, 0.72);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-section-subtitle {
  margin-top: 8px;
  color: rgba(72, 56, 44, 0.72);
  font-size: 0.8rem;
  line-height: 1.5;
}

.app-start-copy strong {
  font-size: 1rem;
  font-weight: 600;
}

.app-start-copy span {
  color: rgba(72, 56, 44, 0.76);
  line-height: 1.5;
}

.app-start-actions {
  justify-content: center;
}


.app-grid-surface {
  max-width: 100%;
  max-height: 560px;
  overflow: auto;
}

.app-grid-surface.is-grid-locked {
  pointer-events: none;
  opacity: 0.78;
}

.app-grid-shell {
  width: 100%;
  min-width: 0;
}

.app-grid-shell-full {
  overflow-x: auto;
  overflow-y: visible;
}

.app-grid-shell-full .app-grid-surface {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.app-grid-shell-overlay {
  overflow: visible;
}

.app-grid-surface-compact {
  max-height: none;
  overflow: visible;
  position: relative;
}

.app-grid-surface-compact table,
.app-grid-surface-compact .jss_worksheet {
  table-layout: fixed !important;
  width: 100% !important;
  max-width: 100% !important;
}

.app-grid-surface-compact .jss_worksheet td,
.app-grid-surface-compact .jss_worksheet th {
  max-width: 1px;
}

.app-grid-surface-compact .jss_container,
.app-grid-surface-compact .jss_content,
.app-grid-surface-compact .jexcel_content,
.app-grid-surface-compact .jexcel_container {
  overflow: visible !important;
}

.app-grid-surface-compact .jdropdown-container,
.app-grid-surface-compact .jcalendar-container,
.app-grid-surface-compact .jdropdown-content {
  z-index: 120 !important;
}

.app-grid-surface-compact .jdropdown-content {
  width: max-content !important;
  min-width: 360px !important;
  max-width: min(720px, calc(100vw - 64px)) !important;
}

.app-grid-surface-compact .jdropdown-content > div,
.app-grid-surface-compact .jdropdown-content .jdropdown-item {
  white-space: nowrap !important;
}

.app-grid-surface-compact .readonly,
.app-grid-surface-compact td.readonly,
.app-grid-surface-compact .jexcel_readonly,
.app-grid-surface-compact td.jexcel_readonly {
  background: rgba(31, 41, 51, 0.06) !important;
  color: rgba(31, 41, 51, 0.7) !important;
}

.app-grid-surface-compact.is-grid-locked {
  pointer-events: none;
  opacity: 0.78;
}

.app-parameters-panel {
  position: relative;
  z-index: 20;
}

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

.app-actions-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.app-actions-row-tight {
  align-items: center;
}

.app-timeline-row {
  padding-top: 2px;
  border-top: 1px solid rgba(31, 41, 51, 0.08);
}

.app-timeline-row-first {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.app-actions-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-timeline-summary {
  gap: 12px;
  flex-wrap: wrap;
}

.app-timeline-summary strong {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
}

.app-timeline-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.app-timeline-meta:empty {
  display: none;
}

.app-checkpoint-rail {
  margin-top: 14px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 220px);
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  overscroll-behavior-x: contain;
}

.app-checkpoint-card {
  display: grid;
  gap: 6px;
  min-height: 78px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(31, 41, 51, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.app-checkpoint-card:hover {
  border-color: rgba(155, 61, 47, 0.22);
}

.app-checkpoint-card.is-active {
  border-color: rgba(155, 61, 47, 0.34);
}

.app-checkpoint-card.is-concluded {
  background: rgba(247, 243, 235, 0.88);
}

.app-checkpoint-card.is-locked {
  opacity: 0.56;
}

.app-checkpoint-date {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--ink);
}

.app-checkpoint-status {
  color: rgba(72, 56, 44, 0.9);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.app-checkpoint-stats {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.app-actions-right {
  margin-top: 0;
  justify-content: flex-end;
  align-items: center;
}

.app-cutoff-inline {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.app-cutoff-input {
  min-width: 180px;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid rgba(31, 41, 51, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: inherit;
}

.app-parameters-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.app-results-panel {
  position: relative;
  z-index: 1;
}

.app-trace-panel {
  position: relative;
  z-index: 1;
}

.app-trace-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.app-trace-card {
  min-height: 156px;
  padding: 18px 20px;
  border: 1px solid rgba(31, 41, 51, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.app-trace-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.app-trace-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.app-results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
}

.app-results-toolbar .inline-feedback {
  margin: 0;
  flex: 1 1 auto;
  font-size: 0.82rem;
  line-height: 1.45;
}

.app-report-metrics {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex: 1 1 auto;
}

.app-report-metrics .inline-feedback {
  flex: 0 0 auto;
  white-space: nowrap;
}

#app-run-backtesting,
#app-estimate,
#app-rollforward {
  min-width: 184px;
  justify-content: center;
}

#app-estimate:disabled,
#app-rollforward:disabled,
#app-run-backtesting:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  filter: saturate(0.7);
}

#app-event-grid.app-grid-surface {
  min-height: 560px;
}

.app-grid-surface table {
  width: auto;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: inherit;
}

.app-grid-surface thead th {
  position: static;
  top: auto;
  background: inherit;
  text-align: center;
  white-space: nowrap;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-grid-surface .jss_worksheet td,
.app-grid-surface .jss_worksheet th {
  padding: 0;
  border-color: rgba(31, 41, 51, 0.08);
  vertical-align: middle;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-grid-surface .jss_worksheet th {
  text-align: center;
}

.app-grid-surface .jss_worksheet td {
  text-align: left;
}

.app-grid-surface .jss_worksheet td[style*="text-align: right"],
.app-grid-surface .jss_worksheet td[align="right"] {
  text-align: right !important;
}

.app-grid-surface tbody tr:nth-child(even),
.app-grid-surface tbody tr:hover {
  background: transparent;
}

.app-grid-surface .jss_selected,
.app-grid-surface .highlight-selected,
.app-grid-surface .jss_highlight {
  background: rgba(155, 61, 47, 0.08) !important;
}

@media (max-width: 1920px) {
  .app-page-nav {
    display: none;
  }
}

@media (max-width: 980px) {
  .app-toolbar-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .app-toolbar-actions {
    width: 100%;
  }

  .toolbar-link,
  .toolbar-button {
    flex: 1;
  }

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

@media (max-width: 640px) {
  .app-shell {
    width: min(100%, calc(100% - 24px));
    padding-top: 16px;
  }

  .app-toolbar-brand {
    align-items: flex-start;
  }

  .app-toolbar-mark {
    min-width: 74px;
    font-size: 1.7rem;
  }
}
