.mpo-app {
  --mpo-bg: #f4f7fb;
  --mpo-panel: #ffffff;
  --mpo-ink: #172033;
  --mpo-muted: #64748b;
  --mpo-line: #dbe4ee;
  --mpo-accent: #2563eb;
  --mpo-accent-soft: #dbeafe;
  --mpo-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, #f7fbff 0%, #eff5fb 100%);
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  color: var(--mpo-ink);
  box-shadow: var(--mpo-shadow);
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.mpo-viewer-open {
  overflow: hidden;
}

.mpo-app * {
  box-sizing: border-box;
}

@keyframes mpo-guided-cue {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.42), 0 10px 24px rgba(37, 99, 235, 0.16);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.08), 0 14px 30px rgba(37, 99, 235, 0.24);
  }
}

@keyframes mpo-guided-cue-status {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.32);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.08);
  }
}

@keyframes mpo-viewer-notice-flash {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }

  7%,
  21%,
  35%,
  72% {
    opacity: 1;
    transform: translateY(0);
  }

  14%,
  28%,
  42% {
    opacity: 0.72;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes mpo-viewer-notice-fade {
  0% {
    opacity: 0;
    transform: translateY(3px);
  }

  10%,
  82% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-3px);
  }
}

.mpo-app button,
.mpo-app input,
.mpo-app select,
.mpo-app textarea,
.mpo-app option,
.mpo-app optgroup {
  font: inherit;
  font-family: inherit;
}

.mpo-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 20px;
  background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.1), transparent 40%), #ffffff;
  border-bottom: 1px solid var(--mpo-line);
}

.mpo-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #2563eb;
  font-weight: 700;
}

.mpo-toolbar h2 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.1;
}

.mpo-subtitle,
.mpo-strip-caption,
.mpo-stage-header p,
.mpo-empty-copy,
.mpo-modal-card p,
.mpo-modal-hint {
  margin: 0;
  color: var(--mpo-muted);
  line-height: 1.5;
}

.mpo-subtitle a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
}

.mpo-launcher-helper {
  margin: 8px 0 0;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.mpo-select-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  min-width: 0;
}

.mpo-select-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--mpo-ink);
}

.mpo-select-control {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--mpo-line);
  background: #fff;
  color: var(--mpo-ink);
  padding: 0 14px;
  font: inherit;
  font-family: inherit;
  font-size: 16px;
}

.mpo-select-help {
  margin: 0;
  color: var(--mpo-muted);
  font-size: 13px;
  line-height: 1.45;
}

.mpo-toolbar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  flex: 0 0 auto;
}

.mpo-toolbar-file-actions,
.mpo-toolbar-viewer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  align-items: stretch;
  width: min(100%, 332px);
  gap: 12px;
}

.mpo-toolbar-file-actions .mpo-file-button,
.mpo-toolbar-file-actions .mpo-secondary-button,
.mpo-toolbar-viewer-actions .mpo-primary-button,
.mpo-toolbar-viewer-actions .mpo-secondary-button {
  width: 100%;
}

.mpo-app.mpo-export-desktop-only .mpo-toolbar-viewer-actions {
  grid-template-columns: 1fr;
  width: min(100%, 160px);
}

.mpo-app.mpo-export-desktop-only .mpo-toolbar-status {
  grid-column: auto;
}

.mpo-toolbar-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 100%;
  min-width: 0;
  flex: none;
  grid-column: 1 / -1;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--mpo-line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--mpo-muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
}

