/*
 * EwoooC V3 Page Guard
 * Loaded after page-level CSS to keep migrated Flask/Jinja pages aligned with
 * the production design spec while old page files are cleaned incrementally.
 */

.momo-app:not(.momo-observability-mode) {
  --momo-page-title-size: 1.8rem;
  --momo-page-section-title-size: 1.4rem;
  --momo-page-card-title-size: 1rem;
  --momo-page-kpi-size: 1.85rem;
}

.momo-app:not(.momo-observability-mode) :is(
  .home-hero__title,
  .ai-recommend-title,
  .ar-hero__title h1,
  .monthly-analysis-title,
  .ms-page-head__title,
  .edm-head__title,
  .edm-page .page-head h2,
  .edm-page .campaign-title,
  .sa-page-head__title,
  .daily-hero__title,
  .ga-page-head__h1,
  .vendor-title,
  .page-logs .page-header h4
) {
  color: var(--momo-text-primary) !important;
  font-family: var(--momo-font-display) !important;
  font-size: var(--momo-page-title-size) !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  text-wrap: pretty;
}

.momo-app:not(.momo-observability-mode) :is(
  .fn-card__title,
  .edm-slotpanel__title,
  .ms-chart-card__title,
  .ms-special__title,
  .ms-data-table__title,
  .dashboard-section-label .title,
  .dashboard-table-title,
  .dashboard-focus-title,
  .sa-filter-head__title,
  .sa-filter-group__title,
  .sa-empty__title,
  .sa-panel__title,
  .ga-empty-state h2,
  .ga-chart-card__title,
  .ai-card__title,
  .ai-notice__title,
  .home-manual__title,
  .home-manual__subhead,
  .crawler-title,
  .page-logs .control-section-title,
  .card-title
) {
  color: var(--momo-text-primary) !important;
  font-family: var(--momo-font-display) !important;
  font-size: var(--momo-page-card-title-size) !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  letter-spacing: 0 !important;
}

.momo-app:not(.momo-observability-mode) :is(
  .stat-card h2,
  .stat-number,
  .dashboard-kpi-value,
  .dashboard-focus-number,
  .dashboard-ai-summary-value,
  .kpi-item-value,
  .kpi-value,
  .kpi-card__value,
  .sa-yoy-card__value,
  .sa-insights__value,
  .ga-kpi__value,
  .monthly-analysis-page .kpi-value,
  .vendor-pulse-value,
  .vendor-metric-value,
  .page-logs .stat-value,
  .daily-mobile-day__value
) {
  font-family: var(--momo-font-mono) !important;
  font-size: var(--momo-page-kpi-size) !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  letter-spacing: 0 !important;
  font-variant-numeric: tabular-nums;
}

.momo-app:not(.momo-observability-mode) :is(
  .home-hero,
  .fn-card,
  .dashboard-kpi-grid,
  .dashboard-focus-card,
  .dashboard-filter-card,
  .dashboard-table-card,
  .ai-recommend-hero,
  .ar-hero,
  .monthly-analysis-hero,
  .ms-page-head,
  .edm-head,
  .edm-promonav,
  .edm-statusbar,
  .edm-slotpanel,
  .edm-page .table-container,
  .edm-page .campaign-hero,
  .edm-page .campaign-kpi-panel,
  .edm-page .campaign-hero-content,
  .sa-page-head,
  .sa-filter-card,
  .sa-panel,
  .sa-kpi,
  .daily-hero,
  .daily-kpi-grid,
  .kpi-card,
  .daily-calendar,
  .ga-page-head,
  .ga-kpi,
  .ga-chart-card,
  .vendor-hero-panel,
  .vendor-card,
  .vendor-table-card,
  .vendor-pulse,
  .crawler-card,
  .home-manual,
  .page-logs .page-header,
  .page-logs .stat-card,
  .page-logs .control-panel,
  .page-logs .log-container-wrapper,
  .momo-app .card
) {
  border-radius: 8px !important;
}

