:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f4f6f9;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, .button-link {
  border: 0;
  border-radius: 9px;
  background: #1d4ed8;
  color: white;
  padding: 0.72rem 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:hover, .button-link:hover { filter: brightness(0.94); }
button:disabled { cursor: not-allowed; opacity: 0.45; }
button.danger { background: #b42318; }
.topbar {
  background: #0e172a;
  color: white;
  padding: 1.5rem clamp(1rem, 5vw, 4rem);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
h1 { margin: 0.15rem 0 0; font-size: clamp(1.8rem, 4vw, 3rem); }
h2 { margin: 0; font-size: 1.35rem; }
h3 { margin: 0 0 0.75rem; }
.subtitle { margin: 0.35rem 0 0; color: #cbd5e1; }
.eyebrow, .step { margin: 0; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; color: #5470a8; }
.topbar .eyebrow { color: #93c5fd; }
.health { border: 1px solid #334155; border-radius: 999px; padding: 0.55rem 0.8rem; font-size: 0.82rem; white-space: nowrap; }
.health.ok { color: #bbf7d0; border-color: #166534; background: #052e16; }
.module-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.65rem clamp(1rem, 5vw, 4rem);
  background: white;
  border-bottom: 1px solid #dde3ec;
}
.module-nav a { color: #334155; text-decoration: none; padding: 0.5rem 0.65rem; white-space: nowrap; font-weight: 650; font-size: 0.88rem; }
main { max-width: 1500px; margin: 0 auto; padding: 1.25rem clamp(0.75rem, 3vw, 2rem) 4rem; }
.panel, .notice { background: white; border: 1px solid #dde3ec; border-radius: 14px; margin-bottom: 1rem; padding: clamp(1rem, 2vw, 1.4rem); box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035); }
.notice.authentic { border-left: 5px solid #0f766e; background: #f0fdfa; }
.panel.compact { padding: 1rem 1.25rem; }
.section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.status-chip { background: #eef2ff; color: #3730a3; padding: 0.35rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.85rem; align-items: end; }
.form-stack { display: grid; gap: 0.8rem; align-content: start; }
label { display: grid; gap: 0.32rem; font-size: 0.82rem; font-weight: 720; color: #344054; }
input, select, textarea { width: 100%; border: 1px solid #cfd7e5; border-radius: 8px; background: white; color: #111827; padding: 0.68rem 0.72rem; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(29, 78, 216, 0.15); border-color: #2563eb; }
textarea { min-height: 88px; resize: vertical; }
.wide { grid-column: span 2; }
.check { grid-template-columns: auto 1fr; align-items: start; font-weight: 600; }
.check input { width: auto; margin-top: 0.2rem; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.card { border: 1px solid #e0e6ef; border-radius: 12px; padding: 1rem; background: #fbfcfe; }
.field-note { margin: 0.65rem 0 0; color: #667085; font-size: 0.8rem; line-height: 1.45; }
.provider-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.provider { padding: 0.85rem; border: 1px solid #e0e6ef; border-radius: 10px; }
.provider strong { display: block; margin-bottom: 0.3rem; }
.provider p { margin: 0.3rem 0; font-size: 0.78rem; color: #667085; line-height: 1.4; }
.provider .mode { display: inline-block; margin-top: 0.3rem; padding: 0.25rem 0.5rem; border-radius: 999px; background: #f2f4f7; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.provider.operational { border-left: 4px solid #15803d; }
.provider.not_configured, .provider.licensing_review { border-left: 4px solid #d97706; }
.result-box { margin-top: 1rem; border: 1px solid #d9e0ea; padding: 0.8rem; border-radius: 9px; font-size: 0.85rem; }
.empty { color: #667085; background: #f8fafc; }
.inline-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.inline-actions select { min-width: 230px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.7rem; margin-bottom: 1rem; }
.metric { border: 1px solid #e1e7ef; border-radius: 10px; padding: 0.75rem; background: #fbfcfe; }
.metric span { display: block; color: #667085; font-size: 0.72rem; }
.metric strong { display: block; margin-top: 0.15rem; font-size: 1.15rem; }
.table-wrap { overflow-x: auto; border: 1px solid #e1e7ef; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
th { text-align: left; background: #f3f5f8; padding: 0.7rem; color: #475467; white-space: nowrap; }
td { border-top: 1px solid #e7ebf1; padding: 0.7rem; vertical-align: top; }
tbody tr:hover { background: #fafcff; }
.empty-cell { text-align: center; color: #667085; padding: 1.5rem; }
.decision { font-weight: 850; }
.decision.Steal, .decision.Defend { color: #087443; }
.decision.Test { color: #9a6700; }
.decision.Avoid { color: #b42318; }
.decision.Monitor, .decision.Listing-Only { color: #475467; }
.evidence-count { white-space: nowrap; }
.hidden { display: none !important; }
.proof-list { margin-top: 1rem; display: grid; gap: 0.55rem; }
.proof-item { border-left: 4px solid #64748b; padding: 0.65rem 0.8rem; background: #f8fafc; }
.proof-item strong { display: block; }
.proof-item span { color: #667085; font-size: 0.78rem; }
#toast { position: fixed; right: 1rem; bottom: 1rem; max-width: min(420px, calc(100vw - 2rem)); background: #111827; color: white; border-radius: 9px; padding: 0.8rem 1rem; opacity: 0; transform: translateY(10px); transition: 0.18s; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { background: #991b1b; }
@media (max-width: 1050px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.9rem clamp(0.85rem, 4vw, 2rem);
    gap: 0.6rem;
  }
  .topbar h1 { font-size: 1.4rem; }
  .topbar .subtitle { display: none; }
  .two-column, .provider-grid, .form-grid { grid-template-columns: 1fr; }
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }
  .metric { padding: 0.6rem; }
  .metric strong { font-size: 1rem; }
  .panel, .notice {
    padding: 0.85rem;
    margin-bottom: 0.75rem;
    border-radius: 12px;
  }
  .panel.compact { padding: 0.75rem 0.85rem; }
  .wide { grid-column: span 1; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  button, .button-link { width: 100%; min-height: 44px; }
  .inline-actions { width: 100%; }
  .inline-actions select { min-width: 0; }
}

.topbar-actions { display: grid; justify-items: end; gap: 0.6rem; }
.user-session { display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; color: #dbeafe; }
button.secondary { background: #334155; }
button.small { padding: 0.45rem 0.65rem; width: auto; }
.auth-gate { min-height: calc(100vh - 116px); display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: min(430px, 100%); display: grid; gap: 0.9rem; background: white; border: 1px solid #dbe2eb; border-radius: 16px; padding: 1.5rem; box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12); }
.auth-card h2 { margin-top: 0.15rem; }
@media (max-width: 680px) { .topbar-actions { justify-items: start; width: 100%; } .user-session { width: 100%; justify-content: space-between; } button.small { width: auto; } }


/* M1 Profit & PPC hardening — external stylesheet required by strict CSP. */
.module-nav {
  justify-content: space-between;
  align-items: center;
}
.module-links { display: flex; gap: 0.5rem; min-width: max-content; }
.workspace-product-switcher {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 0.55rem;
  min-width: min(390px, 34vw);
  margin-left: auto;
  font-size: 0.75rem;
  white-space: nowrap;
}
.workspace-product-switcher select { min-width: 230px; padding: 0.5rem 0.6rem; }
.input-help { color: #667085; font-size: 0.72rem; font-weight: 500; }
.advanced-profit-fields {
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}
.advanced-profit-fields summary {
  cursor: pointer;
  padding: 0.9rem 1rem;
  font-weight: 800;
  color: #344054;
}
.advanced-profit-fields[open] summary { border-bottom: 1px solid #e2e8f0; }
.advanced-profit-fields .form-grid { padding: 1rem; }
.profit-save-button { width: min(360px, 100%); }

.profit-ppc-results {
  width: 100%;
  box-sizing: border-box;
  margin-top: 1.4rem;
  padding: clamp(1rem, 2.2vw, 1.65rem);
  border: 1px solid #cfd9ea;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}
.profit-ppc-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e1e7ef;
}
.profit-ppc-heading h2 { margin-top: 0.15rem; font-size: 1.55rem; }
.profit-ppc-heading .field-note { margin-top: 0.35rem; }
.profit-ppc-heading .mode {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}
.profit-ppc-heading .mode.live { background: #ecfdf3; color: #027a48; }
.profit-ppc-heading .mode.error { background: #fef3f2; color: #b42318; }
.profit-ppc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}
.profit-ppc-card {
  min-width: 0;
  min-height: 150px;
  padding: 0.95rem;
  border: 1px solid #dfe6f0;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}
.profit-ppc-card.primary { border-color: #9bb7ee; background: #eef4ff; }
.profit-ppc-card.warning { border-color: #e6c66f; background: #fff9e8; }
.profit-ppc-label {
  display: block;
  min-height: 2.25em;
  color: #667085;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.035em;
  line-height: 1.35;
  text-transform: uppercase;
}
.profit-ppc-card strong {
  display: block;
  margin-top: 0.55rem;
  color: #101828;
  font-size: clamp(1.28rem, 2vw, 1.65rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.profit-ppc-card.primary strong { color: #1949b8; }
.profit-ppc-note {
  display: block;
  margin-top: 0.55rem;
  color: #667085;
  font-size: 0.75rem;
  line-height: 1.35;
}
.profit-ppc-source {
  display: block;
  margin-top: auto;
  padding-top: 0.65rem;
  color: #4868a5;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.3;
}
.profit-ppc-breakdown {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #dde5ef;
  border-radius: 10px;
  background: #f4f7fb;
}
.profit-ppc-calculation, .profit-ppc-source-line, .profit-ppc-error { margin: 0; line-height: 1.5; }
.profit-ppc-source-line { margin-top: 0.45rem; color: #667085; font-size: 0.74rem; }
.profit-ppc-error { color: #b42318; font-weight: 750; }
.profit-ppc-empty { grid-column: 1 / -1; }

@media (max-width: 1100px) {
  .profit-ppc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-product-switcher { min-width: 300px; }
}
@media (max-width: 760px) {
  .module-nav {
    align-items: stretch;
    flex-direction: column;
    overflow: visible;
    max-width: 100%;
  }
  .module-links {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .module-nav a {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  .workspace-product-switcher {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    white-space: normal;
    gap: 0.35rem;
  }
  .workspace-product-switcher select { min-width: 0; width: 100%; }
  .profit-ppc-heading { flex-direction: column; }
  .profit-ppc-grid { grid-template-columns: 1fr; }
  .profit-ppc-card { min-height: 0; }
}


/* M1 final Product & Profit Profile implementation */
.profit-layout { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(250px, 0.9fr); gap: 1rem; align-items: start; }
.profit-profile-card, .profit-quick-guide { border: 1px solid #dfe5ee; border-radius: 14px; background: #fbfcfe; padding: 1rem; }
.profit-form-intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.profit-form-intro h3, .profit-quick-guide h3 { margin: 0; }
.source-badge { display: inline-flex; padding: 0.32rem 0.58rem; border-radius: 999px; background: #eef4ff; color: #315da8; font-size: 0.7rem; font-weight: 800; white-space: nowrap; }
.profit-quick-guide { position: sticky; top: 76px; background: linear-gradient(180deg, #f8fbff 0%, #f1f7ff 100%); }
.profit-quick-guide ol { margin: 0.9rem 0 0; padding-left: 1.2rem; color: #475467; line-height: 1.55; }
.profit-quick-guide li + li { margin-top: 0.55rem; }
.input-error { min-height: 1em; color: #b42318; font-size: 0.7rem; font-weight: 650; }
.percentage-input:invalid { border-color: #d92d20; background: #fff7f6; }
.profit-ppc-groups { display: grid; gap: 1rem; }
.profit-ppc-group { border-top: 1px solid #e5eaf2; padding-top: 1rem; }
.profit-ppc-group:first-child { border-top: 0; padding-top: 0; }
.profit-ppc-group h3 { margin: 0 0 0.7rem; color: #344054; font-size: 0.88rem; letter-spacing: 0.02em; }
.profit-ppc-group .profit-ppc-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.profit-ppc-card { min-height: 142px; }
@media (max-width: 980px) {
  .profit-layout { grid-template-columns: 1fr; }
  .profit-quick-guide { position: static; }
}
@media (max-width: 680px) {
  .profit-form-intro { flex-direction: column; }
  .profit-ppc-group .profit-ppc-grid { grid-template-columns: 1fr; }
}

/* M2 evidence import hardening */
.evidence-existing { margin-bottom: 1.4rem; padding: 1.2rem; border: 1px solid #d8e1ed; border-radius: 14px; background: #f8fbff; }
.evidence-subheading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.8rem; }
.evidence-subheading h3 { margin: 0.15rem 0 0.3rem; }
.evidence-import-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.evidence-import-grid .card { height: 100%; }
.two-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.evidence-inventory { display: grid; gap: 0.85rem; margin-top: 1rem; }
.evidence-record { border: 1px solid #dce4ef; border-radius: 12px; background: #fff; padding: 1rem; }
.evidence-record.current-product { border-color: #8fb0ef; box-shadow: 0 0 0 2px rgba(55, 101, 204, 0.08); }
.evidence-record-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem; }
.evidence-record-heading h4 { margin: 0 0 0.25rem; font-size: 1rem; }
.evidence-record-heading p { margin: 0; }
.evidence-record-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; }
.evidence-fact { min-width: 0; padding: 0.7rem; border-radius: 9px; background: #f5f7fb; }
.evidence-fact span { display: block; margin-bottom: 0.25rem; color: #66738a; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.evidence-fact strong, .evidence-fact code { display: block; color: #17243b; font-size: 0.86rem; overflow-wrap: anywhere; }
.evidence-hash { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.evidence-record-note { margin: 0.75rem 0 0; color: #657187; font-size: 0.82rem; line-height: 1.45; }
.import-issues { display: grid; gap: 0.5rem; margin-top: 0.75rem; }
.import-issue { padding: 0.65rem 0.8rem; border-radius: 8px; border: 1px solid #e5d197; background: #fff9e9; color: #755313; font-size: 0.82rem; }
.import-issue.error { border-color: #e5a4aa; background: #fff0f1; color: #8f2530; }
.evidence-empty { padding: 1rem; border: 1px dashed #cbd5e2; border-radius: 10px; color: #657187; background: #fff; }
@media (max-width: 1100px) {
  .evidence-import-grid { grid-template-columns: 1fr 1fr; }
  .evidence-record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .evidence-import-grid, .two-field-row, .evidence-record-grid { grid-template-columns: 1fr; }
  .evidence-record-heading { display: block; }
  .evidence-record-heading .mode { display: inline-block; margin-top: 0.5rem; }
}

/* M4 Monitor and Opportunity Feed */
.notice.monitor-truth {
  margin: 0.8rem 0 1rem;
  border-left-color: #5570b5;
  background: #f5f7ff;
}
.monitor-config-form {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #dce4ef;
  border-radius: 12px;
  background: #fbfcfe;
}
.monitor-subsection { margin-top: 1.3rem; }
.monitor-subsection h3 { margin: 0; }
.compact-heading { margin-bottom: 0.7rem; }
.compact-filter { min-width: 180px; }
.opportunity-feed { display: grid; gap: 0.8rem; }
.opportunity-card {
  border: 1px solid #dce4ef;
  border-left: 5px solid #7a8ba6;
  border-radius: 12px;
  background: #fff;
  padding: 1rem;
}
.opportunity-card.severity-high { border-left-color: #d92d20; background: #fffafa; }
.opportunity-card.severity-medium { border-left-color: #d68a00; background: #fffdf7; }
.opportunity-card.severity-low { border-left-color: #5272b8; }
.opportunity-card.status-dismissed,
.opportunity-card.status-resolved { opacity: 0.72; }
.opportunity-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.opportunity-heading h4 { margin: 0; font-size: 1rem; }
.opportunity-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.status-chip.severity-high { background: #fef3f2; color: #b42318; }
.status-chip.severity-medium { background: #fff4e5; color: #935f00; }
.status-chip.severity-low { background: #eef4ff; color: #315da8; }
.status-chip.severity-info { background: #f2f4f7; color: #475467; }
.opportunity-card p { margin: 0.65rem 0 0; line-height: 1.45; }
.opportunity-meta { color: #667085; font-size: 0.76rem; }
.opportunity-actions { margin-top: 0.75rem; }
@media (max-width: 760px) {
  .opportunity-heading { flex-direction: column; }
  .opportunity-badges { justify-content: flex-start; }
  .compact-filter { width: 100%; }
}

/* M5 Action & Proof Center */
.proof-truth-notice {
  margin-top: 0.9rem;
  border: 1px solid #b9c8e8;
  border-left: 4px solid #5272b8;
  border-radius: 10px;
  background: #f5f8ff;
  padding: 0.85rem 1rem;
  line-height: 1.45;
}
.action-proof-card,
.proof-evaluation-card { border-left-color: #5272b8; border-radius: 8px; }
.proof-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.proof-card-heading strong { margin: 0; }
.proof-action-buttons { margin-top: 0.7rem; flex-wrap: wrap; }
.proof-period-line,
.proof-thresholds,
.proof-verdict {
  margin-top: 0.65rem;
  border-radius: 8px;
  background: #eef3f8;
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.45;
}
.proof-evaluation-message { margin: 0.65rem 0 0; line-height: 1.45; }
.proof-verdict { background: #ecfdf3; color: #166534; font-weight: 700; }
.proof-state-waiting_for_later_report,
.proof-state-waiting_for_baseline_report,
.proof-state-threshold_not_met { background: #fff4e5; color: #935f00; }
.proof-state-ready_to_grade { background: #eef4ff; color: #315da8; }
.proof-state-graded { background: #ecfdf3; color: #166534; }
.proof-state-not_eligible { background: #f2f4f7; color: #475467; }
.proof-state-invalid_event { background: #fef3f2; color: #b42318; }
@media (max-width: 760px) {
  .proof-card-heading { flex-direction: column; }
}

/* M6 PPC Waste & Harvest */
.waste-harvest-truth {
  margin: 0.8rem 0 1rem;
  border-left-color: #8a5d18;
  background: #fffaf0;
}
.waste-harvest-controls {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #e3e7ee;
  border-radius: 12px;
  background: #fbfcfe;
}
.waste-harvest-row.class-confirmed_waste td:first-child { color: #b42318; font-weight: 800; }
.waste-harvest-row.class-harvest_candidate td:first-child { color: #166534; font-weight: 800; }
.waste-harvest-row.class-profitable_exact td:first-child { color: #315da8; font-weight: 800; }
#waste-harvest-summary { margin-bottom: 1rem; }
#waste-harvest-rows td:last-child { min-width: 300px; line-height: 1.4; }
@media (max-width: 760px) {
  #run-waste-harvest { width: 100%; }
}

/* M7 live provider gateway and spend guard */
.provider-runtime { margin-top: 1.1rem; padding: 1rem; border: 1px solid #dbe4f0; border-radius: 14px; background: #f8fbff; }
.section-heading.compact { margin-bottom: 0.65rem; }
.provider-runtime .metric-grid { margin-top: 0.9rem; }
.provider-job { border: 1px solid #dbe3ee; border-radius: 11px; background: #fff; padding: 0.85rem; }
.provider-job header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; }
.provider-job h4 { margin: 0; }
.provider-job p { margin: 0.35rem 0 0; color: #667085; line-height: 1.45; }
.provider-job-progress { margin-top: 0.65rem; font-weight: 750; color: #344054; }
.provider-job.error { border-color: #f1b4b4; background: #fff7f7; }
.provider-job.completed { border-color: #a7dfbd; background: #f5fff8; }

/* M8 beta readiness and recovery gate */
.launch-gate-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.launch-gate { border: 1px solid #dbe3ee; border-left: 4px solid #98a2b3; border-radius: 10px; background: #fff; padding: 0.85rem; }
.launch-gate header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; }
.launch-gate h4 { margin: 0; }
.launch-gate p { margin: 0.55rem 0 0; line-height: 1.45; }
.launch-gate.passed { border-left-color: #16a34a; background: #f6fff8; }
.launch-gate.blocked { border-left-color: #dc2626; background: #fff8f7; }
.launch-gate.pending { border-left-color: #d97706; background: #fffaf0; }
.backup-verify-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 0.85rem 0 0.35rem; }
#password-recovery-form { margin-top: 1rem; }
@media (max-width: 860px) {
  .launch-gate-columns { grid-template-columns: 1fr; }
}

.billing-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 2fr);
  gap: 1rem;
  align-items: end;
  margin: 1rem 0;
}

.billing-controls .inline-actions {
  justify-content: flex-start;
  align-items: center;
}

@media (max-width: 800px) {
  .billing-controls { grid-template-columns: 1fr; }
}

.cancellation-controls {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(260px, 1fr);
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #dde3ec;
  border-radius: 14px;
  background: #f8fafc;
}

.cancellation-controls h3 { margin: 0 0 0.35rem; }
.cancellation-controls .inline-actions { justify-content: flex-end; }

@media (max-width: 800px) {
  .cancellation-controls { grid-template-columns: 1fr; }
  .cancellation-controls .inline-actions { justify-content: flex-start; }
}

.restore-drill-controls { margin-top: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: 14px; display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.restore-drill-controls h3 { margin: 0 0 0.25rem; }
@media (max-width: 760px) { .restore-drill-controls { align-items: stretch; flex-direction: column; } }

/* M22/M18: a cancelled tenant may authenticate only to view billing, its
   completed cancellation proof, the final production-onboarding attestation
   and launch readiness. Normal workspace modules remain inaccessible. */
body.cancellation-proof-only #app-nav,
body.cancellation-proof-only #app-main > :not(#billing):not(#cancellation-verification):not(#production-onboarding-verification):not(#launch-readiness) {
  display: none !important;
}
body.cancellation-proof-only #cancellation-verification {
  border-color: #15803d;
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.08);
}

/* Step 18 corrective: an email-confirmed tenant without an active entitlement
   remains signed in to the limited onboarding and billing lifecycle. Paid
   product modules stay server-blocked and hidden until Stripe webhooks grant
   the workspace entitlement. */
body.tenant-onboarding-only .module-links a:not([href="#billing"]):not([href="#launch-readiness"]),
body.tenant-onboarding-only .workspace-product-switcher,
body.tenant-onboarding-only #app-main > :not(#billing):not(#account-recovery-verification):not(#onboarding-verification):not(#billing-verification):not(#cancellation-verification):not(#production-onboarding-verification):not(#launch-readiness) {
  display: none !important;
}
body.tenant-onboarding-only #onboarding-verification {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

/* M23.1 mobile responsive corrective - overflow guard and phone tightening. */
@media (max-width: 760px) {
  html, body { overflow-x: clip; max-width: 100%; }
}
@media (max-width: 680px) {
  .topbar-actions { justify-items: start; width: 100%; gap: 0.45rem; }
  .user-session {
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
  }
  .user-session #user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
  }
  button.small {
    width: auto;
    flex: 0 0 auto;
    min-height: 44px;
  }
}
@media (max-width: 480px) {
  .topbar { padding: 0.8rem 0.85rem; }
  .module-nav { padding: 0.5rem 0.85rem; }
  .panel, .notice { padding: 0.75rem; }
  .metric-grid { gap: 0.45rem; }
}