.mpo-toolbar-status[data-state="loading"] {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.mpo-toolbar-status[data-state="ready"] {
  color: #166534;
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.mpo-toolbar-status[data-state="error"],
.mpo-toolbar-status[data-state="unavailable"] {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.mpo-file-button,
.mpo-primary-button,
.mpo-secondary-button,
.mpo-export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.mpo-file-button,
.mpo-primary-button {
  background: var(--mpo-accent);
  color: #fff;
  border: none;
}

.mpo-secondary-button {
  background: #fff;
  color: var(--mpo-ink);
  border: 1px solid var(--mpo-line);
}

.mpo-export-button {
  white-space: nowrap;
}

.mpo-primary-button[disabled],
.mpo-secondary-button[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

.mpo-file-button input {
  display: none;
}

.mpo-app[data-mpo-next-action="add-files"] .mpo-file-button,
.mpo-app[data-mpo-next-action="open-viewer"] [data-mpo-open-viewer]:not(:disabled) {
  animation: mpo-guided-cue 1.7s ease-in-out infinite;
}

.mpo-app[data-mpo-next-action="loading"] [data-mpo-prewarm-status] {
  animation: mpo-guided-cue-status 1.35s ease-in-out infinite;
}

body.mpo-viewer-open .mpo-app[data-mpo-next-action="open-viewer"] [data-mpo-open-viewer]:not(:disabled),
body.mpo-viewer-open .mpo-app[data-mpo-next-action="loading"] [data-mpo-prewarm-status] {
  animation: none;
  box-shadow: none;
}

.mpo-app[data-mpo-next-action="attention"] [data-mpo-prewarm-status] {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.mpo-banner,
.mpo-file-strip,
.mpo-panel,
.mpo-stage,
.mpo-modal-card {
  background: var(--mpo-panel);
}

.mpo-banner {
  margin: 20px 24px 20px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 16px;
  padding: 14px 16px;
}

.mpo-file-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px 20px;
  align-items: flex-start;
}

.mpo-stage-status {
  margin: 8px 0 0;
  color: var(--mpo-muted);
  line-height: 1.5;
  max-width: 620px;
}

.mpo-file-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.mpo-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border-radius: 999px;
  background: var(--mpo-accent-soft);
  color: #1e3a8a;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
}

.mpo-chip-text {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mpo-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: rgba(30, 58, 138, 0.14);
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.mpo-chip-remove:hover,
.mpo-chip-remove:focus-visible {
  background: rgba(30, 58, 138, 0.22);
  color: #172554;
  transform: scale(1.04);
}

.mpo-chip-muted {
  background: #e2e8f0;
  color: #475569;
}

.mpo-chip-warning {
  background: rgba(217, 119, 6, 0.16);
  color: #92400e;
}

.mpo-chip-info {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.mpo-chip-button {
  border: none;
  cursor: pointer;
  font: inherit;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, color 140ms ease;
}

.mpo-chip-button:hover,
.mpo-chip-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.mpo-chip-button:focus-visible {
  outline: 2px solid rgba(245, 158, 11, 0.4);
  outline-offset: 2px;
}

.mpo-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  padding: 24px;
}

.mpo-layout-launcher {
  display: block;
}

.mpo-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mpo-layout-launcher .mpo-sidebar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.mpo-layout-launcher .mpo-panel-priority {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.mpo-panel {
  border: 1px solid var(--mpo-line);
  border-radius: 20px;
  padding: 18px;
  min-width: 0;
  max-width: 100%;
}

.mpo-panel h3,
.mpo-stage-header h3,
.mpo-modal-card h3,
.mpo-viewer-copy h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.mpo-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.mpo-facts li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-top: 1px solid var(--mpo-line);
  padding-top: 12px;
  min-width: 0;
}

.mpo-facts li:first-child {
  border-top: none;
  padding-top: 0;
}

.mpo-facts span {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--mpo-muted);
}

.mpo-facts strong {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mpo-session-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.mpo-session-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.mpo-interpretation-preview {
  --mpo-interpretation-preview-border: light-dark(rgba(191, 219, 254, 0.9), rgba(59, 130, 246, 0.24));
  --mpo-interpretation-preview-surface-top: light-dark(rgba(248, 250, 252, 0.98), rgba(15, 23, 42, 0.96));
  --mpo-interpretation-preview-surface-bottom: light-dark(rgba(239, 246, 255, 0.96), rgba(30, 41, 59, 0.94));
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding: 12px;
  min-width: 0;
  border: 1px solid var(--mpo-interpretation-preview-border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, var(--mpo-interpretation-preview-surface-top), var(--mpo-interpretation-preview-surface-bottom)),
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.1), transparent 42%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.mpo-interpretation-preview-title,
.mpo-interpretation-preview-more {
  color: var(--mpo-ink);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.mpo-interpretation-preview-more {
  color: var(--mpo-muted);
}

.mpo-interpretation-item {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.mpo-interpretation-item-title {
  color: var(--mpo-ink);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.mpo-interpretation-item-copy {
  color: var(--mpo-muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mpo-interpretation-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.mpo-interpretation-modal-item {
  --mpo-interpretation-modal-item-border: light-dark(rgba(203, 213, 225, 0.92), rgba(51, 65, 85, 0.92));
  --mpo-interpretation-modal-item-top: light-dark(rgba(248, 250, 252, 0.98), rgba(15, 23, 42, 0.98));
  --mpo-interpretation-modal-item-bottom: light-dark(rgba(241, 245, 249, 0.96), rgba(30, 41, 59, 0.94));
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--mpo-interpretation-modal-item-border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--mpo-interpretation-modal-item-top), var(--mpo-interpretation-modal-item-bottom));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 12px 24px rgba(15, 23, 42, 0.06);
}

.mpo-interpretation-modal-item strong {
  color: var(--mpo-ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.mpo-interpretation-modal-meta,
.mpo-interpretation-modal-support {
  color: var(--mpo-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.mpo-interpretation-modal-copy {
  margin: 0;
  color: var(--mpo-ink);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.mpo-priority-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.mpo-priority-copy {
  min-width: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mpo-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  color: var(--mpo-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.mpo-toggle span {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mpo-toggle input[type="checkbox"] {
  margin: 2px 0 0;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--mpo-accent, #2563eb);
}

.mpo-inferred-toggle + .mpo-priority-copy {
  margin-top: -2px;
}

.mpo-priority-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.mpo-priority-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--mpo-line);
  border-radius: 14px;
  background: #f8fbff;
  cursor: grab;
  min-width: 0;
  max-width: 100%;
}

.mpo-priority-item.is-dragging {
  opacity: 0.6;
}

.mpo-priority-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--mpo-accent-soft);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.mpo-priority-label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mpo-priority-label strong {
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mpo-priority-label span {
  color: var(--mpo-muted);
  font-size: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mpo-priority-handle {
  color: var(--mpo-muted);
  font-size: 16px;
  letter-spacing: 0.08em;
}

.mpo-match-summary {
  display: grid;
  gap: 10px;
}

.mpo-heat-legend {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(191, 219, 254, 0.9);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.94)),
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 45%);
}

.mpo-heat-legend-copy {
  display: grid;
  gap: 2px;
}

.mpo-heat-legend-copy strong {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f172a;
}

.mpo-heat-legend-copy span {
  color: var(--mpo-muted);
  font-size: 12px;
  line-height: 1.4;
}

.mpo-heat-spectrum {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1d4ed8 0%, #38bdf8 22%, #22c55e 50%, #facc15 72%, #f97316 86%, #dc2626 100%);
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.45),
    0 4px 18px rgba(59, 130, 246, 0.12);
}

.mpo-heat-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  color: var(--mpo-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mpo-heat-labels span:nth-child(2) {
  text-align: center;
}

.mpo-heat-labels span:last-child {
  text-align: right;
}

.mpo-match-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mpo-stat-pill,
.mpo-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.mpo-stat-pill {
  background: #e2e8f0;
  color: #334155;
}

.mpo-stat-high,
.mpo-status-high {
  background: #fee2e2;
  color: #b91c1c;
}

.mpo-stat-low,
.mpo-status-low {
  background: #dbeafe;
  color: #1d4ed8;
}

.mpo-stat-normal,
.mpo-status-normal {
  background: #dcfce7;
  color: #15803d;
}

.mpo-status-unknown {
  background: #e2e8f0;
  color: #475569;
}

.mpo-session-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--mpo-line);
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
}

.mpo-session-card strong,
.mpo-session-card span {
  min-width: 0;
  color: var(--mpo-muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.mpo-session-card .mpo-chip-button {
  justify-self: flex-start;
  margin-top: 4px;
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.mpo-match-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
  min-width: 0;
}

.mpo-match-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--mpo-line);
  border-radius: 14px;
  background: #f8fbff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: inset 3px 0 0 var(--mpo-match-accent, transparent);
  width: 100%;
  min-width: 0;
}

.mpo-match-card:hover,
.mpo-match-card:focus-visible {
  border-color: var(--mpo-match-accent, #93c5fd);
  box-shadow:
    inset 3px 0 0 var(--mpo-match-accent, transparent),
    0 10px 24px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.mpo-match-card.is-active {
  border-color: var(--mpo-match-accent, rgba(14, 116, 144, 0.55));
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 44%),
    linear-gradient(180deg, rgba(240, 249, 255, 0.96), rgba(236, 253, 245, 0.94));
  box-shadow:
    inset 3px 0 0 var(--mpo-match-accent, transparent),
    0 16px 36px rgba(14, 116, 144, 0.16);
}

.mpo-match-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.mpo-match-header strong {
  font-size: 14px;
  line-height: 1.3;
}

.mpo-match-header-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.mpo-match-subtitle {
  color: var(--mpo-muted);
  font-size: 12px;
  line-height: 1.4;
}

.mpo-match-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.mpo-overlay-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 42%, white);
  background: color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 12%, white);
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
}

.mpo-overlay-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--mpo-match-accent, #94a3b8);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 18%, white);
}

.mpo-match-meta,
.mpo-match-range,
.mpo-match-deviation {
  color: var(--mpo-muted);
  font-size: 12px;
  line-height: 1.4;
}

.mpo-match-value-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.mpo-match-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--mpo-ink);
}

.mpo-observation-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  min-width: 0;
}

.mpo-observation-row {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(219, 228, 238, 0.9);
  background: rgba(255, 255, 255, 0.78);
  min-width: 0;
}

.mpo-observation-row.is-winner {
  border-color: color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 40%, white);
  background: color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 8%, white);
}

.mpo-observation-header,
.mpo-observation-value-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  min-width: 0;
}

