.mc-results-table-scroll,
.app-page-content .dash-table-container,
.app-page-content .ag-theme-alpine,
.app-page-content .dash-spreadsheet-container,
.app-page-content .dash-spreadsheet-inner {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.mc-results-table-scroll .dash-table-container,
.app-page-content .dash-table-container {
  min-width: 0;
}

.mc-results-table-scroll .dash-spreadsheet-container,
.mc-results-table-scroll .dash-spreadsheet-inner,
.app-page-content .dash-spreadsheet-container,
.app-page-content .dash-spreadsheet-inner {
  min-width: 1100px;
}

.ag-theme-alpine {
  min-width: 0;
}

.app-social-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.app-social-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 6px;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.app-social-badge:hover {
  opacity: 0.95;
  text-decoration: none;
}

.app-social-badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-social-badge-x {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
}

.app-social-badge-github {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
}

.app-page-social-footer {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.app-theme-selector {
  display: flex;
  width: 100%;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.app-theme-selector-label {
  flex: 1;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.app-theme-selector-label:first-of-type { border-radius: 6px 0 0 6px; }
.app-theme-selector-label:last-of-type { border-radius: 0 6px 6px 0; border-left: 0; }
.app-theme-selector-input { position: absolute; opacity: 0; pointer-events: none; }
.app-theme-selector-input:checked + .app-theme-selector-label { background: #19324d; border-color: #19324d; color: #ffffff; }

.app-theme-switch {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
}

.app-theme-switch .form-check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.app-theme-switch .form-check-label { display: inline-flex; align-items: center; min-height: 28px; cursor: pointer; }
.app-theme-switch .form-check-input:focus + .form-check-label { outline: 2px solid #38bdf8; outline-offset: 3px; border-radius: 3px; }
.app-theme-switch-icons { display: inline-flex; align-items: center; gap: 7px; color: #64748b; font-size: 1.05rem; line-height: 1; }
.app-theme-icon { display: inline-block; transition: opacity 0.15s ease, color 0.15s ease; }
.app-theme-icon-sun { color: #d97706; }
.app-theme-icon-moon { opacity: 0.45; }
.app-theme-switch .form-check-input:checked + .form-check-label .app-theme-icon-sun { opacity: 0.4; }
.app-theme-switch .form-check-input:checked + .form-check-label .app-theme-icon-moon { color: #7dd3fc; opacity: 1; }

.app-theme-night {
  min-height: 100vh;
  background: #111827;
  color: #e5e7eb;
  color-scheme: dark;
}
.app-theme-night .card,
.app-theme-night .app-page-content,
.app-theme-night .app-nav-column > div,
.app-theme-night #persistent-summary-card,
.app-theme-night .ag-theme-alpine { background: #1f2937 !important; color: #e5e7eb !important; }
.app-theme-night .app-page-content div[style*="background: rgb(255, 255, 255)"],
.app-theme-night .app-page-content div[style*="background: rgb(248, 249, 250)"],
.app-theme-night .app-page-content div[style*="background: rgb(248, 250, 252)"],
.app-theme-night .app-page-content div[style*="background: rgb(241, 245, 249)"],
.app-theme-night .app-page-content div[style*="background: rgb(238, 246, 255)"],
.app-theme-night .app-page-content div[style*="background: rgb(255, 247, 237)"] { background: #1f2937 !important; border-color: #475569 !important; }
.app-theme-night .help-page { color: #f8fafc; }
.app-theme-night .help-guide-card {
  background: #263446 !important;
  border-color: #3b4b60 !important;
}
.app-theme-night .help-guide-number { background: #334155 !important; color: #ffffff !important; }
.app-theme-night .help-guide-title { color: #ffffff !important; }
.app-theme-night .help-guide-slug { background: #172033 !important; color: #dbeafe !important; }
.app-theme-night .help-guide-purpose,
.app-theme-night .help-guide-steps,
.app-theme-night .help-guide-steps li { color: #e5e7eb !important; }
.app-theme-night .help-reading-numbers {
  background: #243243 !important;
  border-left-color: #2dd4bf !important;
  color: #f8fafc !important;
}
.app-theme-night .help-reading-numbers h3,
.app-theme-night .help-reading-numbers li { color: #f8fafc !important; }
.app-theme-night .text-dark,
.app-theme-night h1,
.app-theme-night h2,
.app-theme-night h3,
.app-theme-night h4,
.app-theme-night h5,
.app-theme-night h6 { color: #f8fafc !important; }
.app-theme-night .text-muted,
.app-theme-night .app-header-subtitle { color: #cbd5e1 !important; }
.app-theme-night .app-header-meta,
.app-theme-night .app-header-meta a,
.app-theme-night .app-header-meta > div { color: #cbd5e1 !important; }
.app-theme-night .app-header-selector > div { background: #1f2937 !important; border-color: #475569 !important; box-shadow: none !important; }
.app-theme-night .app-header-selector button { background: #111827 !important; border-color: #475569 !important; color: #7dd3fc !important; }
.app-theme-night .app-header-selector div[style*="color: rgb(15, 23, 42)"] { color: #5eead4 !important; }
.app-theme-night .app-nav-column a:not(.active),
.app-theme-night .app-page-content a { color: #93c5fd; }
.app-theme-night .js-plotly-plot,
.app-theme-night .js-plotly-plot .plotly { background: #1f2937 !important; }
.app-theme-night .js-plotly-plot svg.main-svg:first-of-type { background: #1f2937 !important; }
.app-theme-night .js-plotly-plot .plotly .bg { fill: #1f2937 !important; }
.app-theme-night .js-plotly-plot .plotly .gridlayer path { stroke: #475569 !important; }
.app-theme-night .js-plotly-plot .plotly .xtick text,
.app-theme-night .js-plotly-plot .plotly .ytick text,
.app-theme-night .js-plotly-plot .plotly .xtitle,
.app-theme-night .js-plotly-plot .plotly .ytitle,
.app-theme-night .js-plotly-plot .plotly .gtitle,
.app-theme-night .js-plotly-plot .plotly .legendtext { fill: #e5e7eb !important; }
.app-theme-night .form-control,
.app-theme-night .form-select,
.app-theme-night .dropdown-menu { background: #1f2937; border-color: #475569; color: #e5e7eb; }
.app-theme-night .form-control::placeholder { color: #94a3b8; }
.app-theme-night .player-lookup-filters label { color: #e2e8f0; }
.app-theme-night .Select-control,
.app-theme-night .Select-menu-outer,
.app-theme-night .Select-menu,
.app-theme-night .Select-option,
.app-theme-night .Select-value,
.app-theme-night .Select-input,
.app-theme-night .player-lookup-filters .DateRangePickerInput,
.app-theme-night .player-lookup-filters .DateInput { background: #1f2937; border-color: #475569; }
.app-theme-night .Select-value-label,
.app-theme-night .Select-placeholder,
.app-theme-night .Select-arrow,
.app-theme-night .Select-input > input,
.app-theme-night .player-lookup-filters .DateInput_input,
.app-theme-night .player-lookup-filters .DateRangePickerInput_arrow { color: #e5e7eb; }
.app-theme-night .player-lookup-filters .DateInput_input { background: #1f2937; }
.app-theme-night .Select-menu-outer,
.app-theme-night .Select-menu,
.app-theme-night .Select-option { color: #e5e7eb; }
.app-theme-night .Select-option.is-focused,
.app-theme-night .Select-option.is-selected { background: #334155; color: #f8fafc; }
.app-theme-night .dash-dropdown { background: #1f2937; border-color: #475569; color: #e5e7eb; }
.app-theme-night .dash-dropdown:hover,
.app-theme-night .dash-dropdown[data-state="open"] { border-color: #38bdf8; }
.app-theme-night .dash-dropdown-options,
.app-theme-night .dash-options-list { background: #1f2937; border-color: #475569; color: #e5e7eb; }
.app-theme-night .dash-dropdown-options input[type="search"] { background: #111827; border-color: #475569; color: #f8fafc; }
.app-theme-night .dash-dropdown-option { color: #e5e7eb; }
.app-theme-night .dash-dropdown-option:hover,
.app-theme-night .dash-dropdown-option.selected { background: #334155; color: #f8fafc; }
.app-theme-night .player-lookup-summary { background: #1f2937; border-color: #475569 !important; color: #f1f5f9; }
.app-theme-night .nav-pills .nav-link { color: #dbeafe; }
.app-theme-night .nav-pills .nav-link.active { background: #0f766e; }
.app-theme-night .app-theme-selector,
.app-theme-night .app-theme-switch,
.app-theme-night .app-social-badges { border-color: #475569; }
.app-theme-night .app-theme-switch { color: #e2e8f0; }
.app-theme-night .app-theme-switch .form-check-input { background-color: #475569; border-color: #64748b; }
.app-theme-night .app-theme-switch .form-check-input:checked { background-color: #14b8a6; border-color: #14b8a6; }
.app-theme-night [style*="color: rgb(15, 23, 42)"],
.app-theme-night [style*="color: rgb(23, 32, 51)"],
.app-theme-night [style*="color: rgb(31, 41, 51)"],
.app-theme-night [style*="color: rgb(51, 65, 85)"],
.app-theme-night [style*="color: rgb(71, 85, 105)"],
.app-theme-night [style*="color: rgb(82, 97, 115)"],
.app-theme-night [style*="color: rgb(100, 116, 139)"] { color: #e5e7eb !important; }
.app-theme-night #persistent-summary-cell { color: #e5e7eb; }
.app-theme-night #persistent-summary-cell * { color: #e5e7eb !important; }
.app-theme-night #persistent-summary-cell [style*="color: rgb(15, 118, 110)"] { color: #2dd4bf !important; }
.app-theme-night #persistent-summary-cell [style*="color: rgb(180, 83, 9)"] { color: #fbbf24 !important; }
.app-theme-night #persistent-summary-cell [id^="event-max-"] { background: #172554 !important; color: #7dd3fc !important; }
.app-theme-night [id^="event-max-"] > div:first-child { background: var(--event-bar-night-color) !important; }
.app-theme-night .app-theme-selector-label { background: #111827; border-color: #475569; color: #cbd5e1; }
.app-theme-night .app-theme-selector-input:checked + .app-theme-selector-label { background: #0f766e; border-color: #0f766e; color: #ffffff; }
.app-theme-night .ag-header,
.app-theme-night .ag-row { background: #1f2937 !important; color: #e5e7eb !important; border-color: #475569 !important; }
.app-theme-night .ag-theme-alpine {
  --ag-background-color: #1f2937;
  --ag-foreground-color: #e5e7eb;
  --ag-header-background-color: #111827;
  --ag-header-foreground-color: #f8fafc;
  --ag-border-color: #475569;
  --ag-secondary-border-color: #334155;
  --ag-row-border-color: #475569;
  --ag-odd-row-background-color: #1f2937;
  --ag-input-background-color: #111827;
  --ag-input-border-color: #475569;
  --ag-control-panel-background-color: #1f2937;
  --ag-selected-row-background-color: #334155;
}
.app-theme-night .mc-workflow-card,
.app-theme-night .mc-projection-output { background: #1f2937 !important; color: #e5e7eb; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important; }
.app-theme-night .mc-workflow-card input[type="number"] { background: #111827; border: 1px solid #475569; color: #f8fafc; }
.app-theme-night .mc-workflow-card input[type="checkbox"] { accent-color: #14b8a6; }
.app-theme-night .mc-workflow-card label { color: #e5e7eb; }
.app-theme-night .mc-workflow-card .btn-outline-secondary { color: #cbd5e1; border-color: #64748b; }
.app-theme-night .mc-workflow-card .btn-outline-secondary:hover { background: #334155; color: #f8fafc; }
.app-theme-night .mc-workflow-card .btn-outline-primary { color: #7dd3fc; border-color: #38bdf8; }
.app-theme-night .mc-workflow-card .btn-outline-primary:hover { background: #0369a1; color: #ffffff; }
.app-theme-night .dash-table-container,
.app-theme-night .dash-spreadsheet-container,
.app-theme-night .dash-spreadsheet-inner,
.app-theme-night .dash-table-container table { background: #1f2937 !important; color: #e5e7eb !important; }
.app-theme-night .dash-table-container .dash-cell,
.app-theme-night .dash-table-container .dash-cell-value,
.app-theme-night .dash-table-container td { background: #1f2937 !important; border-color: #475569 !important; color: #e5e7eb !important; }
.app-theme-night .dash-table-container th,
.app-theme-night .dash-table-container .dash-header,
.app-theme-night .dash-table-container .column-header-name { background: #111827 !important; border-color: #475569 !important; color: #f8fafc !important; }
.app-theme-night .dash-table-container .dash-filter input,
.app-theme-night .dash-table-container .previous-next-container button,
.app-theme-night .dash-table-container .page-number { background: #1f2937 !important; border-color: #475569 !important; color: #e5e7eb !important; }

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

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

.app-header-controls {
  display: grid;
  grid-template-columns: auto minmax(132px, 0.28fr);
  align-items: center;
  justify-items: end;
  gap: 12px;
  min-width: 0;
}

.app-header-subtitle {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.app-header-selector {
  justify-self: end;
  max-width: 100%;
}

.app-header-meta {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  text-align: right;
  gap: 2px;
  white-space: nowrap;
  color: #64748b;
  font-size: 0.62rem;
}

.app-header-meta a,
.app-header-meta > div {
  white-space: nowrap;
}

@media (max-width: 1240px) and (min-width: 901px) {
  .app-header-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .app-header-controls {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .app-header-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .app-header-controls {
    width: 100%;
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 8px;
  }

  .app-header-selector {
    justify-self: stretch;
  }

  .app-header-meta {
    width: 100%;
    align-items: flex-start;
    text-align: left;
    font-size: 0.52rem;
  }
}

@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell.container-fluid,
  .app-shell-fallback {
    padding: 10px !important;
  }

  .app-shell h2 {
    white-space: normal !important;
    font-size: 1.35rem;
  }

  .app-header-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .app-header-brand {
    width: 100%;
  }

  .app-header-subtitle {
    font-size: 0.495rem !important;
    letter-spacing: 0.06em;
  }

  .app-header-controls {
    width: 100%;
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 8px;
  }

  .app-header-selector {
    width: 100%;
    max-width: 100%;
    justify-self: stretch !important;
  }

  .app-header-meta {
    width: 100%;
    min-width: 0;
    align-items: flex-start !important;
    text-align: left !important;
    white-space: nowrap !important;
    margin-top: 2px;
    font-size: 0.48rem;
    display: flex;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px;
  }

  .app-header-meta a,
  .app-header-meta > div {
    font-size: 0.7em !important;
    line-height: 1.3;
    white-space: nowrap !important;
  }

  .app-shell > .row {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .app-shell > .row > [class*="col-"] {
    padding-right: 0 !important;
    padding-left: 0 !important;
  }

  .series-points-strip {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100%;
    max-width: none !important;
  }

  .series-points-strip > div {
    min-width: 0 !important;
    width: 100%;
  }

  .app-main-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .app-nav-column,
  .app-content-column {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
  }

  .app-nav-column .card-body {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px !important;
    min-width: 0;
    overflow: hidden;
  }

  .app-nav-column .nav,
  .app-shell-fallback .app-nav-column > div {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    width: 100%;
    max-width: 100%;
  }

  .app-nav-column .nav {
    flex: 1 1 auto;
    min-width: 0;
  }

  .app-nav-column .app-theme-selector,
  .app-shell-fallback .app-theme-selector,
  .app-nav-column .app-theme-switch,
  .app-shell-fallback .app-theme-switch {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .app-nav-column .app-theme-switch,
  .app-shell-fallback .app-theme-switch {
    align-self: center;
    min-width: 0;
  }

  .app-nav-column .app-theme-switch .form-check-input,
  .app-shell-fallback .app-theme-switch .form-check-input {
    width: 2.15rem;
    height: 1.2rem;
    margin-right: 5px;
  }

  .app-theme-switch-icons { gap: 3px; font-size: 0.8rem; }

  .app-nav-column .app-theme-selector-label,
  .app-shell-fallback .app-theme-selector-label {
    padding: 7px 8px;
    font-size: 0.72rem;
  }

  .app-nav-column .nav-item,
  .app-shell-fallback .app-nav-column a {
    flex: 0 0 auto;
  }

  .app-nav-column .nav-link,
  .app-shell-fallback .app-nav-column a {
    width: auto !important;
    margin: 0 !important;
    padding: 8px 11px !important;
    white-space: nowrap;
    font-size: 0.82rem;
  }

  .app-nav-column .app-social-badges {
    display: none !important;
  }

  .app-page-social-footer {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
    width: 100%;
  }

  .app-page-content {
    min-width: 0;
    padding: 12px !important;
  }

  #persistent-summary-cell {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
  }

  #persistent-summary-cell > div {
    min-width: 0 !important;
    width: 100%;
    padding: 10px 0 !important;
    border-left: 0 !important;
    border-top: 1px solid #e5e7eb;
  }

  #persistent-summary-cell > div:first-child {
    border-top: 0 !important;
  }

  .app-page-content .dash-table-container,
  .app-page-content .ag-theme-alpine,
  .app-page-content .js-plotly-plot {
    width: 100% !important;
    max-width: 100%;
  }

  .app-page-content .dash-table-container,
  .app-page-content .dash-spreadsheet-container,
  .app-page-content .dash-spreadsheet-inner {
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .mc-results-table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .mc-results-table-scroll .dash-table-container {
    width: 1120px !important;
    min-width: 1120px !important;
    max-width: none !important;
  }
}

@media (max-width: 400px) {
  .series-points-strip {
    position: relative;
    display: block !important;
    padding-top: 34px;
  }

  .series-points-title {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 8px;
    display: flex;
    align-items: baseline;
    gap: 7px;
    width: auto !important;
    min-width: 0 !important;
    padding: 4px 8px 3px;
    border: 1px solid #e2e8f0;
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    background: #fff;
  }

  .series-points-title > div:first-child {
    font-size: 9px !important;
  }

  .series-points-title > div:last-child {
    font-size: 15px !important;
  }

  .series-points-chart {
    width: 100% !important;
    min-width: 0 !important;
  }

  .series-points-bar {
    width: 100%;
  }

  .series-points-chart > div:last-child {
    gap: 8px !important;
    font-size: 9px !important;
  }
}