.momo-app:not(.momo-observability-mode) :is(
  .home-hero,
  .ai-recommend-hero,
  .ar-hero,
  .monthly-analysis-hero,
  .ms-page-head,
  .edm-head,
  .edm-page .campaign-hero,
  .edm-page .campaign-hero-content,
  .sa-page-head,
  .daily-hero,
  .ga-page-head,
  .vendor-hero-panel
) {
  background-color: var(--momo-bg-surface) !important;
  background-image: none !important;
  border: 1px solid var(--momo-border-strong) !important;
  box-shadow: var(--momo-shadow-soft) !important;
}

.momo-app:not(.momo-observability-mode) :is(
  .monthly-analysis-page .filter-section,
  .sa-filter-card,
  .ms-filter-card,
  .filter-section
) {
  background-color: var(--momo-bg-paper) !important;
  background-image: none !important;
  color: var(--momo-text-primary) !important;
}

.momo-app:not(.momo-observability-mode) :is(
  .monthly-analysis-page .form-label,
  .filter-section .form-label,
  .sa-filter-group__title,
  .kpi-item-label,
  .kpi-card__label,
  .ga-kpi__label,
  .stat-label,
  .vendor-eyebrow
) {
  color: var(--momo-text-secondary) !important;
  font-family: var(--momo-font-display) !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
}

.momo-app:not(.momo-observability-mode) :is(
  .btn,
  .form-control,
  .form-select,
  .input-group-text,
  .dashboard-search,
  .dashboard-select,
  .dashboard-segmented,
  .dashboard-action-link,
  .dashboard-action-button
) {
  border-radius: 8px !important;
  font-family: var(--momo-font-family) !important;
  letter-spacing: 0 !important;
}

.momo-app:not(.momo-observability-mode) .page-logs :is(
  .btn-control,
  .btn-filter,
  .btn-font-size,
  .search-box input
) {
  border-radius: 8px !important;
  font-family: var(--momo-font-family) !important;
  letter-spacing: 0 !important;
}

.momo-app:not(.momo-observability-mode) :is(.btn-primary, .vendor-action.is-primary, .fn-card__cta) {
  background-color: var(--momo-page-accent) !important;
  background-image: none !important;
  border-color: var(--momo-page-accent-dark) !important;
  color: var(--momo-page-inverse) !important;
}

.momo-app:not(.momo-observability-mode) :is(.table thead th, table thead th) {
  background-color: var(--momo-bg-paper) !important;
  color: var(--momo-text-secondary) !important;
  font-family: var(--momo-font-mono) !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
}

.momo-app:not(.momo-observability-mode) :is(.table-responsive, .table-container) {
  max-width: 100%;
  overflow-x: auto;
}

.momo-app:not(.momo-observability-mode) :is(.home-hero__decor, .stat-icon, .kpi-card__icon-bg) {
  opacity: 0.22;
}

.momo-app:not(.momo-observability-mode) .daily-sales-page .kpi-card__body {
  padding: 0.82rem 0.9rem !important;
}

.momo-app:not(.momo-observability-mode) .daily-sales-page .kpi-card__value {
  font-size: clamp(1.35rem, 1.7vw, 1.55rem) !important;
  white-space: nowrap;
}

.momo-app:not(.momo-observability-mode) .dashboard-table,
.momo-app:not(.momo-observability-mode) .edm-page .campaign-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed;
}