.mpo-observation-source {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mpo-observation-source strong {
  font-size: 12px;
}

.mpo-observation-source span,
.mpo-observation-note {
  color: var(--mpo-muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mpo-observation-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--mpo-ink);
}

.mpo-observation-range {
  color: var(--mpo-muted);
  font-size: 11px;
}

.mpo-see-also {
  display: none;
  gap: 10px;
  margin-top: 6px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 79, 163, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 79, 163, 0.12), rgba(255, 79, 163, 0.06)),
    rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 12px 28px rgba(255, 79, 163, 0.12);
}

.mpo-match-card.is-active .mpo-see-also {
  display: grid;
}

.mpo-see-also-title {
  font-size: 11px;
  line-height: 1.15;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9d174d;
}

.mpo-see-also-item {
  display: grid;
  gap: 8px;
}

.mpo-see-also-copy {
  margin: 0;
  color: #4a044e;
  font-size: 11px;
  line-height: 1.35;
  text-wrap: pretty;
}

.mpo-app p.mpo-see-also-copy {
  margin: 0;
  color: #4a044e;
  font-size: 11px;
  line-height: 1.35;
  font-family: inherit;
}

.mpo-see-also-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mpo-see-also-chip {
  border-color: rgba(255, 79, 163, 0.35);
  background: rgba(255, 245, 250, 0.95);
  color: #831843;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 8px 18px rgba(255, 79, 163, 0.14);
}

.mpo-see-also-chip:hover,
.mpo-see-also-chip:focus-visible {
  border-color: rgba(255, 79, 163, 0.55);
  background: rgba(255, 232, 243, 0.98);
  box-shadow: 0 12px 24px rgba(255, 79, 163, 0.2);
}

.mpo-see-also-chip.is-unmatched,
.mpo-see-also-chip:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  box-shadow: none;
}

.mpo-app .mpo-context-link-core,
.mpo-app .mpo-context-target-frame {
  transform-box: fill-box;
  transform-origin: center;
}

.mpo-app .mpo-context-link-core,
.mpo-app .mpo-context-target-frame {
  filter: none;
}

.mpo-viewer-shell.is-interacting .mpo-context-link-core,
.mpo-viewer-shell.is-interacting .mpo-context-target-frame {
  display: none;
}

.mpo-stage {
  border: 1px solid var(--mpo-line);
  border-radius: 24px;
  padding: 18px;
  min-width: 0;
}

.mpo-stage-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.mpo-stage-actions {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.mpo-zoom-controls {
  display: grid;
  gap: 6px;
  justify-items: end;
  min-width: 0;
}

.mpo-zoom-button-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mpo-zoom-hint,
.mpo-zoom-readout {
  color: var(--mpo-muted);
  font-size: 12px;
  line-height: 1.4;
}

.mpo-zoom-hint {
  max-width: 430px;
  text-align: right;
  text-wrap: pretty;
}

.mpo-zoom-button {
  min-width: 42px;
  min-height: 36px;
  padding: 0 12px;
}

.mpo-zoom-readout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(203, 213, 225, 0.9);
  font-weight: 700;
  color: var(--mpo-ink);
  font-size: 12px;
}

.mpo-diagram-shell {
  border-radius: 20px;
  min-height: 540px;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
  border: 1px dashed #cbd5e1;
  overflow: auto;
  position: relative;
  cursor: grab;
  overscroll-behavior: contain;
  touch-action: none;
}

.mpo-diagram-shell *,
.mpo-viewer-shell * {
  touch-action: none;
}

.mpo-diagram-canvas {
  padding: 20px;
  min-width: 100%;
  min-height: 100%;
  position: relative;
}

.mpo-diagram-shell.is-dragging,
.mpo-viewer-shell.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.mpo-viewer[hidden] {
  display: none;
}

.mpo-viewer {
  position: fixed;
  inset: 12px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 28%),
    rgba(241, 245, 249, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 28px;
  box-shadow: 0 32px 120px rgba(15, 23, 42, 0.28);
}

.mpo-viewer.mpo-viewer-prewarming {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  z-index: -1;
}

.mpo-viewer-chrome {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.mpo-viewer-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  column-gap: 14px;
  row-gap: 6px;
}

.mpo-viewer-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.mpo-viewer-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.mpo-viewer-title-row .mpo-eyebrow {
  margin: 0;
  white-space: nowrap;
}

.mpo-viewer-copy h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.08;
  min-width: 0;
}

.mpo-viewer-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  position: relative;
}

.mpo-viewer-copy [data-mpo-viewer-status],
.mpo-viewer-topbar .mpo-viewer-nav-hint {
  margin: 0;
  color: var(--mpo-muted);
  font-size: 12px !important;
  line-height: 1.35;
}

.mpo-viewer-topbar .mpo-viewer-nav-hint {
  letter-spacing: 0.01em;
}

.mpo-viewer-notice {
  position: absolute;
  inset: -2px 0 auto 0;
  z-index: 6;
  margin: 0 !important;
  padding: 7px 10px;
  border: 1px solid rgba(249, 115, 22, 0.42);
  border-radius: 14px;
  background: color-mix(in srgb, #fff7ed 92%, white);
  box-shadow: 0 14px 34px rgba(124, 45, 18, 0.18);
  color: #8a3c00;
  font-size: 12px !important;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  backdrop-filter: blur(10px);
}

.mpo-viewer-notice:empty {
  display: none;
}

.mpo-viewer-notice.is-visible {
  display: block;
  animation: mpo-viewer-notice-flash 5.2s ease-in-out both;
}

.mpo-viewer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  flex: 0 0 auto;
}

.mpo-close-icon {
  display: none;
  font-size: 24px;
  line-height: 1;
}

.mpo-viewer-mobile-controls {
  display: none;
}

.mpo-details-toggle {
  display: none;
}

.mpo-viewer-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
  grid-template-areas: "sidebar stage";
}

.mpo-viewer-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  grid-area: sidebar;
}

.mpo-viewer-stage {
  min-width: 0;
  min-height: 0;
  grid-area: stage;
}

.mpo-viewer-shell {
  height: 100%;
  min-height: 0;
  border-radius: 24px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  border: 1px solid #cbd5e1;
  overflow: auto;
  position: relative;
  cursor: grab;
  overscroll-behavior: contain;
  touch-action: none;
}

.mpo-viewer-shell:focus,
.mpo-viewer-shell:focus-visible {
  outline: none;
}

.mpo-viewer-loading[hidden] {
  display: none;
}

.mpo-viewer-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.76), rgba(226, 232, 240, 0.84));
}

.mpo-viewer-loading-card {
  min-width: min(360px, 100%);
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 26px;
  text-align: center;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.14), transparent 52%),
    rgba(255, 255, 255, 0.92);
  box-shadow: 0 22px 56px rgba(15, 23, 42, 0.16);
}

.mpo-viewer-loading-card strong {
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.mpo-viewer-loading-card p {
  margin: 0;
  color: var(--mpo-muted);
}

.mpo-viewer-loading-spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.28);
  border-top-color: #2563eb;
  border-right-color: #0ea5e9;
  box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.08);
  animation: mpo-spin 0.9s linear infinite;
}

.mpo-viewer-canvas {
  padding: 24px;
  min-width: 100%;
  min-height: 100%;
  position: relative;
}