.momo-app:not(.momo-observability-mode) .dashboard-table th,
.momo-app:not(.momo-observability-mode) .dashboard-table td,
.momo-app:not(.momo-observability-mode) .edm-page .campaign-table th,
.momo-app:not(.momo-observability-mode) .edm-page .campaign-table td {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.momo-app:not(.momo-observability-mode) .dashboard-table-wrap,
.momo-app:not(.momo-observability-mode) .edm-page .campaign-table-wrap {
  overflow-x: visible !important;
}

.momo-app:not(.momo-observability-mode) .dashboard-table th:nth-child(1),
.momo-app:not(.momo-observability-mode) .dashboard-table td:nth-child(1) {
  width: 7rem;
}

.momo-app:not(.momo-observability-mode) .dashboard-table th:nth-child(2),
.momo-app:not(.momo-observability-mode) .dashboard-table td:nth-child(2) {
  width: 24%;
}

.momo-app:not(.momo-observability-mode) .edm-page .campaign-table th:nth-child(1),
.momo-app:not(.momo-observability-mode) .edm-page .campaign-table td:nth-child(1) {
  width: 7rem;
}

.momo-app:not(.momo-observability-mode) .edm-page .campaign-table th:nth-child(2),
.momo-app:not(.momo-observability-mode) .edm-page .campaign-table td:nth-child(2) {
  width: 36%;
}

@media (max-width: 768px) {
  .momo-app:not(.momo-observability-mode) {
    --momo-page-title-size: 1.55rem;
    --momo-page-section-title-size: 1.18rem;
    --momo-page-card-title-size: 0.98rem;
    --momo-page-kpi-size: 1.35rem;
  }

  .momo-app:not(.momo-observability-mode) :is(
    .home-hero,
    .ai-recommend-hero,
    .ar-hero,
    .monthly-analysis-hero,
    .ms-page-head,
    .edm-head,
    .edm-page .campaign-hero,
    .sa-page-head,
    .daily-hero,
    .ga-page-head,
    .vendor-hero-panel
  ) {
    padding: 0.9rem !important;
  }

  .momo-app:not(.momo-observability-mode) :is(
    .monthly-analysis-hero,
    .ms-page-head,
    .vendor-hero,
    .edm-page .campaign-hero-grid,
    .edm-page .campaign-hero,
    .sa-page-head,
    .ga-page-head
  ) {
    grid-template-columns: 1fr !important;
  }

  .momo-app:not(.momo-observability-mode) :is(
    .home-hero__title,
    .ai-recommend-title,
    .ar-hero__title h1,
    .monthly-analysis-title,
    .ms-page-head__title,
    .edm-head__title,
    .sa-page-head__title,
    .daily-hero__title,
    .ga-page-head__h1,
    .vendor-title,
    .page-logs .page-header h4
  ) {
    align-items: flex-start;
    overflow-wrap: anywhere;
  }

  .momo-app:not(.momo-observability-mode) .daily-sales-page .kpi-card__value {
    font-size: 1.32rem !important;
  }

  .momo-app:not(.momo-observability-mode) .edm-page :is(
    .campaign-switcher,
    .campaign-slot-tabs,
    .campaign-filterbar
  ) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    overflow: visible !important;
  }

  .momo-app:not(.momo-observability-mode) .edm-page :is(
    .campaign-tab,
    .campaign-slot-tab,
    .campaign-filter-chip
  ) {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: nowrap;
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table-wrap::before,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table-wrap::before {
    display: none !important;
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table,
  .momo-app:not(.momo-observability-mode) .dashboard-table tbody,
  .momo-app:not(.momo-observability-mode) .dashboard-table tr,
  .momo-app:not(.momo-observability-mode) .dashboard-table td,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table tbody,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table tr,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td {
    display: block;
    width: 100% !important;
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table thead,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table thead {
    display: none !important;
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table tr,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table tr {
    margin: 0;
    padding: 0.85rem;
    background: var(--momo-bg-surface);
    border-top: 1px solid var(--momo-border-light);
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table tr:first-child,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table tr:first-child {
    border-top: 0;
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table td,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td {
    display: grid;
    grid-template-columns: 6.8rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
    padding: 0.45rem 0 !important;
    border: 0 !important;
    text-align: left !important;
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table td::before,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td::before {
    color: var(--momo-text-tertiary);
    font-family: var(--momo-font-mono);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table td[colspan],
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td[colspan] {
    grid-template-columns: 1fr;
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table td[colspan]::before,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td[colspan]::before {
    content: none;
    display: none;
  }

  .momo-app:not(.momo-observability-mode) .dashboard-table td:nth-child(1)::before { content: "分類"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table td:nth-child(2)::before { content: "商品"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table td:nth-child(3)::before { content: "MOMO"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table td:nth-child(4)::before { content: "PChome"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table td:nth-child(5)::before { content: "競價"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table:not(.is-ai-picks):not(.is-review) td:nth-child(6)::before { content: "昨日"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table:not(.is-ai-picks):not(.is-review) td:nth-child(7)::before { content: "週"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table:not(.is-ai-picks):not(.is-review) td:nth-child(8)::before { content: "更新"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table:not(.is-ai-picks):not(.is-review) td:nth-child(9)::before { content: "上架"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-ai-picks td:nth-child(6)::before { content: "AI"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-ai-picks td:nth-child(7)::before { content: "昨日"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-ai-picks td:nth-child(8)::before { content: "週"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-ai-picks td:nth-child(9)::before { content: "更新"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-ai-picks td:nth-child(10)::before { content: "上架"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-review td:nth-child(6)::before { content: "覆核"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-review td:nth-child(7)::before { content: "昨日"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-review td:nth-child(8)::before { content: "週"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-review td:nth-child(9)::before { content: "更新"; }
  .momo-app:not(.momo-observability-mode) .dashboard-table.is-review td:nth-child(10)::before { content: "上架"; }

  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td:nth-child(1)::before { content: "分類"; }
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td:nth-child(2)::before { content: "商品"; }
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td:nth-child(3)::before { content: "價格"; }
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td:nth-child(4)::before { content: "銷售"; }
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table td:nth-child(5)::before { content: "追蹤"; }

  .momo-app:not(.momo-observability-mode) .dashboard-table .dashboard-product-cell,
  .momo-app:not(.momo-observability-mode) .edm-page .campaign-table .campaign-product-cell {
    align-items: flex-start;
  }
}

/* AI observability pages load page-level CSS before this guard. Keep the 10
   cockpit pages on the same V3 tokens even when older inline styles remain. */
body.momo-observability-mode {
  --obs-title-size: var(--momo-text-display, 30px);
  --obs-value-size: var(--momo-text-display, 30px);
  --obs-section-title-size: var(--momo-text-title, 17px);
  --obs-body-size: var(--momo-text-body, 14px);
  --obs-label-size: var(--momo-text-label, 11px);
  --obs-ink: var(--momo-text-primary, #2a2520);
  --obs-muted: var(--momo-text-secondary, #6b6155);
  --obs-accent: var(--momo-page-accent, var(--momo-warm-saffron, #b8792f));
  --obs-line: var(--momo-border, rgba(42, 37, 32, 0.16));
  --obs-card: var(--momo-bg-surface, #faf6ec);
  --obs-dot: radial-gradient(color-mix(in srgb, var(--momo-text-tertiary, #9b9081) 28%, transparent) 0.8px, transparent 0.8px);
}

body.momo-observability-mode .momo-content {
  background-color: var(--momo-bg-body) !important;
  background-image: var(--obs-dot) !important;
  background-size: 16px 16px !important;
  color: var(--obs-ink) !important;
  font-family: var(--momo-font-family) !important;
  overflow-x: hidden;
}

body.momo-observability-mode :is(
  .obs-war-room,
  .obs-warroom,
  .agent-page,
  .biz-warroom,
  .runtime-page,
  .calls-page,
  .gov-page,
  .gate-page,
  .rag-page,
  .quality-page,
  .ppt-page
) {
  color: var(--obs-ink) !important;
  font-family: var(--momo-font-family) !important;
}

body.momo-observability-mode :is(
  .obs-hero,
  .agent-hero,
  .biz-command,
  .runtime-hero,
  .calls-hero,
  .gov-hero,
  .gate-hero,
  .rag-hero,
  .qa-hero,
  .quality-hero,
  .ppt-hero,
  .container-fluid > h2:first-child
) {
  border: 1px solid var(--obs-line) !important;
  border-radius: var(--momo-radius-md, 8px) !important;
  background-color: var(--momo-bg-surface) !important;
  background-image: var(--obs-dot) !important;
  background-size: 16px 16px !important;
  box-shadow: var(--momo-shadow-soft) !important;
  color: var(--obs-ink) !important;
  padding: var(--momo-space-4, 16px) !important;
}

body.momo-observability-mode .biz-warroom::before,
body.momo-observability-mode .biz-command::before,
body.momo-observability-mode .biz-command::after {
  display: none !important;
}

body.momo-observability-mode :is(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .obs-title,
  .agent-title,
  .biz-command h1,
  .runtime-title,
  .calls-title,
  .gov-title,
  .gate-title,
  .rag-title,
  .qa-title,
  .quality-title,
  .ppt-title
) {
  color: var(--obs-ink) !important;
  font-family: var(--momo-font-display) !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  line-height: 1.2 !important;
}

body.momo-observability-mode :is(
  .obs-title,
  .agent-title,
  .biz-command h1,
  .runtime-title,
  .calls-title,
  .gov-title,
  .gate-title,
  .rag-title,
  .qa-title,
  .quality-title,
  .ppt-title,
  .container-fluid > h2:first-child
) {
  font-size: var(--obs-title-size) !important;
  max-width: 820px;
}

body.momo-observability-mode :is(
  .obs-subtitle,
  .agent-subtitle,
  .biz-command p,
  .runtime-subtitle,
  .calls-subtitle,
  .gov-subtitle,
  .gate-subtitle,
  .rag-subtitle,
  .qa-subtitle,
  .quality-subtitle,
  .ppt-subtitle,
  .text-muted
) {
  color: var(--obs-muted) !important;
  font-family: var(--momo-font-family) !important;
  font-size: var(--obs-body-size) !important;
  letter-spacing: 0 !important;
  line-height: 1.7 !important;
}

body.momo-observability-mode :is(
  .obs-kicker,
  .agent-kicker,
  .biz-kicker,
  .runtime-kicker,
  .calls-kicker,
  .gov-kicker,
  .gate-kicker,
  .rag-kicker,
  .qa-kicker,
  .quality-kicker,
  .ppt-kicker,
  .obs-label,
  .agent-label,
  .biz-signal .label,
  .runtime-label,
  .calls-label,
  .gov-label,
  .gate-label,
  .rag-label,
  .qa-label,
  .quality-label,
  .ppt-label,
  [class$="-label"]
) {
  color: var(--obs-accent) !important;
  font-family: var(--momo-font-mono) !important;
  font-size: var(--obs-label-size) !important;
  font-weight: 700 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

body.momo-observability-mode :is(
  .obs-value,
  .obs-signal-value,
  .agent-value,
  .biz-value,
  .biz-signal .value,
  .runtime-value,
  .calls-value,
  .gov-value,
  .gate-value,
  .rag-value,
  .qa-value,
  .quality-value,
  .ppt-value,
  .display-4,
  .display-5,
  .h1,
  [class$="-mini"] strong
) {
  color: var(--obs-ink) !important;
  font-family: var(--momo-font-mono) !important;
  font-size: var(--obs-value-size) !important;
  font-weight: 800 !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0 !important;
  line-height: 1.1 !important;
}

body.momo-observability-mode :is(
  .obs-panel-title,
  .agent-panel-title,
  .biz-panel-head h3,
  .runtime-panel-title,
  .calls-panel-title,
  .gov-panel-title,
  .gate-panel-title,
  .rag-panel-title,
  .qa-panel-title,
  .quality-panel-title,
  .ppt-panel-title,
  [class$="-table-title"] h3,
  .card-title
) {
  font-size: var(--obs-section-title-size) !important;
  letter-spacing: 0 !important;
  line-height: 1.35 !important;
}

body.momo-observability-mode :is(
  .card,
  .obs-signal,
  .agent-signal,
  .biz-signal,
  .runtime-signal,
  .calls-signal,
  .gov-signal,
  .gate-signal,
  .rag-signal,
  .qa-signal,
  .quality-signal,
  .ppt-signal,
  .obs-panel,
  .agent-panel,
  .biz-panel,
  .runtime-panel,
  .calls-panel,
  .gov-panel,
  .gate-panel,
  .rag-panel,
  .qa-panel,
  .quality-panel,
  .ppt-panel,
  .agent-card,
  .caller-card,
  .rec-card,
  .fix-card,
  .root-card,
  .episode-card,
  .biz-decision-card,
  .obs-route-card,
  [class$="-mini"],
  .strategy-card,
  .episode-text,
  .similar-box,
  .host-lane,
  .list-group-item,
  .dropdown-menu,
  .modal-content,
  .alert
) {
  border-color: var(--obs-line) !important;
  border-radius: var(--momo-radius-md, 8px) !important;
  background-color: var(--obs-card) !important;
  background-image: var(--obs-dot) !important;
  background-size: 14px 14px !important;
  box-shadow: var(--momo-shadow-soft) !important;
  color: var(--obs-ink) !important;
}

body.momo-observability-mode :is(
  .obs-table-shell,
  .agent-table-shell,
  .biz-table-shell,
  .runtime-table-shell,
  .calls-table-shell,
  .gov-table-shell,
  .gate-table-shell,
  .rag-table-shell,
  .qa-table-shell,
  .quality-table-shell,
  .ppt-table-shell,
  .table-responsive,
  .obs-chart-frame,
  .chart-frame,
  .chart-container,
  .obs-modal-preview
) {
  max-width: 100%;
  overflow-x: auto;
  border-color: var(--obs-line) !important;
  border-radius: var(--momo-radius-md, 8px) !important;
  background-color: var(--momo-bg-surface) !important;
  background-image: var(--obs-dot) !important;
  background-size: 14px 14px !important;
  box-shadow: var(--momo-shadow-soft) !important;
}

body.momo-observability-mode :is(.btn, .form-control, .form-select, .input-group-text, .badge) {
  border-radius: var(--momo-radius-md, 8px) !important;
  font-family: var(--momo-font-family) !important;
  letter-spacing: 0 !important;
}

body.momo-observability-mode .badge {
  border: 1px solid var(--momo-border-light) !important;
  background: var(--momo-tag-muted-bg) !important;
  color: var(--momo-tag-muted-text) !important;
  font-family: var(--momo-font-mono) !important;
  font-size: var(--momo-text-label) !important;
  font-weight: 700 !important;
}

body.momo-observability-mode :is(.badge.bg-success, .status-good) {
  color: var(--momo-success-text) !important;
}

body.momo-observability-mode .badge.bg-success {
  background: var(--momo-success-bg) !important;
  border-color: var(--momo-success-border) !important;
}

body.momo-observability-mode :is(.badge.bg-warning, .status-warn) {
  color: var(--momo-warning-text) !important;
}

body.momo-observability-mode .badge.bg-warning {
  background: var(--momo-warning-bg) !important;
  border-color: var(--momo-warning-border) !important;
}

body.momo-observability-mode :is(.badge.bg-danger, .status-bad) {
  color: var(--momo-danger-text) !important;
}

body.momo-observability-mode .badge.bg-danger {
  background: var(--momo-danger-bg) !important;
  border-color: var(--momo-danger-border) !important;
}

body.momo-observability-mode :is(.badge.bg-info, .badge.bg-primary, .badge.bg-secondary, .badge.bg-light, .status-blue) {
  color: var(--momo-info-text) !important;
}

body.momo-observability-mode :is(.badge.bg-info, .badge.bg-primary, .badge.bg-secondary, .badge.bg-light) {
  background: var(--momo-info-bg) !important;
  border-color: var(--momo-info-border) !important;
}

body.momo-observability-mode .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--obs-ink);
  color: var(--obs-ink) !important;
  font-size: var(--momo-text-body-sm) !important;
}

body.momo-observability-mode :is(.table thead th, table thead th, .table-light th) {
  background: var(--momo-bg-paper) !important;
  color: var(--momo-text-secondary) !important;
  font-family: var(--momo-font-mono) !important;
  font-size: var(--momo-text-label) !important;
  font-weight: 700 !important;
  letter-spacing: 0 !important;
  white-space: nowrap;
}

body.momo-observability-mode :is(
  .obs-command-strip,
  .agent-command,
  .biz-signal-grid,
  .runtime-command,
  .calls-command,
  .gov-command,
  .gate-command,
  .rag-command,
  .qa-command,
  .quality-command,
  .ppt-command
) {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)) !important;
  gap: var(--momo-space-3, 12px) !important;
}

body.momo-observability-mode :is(
  .obs-grid,
  .agent-grid,
  .biz-hero,
  .biz-layout,
  .runtime-grid,
  .calls-grid,
  .gov-grid,
  .gate-grid,
  .rag-grid,
  .qa-grid,
  .quality-grid,
  .ppt-grid
) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(min(100%, 320px), 0.42fr) !important;
  gap: var(--momo-space-4, 16px) !important;
  max-width: 100%;
}

@media (max-width: 900px) {
  body.momo-observability-mode {
    --obs-title-size: 24px;
    --obs-value-size: 24px;
  }

  body.momo-observability-mode :is(
    .obs-grid,
    .agent-grid,
    .biz-hero,
    .biz-layout,
    .runtime-grid,
    .calls-grid,
    .gov-grid,
    .gate-grid,
    .rag-grid,
    .qa-grid,
    .quality-grid,
    .ppt-grid
  ) {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 560px) {
  body.momo-observability-mode {
    --obs-title-size: 20px;
    --obs-value-size: 20px;
  }

  body.momo-observability-mode :is(.obs-hero, .agent-hero, .biz-command, .runtime-hero, .calls-hero, .gov-hero, .gate-hero, .rag-hero, .qa-hero, .quality-hero, .ppt-hero) {
    padding: 0.72rem !important;
  }

  body.momo-observability-mode :is(
    .obs-command-strip,
    .agent-command,
    .biz-signal-grid,
    .runtime-command,
    .calls-command,
    .gov-command,
    .gate-command,
    .rag-command,
    .qa-command,
    .quality-command,
    .ppt-command
  ) {
    gap: 8px !important;
    grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)) !important;
  }

  body.momo-observability-mode :is(
    .obs-signal,
    .agent-signal,
    .biz-signal,
    .runtime-signal,
    .calls-signal,
    .gov-signal,
    .gate-signal,
    .rag-signal,
    .qa-signal,
    .quality-signal,
    .ppt-signal
  ) {
    min-height: auto !important;
    padding: 0.62rem !important;
  }

  body.momo-observability-mode :is(
    .obs-subtitle,
    .agent-subtitle,
    .biz-command p,
    .runtime-subtitle,
    .calls-subtitle,
    .gov-subtitle,
    .gate-subtitle,
    .rag-subtitle,
    .qa-subtitle,
    .quality-subtitle,
    .ppt-subtitle
  ) {
    line-height: 1.55 !important;
  }

  body.momo-observability-mode :is(.table-responsive, .obs-table-shell, [class$="-table-shell"]) {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}