@keyframes mpo-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.mpo-diagram-shell .mxgraph,
.mpo-viewer-shell .mxgraph {
  transform-origin: 0 0;
}

.mpo-viewer-shell .mxgraph,
.mpo-viewer-shell .mxgraph foreignObject,
.mpo-viewer-shell .mxgraph foreignObject * {
  /* -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%; */
}

.mpo-viewer-shell .mxgraph foreignObject div {
  line-height: 1.15 !important;
}

svg [data-mpo-highlight-target] {
  cursor: pointer;
}

.mpo-viewer-shell.is-interacting svg [data-mpo-highlight-target] {
  cursor: default;
  pointer-events: none !important;
}

.mpo-viewer-shell.is-interacting svg [data-mpo-highlight-target] .mpo-highlight-fill,
.mpo-viewer-shell.is-interacting svg [data-mpo-highlight-target] .mpo-highlight-frame,
.mpo-viewer-shell.is-interacting svg [data-mpo-highlight-target] .mpo-highlight-glow {
  pointer-events: none !important;
  transition: none !important;
}

svg [data-mpo-highlight-target] .mpo-highlight-glow,
svg [data-mpo-highlight-target] .mpo-highlight-fill,
svg [data-mpo-highlight-target] .mpo-highlight-frame {
  transition: opacity 0.18s ease, stroke-width 0.18s ease;
}

svg [data-mpo-highlight-target] .mpo-highlight-glow {
  opacity: var(--mpo-highlight-glow-opacity, 0.18);
}

svg [data-mpo-highlight-target] .mpo-highlight-fill {
  opacity: var(--mpo-highlight-fill-opacity, 0.12);
}

svg [data-mpo-highlight-target] .mpo-highlight-frame {
  opacity: var(--mpo-highlight-frame-opacity, 0.58);
  stroke-width: calc(var(--mpo-highlight-frame-width, 1px) * var(--mpo-viewport-transform-inverse-scale, 1));
}

svg [data-mpo-highlight-target].is-hovered .mpo-highlight-glow,
svg [data-mpo-highlight-target].is-focus-flash .mpo-highlight-glow {
  opacity: calc(var(--mpo-highlight-glow-opacity, 0.18) + 0.1);
}

svg [data-mpo-highlight-target].is-hovered .mpo-highlight-fill,
svg [data-mpo-highlight-target].is-focus-flash .mpo-highlight-fill {
  opacity: calc(var(--mpo-highlight-fill-opacity, 0.12) + 0.1);
}

svg [data-mpo-highlight-target].is-hovered .mpo-highlight-frame,
svg [data-mpo-highlight-target].is-focus-flash .mpo-highlight-frame {
  opacity: 0.86;
  stroke-width: calc(var(--mpo-highlight-frame-width, 1px) * var(--mpo-viewport-transform-inverse-scale, 1) + 0.35px);
}

@media (hover: none) and (pointer: coarse) {
  svg [data-mpo-highlight-target] .mpo-highlight-glow {
    display: none;
  }

  svg [data-mpo-highlight-target] .mpo-highlight-fill {
    opacity: calc(var(--mpo-highlight-fill-opacity, 0.12) + 0.04);
  }

  svg [data-mpo-highlight-target] .mpo-highlight-frame {
    opacity: 0.76;
  }

  svg [data-mpo-highlight-target].is-hovered .mpo-highlight-fill,
  svg [data-mpo-highlight-target].is-focus-flash .mpo-highlight-fill {
    opacity: calc(var(--mpo-highlight-fill-opacity, 0.12) + 0.08);
  }

  svg [data-mpo-highlight-target].is-hovered .mpo-highlight-frame,
  svg [data-mpo-highlight-target].is-focus-flash .mpo-highlight-frame {
    opacity: 0.88;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mpo-app[data-mpo-next-action="add-files"] .mpo-file-button,
  .mpo-app[data-mpo-next-action="open-viewer"] [data-mpo-open-viewer]:not(:disabled),
  .mpo-app[data-mpo-next-action="loading"] [data-mpo-prewarm-status] {
    animation: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  }

  .mpo-viewer-notice.is-visible {
    animation: mpo-viewer-notice-fade 5.2s ease both;
  }
}

@-moz-document url-prefix() {
  .mpo-app[data-mpo-next-action="add-files"] .mpo-file-button,
  .mpo-app[data-mpo-next-action="open-viewer"] [data-mpo-open-viewer]:not(:disabled),
  .mpo-app[data-mpo-next-action="loading"] [data-mpo-prewarm-status] {
    animation: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), 0 10px 24px rgba(37, 99, 235, 0.12);
  }
}

.mpo-modal[hidden] {
  display: none;
}

.mpo-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
  overflow: auto;
}

.mpo-modal-card {
  width: min(460px, 100%);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 32px 64px rgba(15, 23, 42, 0.2);
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.mpo-modal-card label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.mpo-modal-card input[type="date"] {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--mpo-line);
  padding: 0 12px;
  margin-bottom: 12px;
}

.mpo-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.mpo-source-choice-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.mpo-warning-modal-card {
  width: min(560px, 100%);
}

.mpo-interpretation-modal-card {
  width: min(920px, 100%);
  max-height: min(calc(100vh - 48px), 980px);
  padding: 0;
  overflow: hidden;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 26px;
  background:
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.12), transparent 30%),
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 36%),
    var(--mpo-panel);
}

.mpo-interpretation-modal-header {
  display: grid;
  gap: 10px;
  padding: 26px 72px 18px 26px;
  border-bottom: 1px solid color-mix(in srgb, var(--mpo-line) 88%, white);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0)),
    transparent;
}

.mpo-interpretation-modal-header h3 {
  margin-bottom: 0;
}

.mpo-interpretation-modal-scroll {
  min-height: 0;
  overflow: auto;
  padding: 0 26px 26px;
  scrollbar-gutter: stable both-edges;
}

.mpo-interpretation-modal-scroll::before {
  content: "";
  position: sticky;
  top: 0;
  display: block;
  height: 18px;
  margin: 0 -26px 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--mpo-panel) 96%, white), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: 1;
}

.mpo-interpretation-scroll-hint {
  position: sticky;
  top: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--mpo-line) 85%, white);
  background: color-mix(in srgb, var(--mpo-panel) 88%, white);
  color: var(--mpo-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.mpo-interpretation-scroll-hint::after {
  content: "\2193";
  font-size: 13px;
}

.mpo-modal-icon-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mpo-panel) 92%, white);
  border: 1px solid color-mix(in srgb, var(--mpo-line) 88%, white);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.12);
  font-size: 24px;
  line-height: 1;
}

.mpo-modal-icon-close:hover,
.mpo-modal-icon-close:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.16);
}

.mpo-warning-list {
  margin: 16px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.mpo-warning-list li {
  color: var(--mpo-text);
  line-height: 1.5;
}

.mpo-source-choice-button {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.mpo-source-choice-copy {
  display: grid;
  gap: 4px;
}

.mpo-source-choice-copy strong {
  font-size: 14px;
}

.mpo-source-choice-meta {
  color: var(--mpo-muted);
  font-size: 12px;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app {
  --mpo-bg: #020617;
  --mpo-panel: rgba(15, 23, 42, 0.9);
  --mpo-ink: #e2e8f0;
  --mpo-muted: #94a3b8;
  --mpo-line: #334155;
  --mpo-accent: #60a5fa;
  --mpo-accent-soft: rgba(96, 165, 250, 0.18);
  --mpo-shadow: 0 32px 84px rgba(2, 6, 23, 0.56);
  color-scheme: dark;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(2, 6, 23, 0.98) 100%);
  border-color: rgba(51, 65, 85, 0.9);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-toolbar {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.14), transparent 40%),
    rgba(15, 23, 42, 0.96);
  border-bottom-color: rgba(51, 65, 85, 0.9);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-toolbar h2 {
  color: #f8fafc;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-launcher-helper {
  color: #bfdbfe;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-banner {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(59, 130, 246, 0.24);
  color: #bfdbfe;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-file-button,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-secondary-button {
  background: rgba(15, 23, 42, 0.88);
  color: var(--mpo-ink);
  border-color: var(--mpo-line);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-toolbar-status {
  background: rgba(15, 23, 42, 0.88);
  border-color: var(--mpo-line);
  color: #cbd5e1;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-toolbar-status[data-state="loading"] {
  background: rgba(30, 64, 175, 0.26);
  border-color: rgba(96, 165, 250, 0.38);
  color: #bfdbfe;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-toolbar-status[data-state="ready"] {
  background: rgba(20, 83, 45, 0.28);
  border-color: rgba(74, 222, 128, 0.34);
  color: #bbf7d0;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-toolbar-status[data-state="error"],
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-toolbar-status[data-state="unavailable"] {
  background: rgba(127, 29, 29, 0.26);
  border-color: rgba(252, 165, 165, 0.3);
  color: #fecaca;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-select-control {
  background: rgba(15, 23, 42, 0.92);
  color: var(--mpo-ink);
  border-color: rgba(71, 85, 105, 0.78);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-primary-button {
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-chip {
  background: rgba(37, 99, 235, 0.18);
  color: #dbeafe;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-chip-remove {
  background: rgba(37, 99, 235, 0.26);
  color: #dbeafe;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-chip-remove:hover,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-chip-remove:focus-visible {
  background: rgba(37, 99, 235, 0.36);
  color: #eff6ff;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-chip-muted {
  background: rgba(30, 41, 59, 0.9);
  color: #cbd5e1;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-chip-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-panel,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-file-strip,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-stage,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-modal-card {
  background: rgba(15, 23, 42, 0.9);
  border-color: var(--mpo-line);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-session-card,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-priority-item,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-match-card,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-observation-row {
  background: rgba(15, 23, 42, 0.88);
  border-color: var(--mpo-line);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-priority-rank {
  background: rgba(37, 99, 235, 0.18);
  color: #dbeafe;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-heat-legend {
  border-color: rgba(51, 65, 85, 0.95);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.84)),
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.1), transparent 45%);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-heat-legend-copy strong {
  color: #e2e8f0;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-stat-pill {
  background: rgba(30, 41, 59, 0.92);
  color: #cbd5e1;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-match-card {
  background: rgba(15, 23, 42, 0.88);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-match-card:hover,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-match-card:focus-visible {
  border-color: rgba(96, 165, 250, 0.44);
  box-shadow:
    inset 3px 0 0 var(--mpo-match-accent, transparent),
    0 10px 24px rgba(2, 6, 23, 0.4);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-match-card.is-active {
  border-color: color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 40%, var(--mpo-line));
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 44%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.84));
  box-shadow:
    inset 3px 0 0 var(--mpo-match-accent, transparent),
    0 16px 36px rgba(2, 6, 23, 0.36);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-see-also {
  border-color: rgba(255, 79, 163, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 79, 163, 0.16), rgba(255, 79, 163, 0.08)),
    rgba(15, 23, 42, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 30px rgba(255, 79, 163, 0.16);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-see-also-title {
  color: #f9a8d4;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-see-also-copy {
  color: #fbcfe8;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-see-also-chip {
  border-color: rgba(255, 79, 163, 0.42);
  background: rgba(80, 7, 36, 0.38);
  color: #fdf2f8;
  box-shadow: 0 10px 22px rgba(255, 79, 163, 0.12);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-see-also-chip:hover,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-see-also-chip:focus-visible {
  background: rgba(131, 24, 67, 0.45);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-overlay-badge {
  border-color: color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 34%, var(--mpo-panel));
  background: color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 18%, var(--mpo-panel));
  color: var(--mpo-ink);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-overlay-dot {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 18%, var(--mpo-panel));
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-observation-row.is-winner {
  border-color: color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 40%, var(--mpo-line));
  background: color-mix(in srgb, var(--mpo-match-accent, #94a3b8) 10%, var(--mpo-panel));
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-zoom-readout {
  background: rgba(15, 23, 42, 0.9);
  border-color: var(--mpo-line);
  color: var(--mpo-ink);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-diagram-shell {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(2, 6, 23, 0.92) 100%);
  border-color: rgba(71, 85, 105, 0.7);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 28%),
    rgba(2, 6, 23, 0.94);
  border-color: rgba(51, 65, 85, 0.65);
  box-shadow: 0 32px 120px rgba(2, 6, 23, 0.62);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-notice {
  border-color: rgba(251, 146, 60, 0.44);
  background: color-mix(in srgb, rgba(120, 53, 15, 0.94) 84%, rgba(15, 23, 42, 0.94));
  box-shadow: 0 16px 38px rgba(2, 6, 23, 0.48);
  color: #ffedd5;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-shell {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.98));
  border-color: rgba(51, 65, 85, 0.72);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-sidebar {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 40%),
    rgba(15, 23, 42, 0.96);
  border-color: rgba(51, 65, 85, 0.72);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.42);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-shell .mxgraph {
  color-scheme: dark !important;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-shell .mxgraph [style*="color: light-dark(#0000FF, #cdcdff)"] {
  color: #2af !important;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-shell .mxgraph [style*="color: light-dark(#99CCFF, #1e4a76)"] {
  color: rgb(66, 146, 227) !important;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-shell .mxgraph [style*="color: light-dark(rgb(204, 204, 0), rgb(87, 87, 0))"] {
  color: rgb(177, 177, 10) !important;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-loading {
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.72), rgba(15, 23, 42, 0.9));
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-loading-card {
  border-color: rgba(51, 65, 85, 0.9);
  background:
    radial-gradient(circle at top, rgba(96, 165, 250, 0.16), transparent 52%),
    rgba(15, 23, 42, 0.94);
  box-shadow: 0 22px 56px rgba(2, 6, 23, 0.38);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-loading-spinner {
  border-color: rgba(148, 163, 184, 0.24);
  border-top-color: #60a5fa;
  border-right-color: #38bdf8;
  box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.12);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-modal {
  background: rgba(2, 6, 23, 0.7);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-modal-card input[type="date"] {
  background: rgba(15, 23, 42, 0.9);
  color: var(--mpo-ink);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-interpretation-preview {
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.12);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-interpretation-modal-card {
  background:
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.16), transparent 28%),
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 36%),
    rgba(15, 23, 42, 0.96);
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-interpretation-modal-header {
  border-bottom-color: rgba(51, 65, 85, 0.92);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    transparent;
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-interpretation-modal-scroll::before {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0));
}

html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-interpretation-scroll-hint,
html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-modal-icon-close {
  background: color-mix(in srgb, var(--mpo-panel) 92%, rgba(15, 23, 42, 0.96));
  border-color: rgba(51, 65, 85, 0.94);
  box-shadow: 0 16px 28px rgba(2, 6, 23, 0.28);
}

@media (max-width: 1100px) {
  .mpo-layout {
    grid-template-columns: 1fr;
  }

  .mpo-layout-launcher .mpo-sidebar {
    grid-template-columns: 1fr;
  }

  .mpo-layout-launcher .mpo-panel-priority {
    grid-column: auto;
    grid-row: auto;
  }

  .mpo-toolbar,
  .mpo-file-strip,
  .mpo-stage-header {
    flex-direction: column;
  }

  .mpo-toolbar-actions {
    align-items: stretch;
  }

  .mpo-toolbar-file-actions,
  .mpo-toolbar-viewer-actions {
    justify-content: flex-start;
  }

  .mpo-file-list {
    justify-content: flex-start;
  }

  .mpo-viewer-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
  }

  .mpo-zoom-controls {
    justify-items: start;
  }

  .mpo-viewer-actions .mpo-zoom-controls {
    display: none;
  }

  .mpo-viewer-actions .mpo-export-button {
    min-height: 40px;
    padding: 0 12px;
  }

  .mpo-close-button {
    min-width: 40px;
    width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 999px;
  }

  .mpo-close-label {
    display: none;
  }

  .mpo-close-icon {
    display: inline-block;
  }

  .mpo-zoom-hint,
  .mpo-viewer-nav-hint {
    max-width: none;
    text-align: left;
    white-space: normal;
  }

  .mpo-viewer {
    inset: 0;
    border-radius: 0;
    padding: 12px;
  }

  .mpo-viewer-chrome {
    gap: 10px;
    display: contents;
  }

  .mpo-viewer-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "stage";
    position: relative;
  }

  .mpo-viewer-sidebar {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--mpo-viewer-stage-top, 0px);
    bottom: 0;
    width: auto;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    border-radius: 0;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background:
      radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 40%),
      rgba(248, 250, 252, 0.96);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  }

  .mpo-viewer-sidebar .mpo-panel-matched {
    order: -1;
  }

  .mpo-viewer.mpo-viewer-details-open .mpo-viewer-sidebar {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateY(0);
  }

  .mpo-viewer.mpo-viewer-match-focus .mpo-match-summary {
    display: none;
  }

  .mpo-viewer.mpo-viewer-match-focus .mpo-panel-matched .mpo-match-list {
    margin-top: 0;
  }

  .mpo-viewer-mobile-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    grid-area: controls;
    min-width: 0;
    width: 100%;
  }

  .mpo-zoom-controls-mobile {
    justify-items: start;
  }

  .mpo-details-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    min-width: 68px;
    padding: 0 12px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .mpo-viewer-stage,
  .mpo-viewer-shell {
    min-height: 0;
    height: 100%;
  }

  .mpo-viewer-copy h3 {
    font-size: 20px;
  }

  .mpo-viewer-canvas {
    min-width: 100%;
    padding: 18px;
  }
}

@media (max-width: 1100px) {
  .mpo-viewer.mpo-viewer-compact-landscape-rail {
  display: grid;
  grid-template-columns: clamp(176px, 22vw, 224px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "chrome layout";
  align-items: stretch;
  gap: 8px;
  padding: 10px;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-chrome {
  display: flex;
  flex-direction: column;
  grid-area: chrome;
  align-self: stretch;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-topbar {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "eyebrow actions"
    "title title"
    "meta meta";
  row-gap: 4px;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-copy {
  display: contents;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-title-row {
  display: contents;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-actions {
  grid-area: actions;
  justify-content: flex-end;
  align-items: flex-start;
  justify-self: end;
  gap: 6px;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-title-row .mpo-eyebrow {
  grid-area: eyebrow;
  font-size: 9px;
  letter-spacing: 0.16em;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-copy h3 {
  grid-area: title;
  font-size: 14px !important;
  line-height: 1.08;
  overflow-wrap: anywhere;
  word-break: break-word;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-meta {
  grid-area: meta;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-copy [data-mpo-viewer-status] {
  font-size: 9px !important;
  line-height: 1.18;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-notice {
  padding: 5px 8px;
  border-radius: 10px;
  font-size: 9px !important;
  line-height: 1.2;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-close-button {
  min-width: 36px;
  width: 36px;
  min-height: 36px;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-topbar .mpo-viewer-nav-hint {
  display: none;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-layout {
  grid-area: layout;
  align-self: stretch;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-shell {
  border-radius: 20px;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-canvas {
  padding: 10px;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-mobile-controls {
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  width: max-content;
  max-width: 100%;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-zoom-controls-mobile {
  width: auto;
  max-width: 100%;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-viewer-mobile-controls .mpo-zoom-button-row {
  display: flex;
  justify-content: flex-start;
  width: auto;
  max-width: 100%;
}

  .mpo-viewer.mpo-viewer-compact-landscape-rail .mpo-details-toggle {
  width: 100%;
  min-width: 0;
}
}

@media (max-width: 640px) {
  .mpo-toolbar-file-actions,
  .mpo-toolbar-viewer-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .mpo-app.mpo-export-desktop-only .mpo-toolbar-viewer-actions {
    width: 100%;
  }

  .mpo-toolbar-status {
    grid-column: auto;
  }

  .mpo-file-list {
    width: 100%;
    min-width: 0;
  }

  .mpo-file-list .mpo-chip {
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
  }

  .mpo-file-list .mpo-chip-text {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }

  .mpo-viewer {
    gap: 10px;
    padding: 10px;
  }

  .mpo-viewer-topbar {
    row-gap: 4px;
  }

  .mpo-viewer-title-row {
    gap: 8px;
    flex-wrap: wrap;
  }

  .mpo-viewer-copy h3 {
    font-size: 14px !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .mpo-viewer-copy [data-mpo-viewer-status],
  .mpo-viewer-topbar .mpo-viewer-nav-hint {
    font-size: 11px !important;
  }

  .mpo-viewer-notice {
    padding: 6px 9px;
    border-radius: 12px;
    font-size: 11px !important;
  }

  .mpo-viewer-layout {
    gap: 10px;
  }

  .mpo-viewer-mobile-controls .mpo-zoom-button-row {
    gap: 4px;
  }

  .mpo-details-toggle {
    min-width: 60px;
    padding: 0 10px;
  }

  html:is([data-theme="dark"], [data-mpo-system-theme="dark"]) .mpo-app .mpo-viewer-sidebar {
    background:
      radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 40%),
      rgba(15, 23, 42, 0.96);
  }

  .mpo-close-button {
    min-width: 36px;
    width: 36px;
    min-height: 36px;
  }

  .mpo-viewer-canvas {
    padding: 14px;
  }
}
