/* The report dashboard (/report): dense panels, KPI tiles and tables in
   the app's palette. Loaded only by that page. */
.rd { --panel: #fff; --rule: rgba(14, 26, 18, 0.1); --muted: #5b6a5f; display: flex; flex-direction: column; gap: 16px; font-size: 0.92rem; }
.rd .notice { margin: 0; }
.rd h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.rd h2 { font-size: 0.95rem; letter-spacing: -0.01em; }
.rd-muted { color: var(--muted); }
.rd-label { margin-bottom: 4px; font: 500 0.66rem/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.rd-num { font-variant-numeric: tabular-nums; }
.rd-right { text-align: right; }
.rd-empty { padding: 14px 16px; color: var(--muted); }
.pill--live { background: rgba(95, 179, 107, 0.18); color: var(--ivy-deep); }

/* Header: identity, then the summary, the depth or upsell card and the
   numbers, each the page's full width. */
.rd-top { display: flex; flex-direction: column; gap: 16px; }
.rd-site { font: 500 0.78rem/1.4 var(--mono); color: var(--ivy); overflow-wrap: anywhere; margin-bottom: 6px; }
.rd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; color: var(--muted); font-size: 0.85rem; }
.rd-meta a { font-weight: 600; }
.rd-admin-report__form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 0; }
.rd-admin-report__form label { display: grid; gap: 6px; min-width: 150px; font-weight: 700; }
.rd-admin-report__form .btn { min-height: 48px; }

.rd-panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; min-width: 0; }
.rd-panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.rd-panel > .rd-list, .rd-panel > .rd-bars { padding: 12px 16px; }
.rd-count { min-width: 28px; padding: 2px 8px; border-radius: 999px; background: rgba(14, 26, 18, 0.06); font: 600 0.75rem/1.5 var(--mono); text-align: center; }

.rd-depth, .rd-upsell { padding: 14px 16px; }
.rd-depth { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; }
.rd-depth__name { font-weight: 800; font-size: 1.15rem; color: var(--ivy-deep); }
.rd-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, auto)); gap: 8px 32px; margin: 0; }
.rd-facts dt { font-size: 0.72rem; color: var(--muted); }
.rd-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.rd-upsell { border-color: rgba(31, 92, 51, 0.35); box-shadow: 0 1px 0 rgba(14, 26, 18, 0.04), 0 8px 24px -16px rgba(20, 54, 31, 0.35); }
.rd-tiers { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 32px; }
.rd-tier { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.rd-tier + .rd-tier { padding-left: 32px; border-left: 1px solid var(--rule); }
.rd-tier__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--ivy-deep); }
.rd-tier__price { font: 600 0.85rem/1 var(--mono); color: var(--ivy); }
.rd-tier .rd-muted { font-size: 0.82rem; }
.rd-tier form { margin: auto 0 0; padding-top: 8px; }
.rd-tier .btn { width: 100%; max-width: 320px; }
.rd-upsell__note { margin-top: 10px; font-size: 0.78rem; }

/* What is happening now. */
.rd-now { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 10px; background: var(--ivy-deep); color: var(--on-dark); }
.rd-now .rd-label { color: var(--sprout); }
.rd-now__text { font-weight: 600; }
.rd-now__dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--on-dark-soft); }
.rd-now--live .rd-now__dot { background: var(--leaf); animation: rd-pulse 1.6s ease-out infinite; }
.rd-now--stale .rd-now__dot { animation: none; background: var(--on-dark-soft); }
/* Paused: the banner wears the same amber as its pill. */
.rd-now--attention { background: var(--amber-bg); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(138, 90, 0, 0.18); }
.rd-now--attention .rd-label { color: var(--amber); }
.rd-now--attention .rd-now__dot { background: var(--amber); }
@keyframes rd-pulse { 0% { box-shadow: 0 0 0 0 rgba(95, 179, 107, 0.7); } 100% { box-shadow: 0 0 0 10px rgba(95, 179, 107, 0); } }

/* KPI tiles. */
.rd-kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; margin: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; }
.rd-kpi { padding: 14px 16px; border-left: 1px solid var(--rule); min-width: 0; }
.rd-kpi:first-child { border-left: 0; }
.rd-kpi dt { font-size: 0.78rem; color: var(--muted); }
.rd-kpi dd { margin: 4px 0 0; }
.rd-kpi strong { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.rd-kpi__of { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.rd-kpi__sub { margin-top: 2px; font-size: 0.75rem; color: var(--muted); }
.rd-bar { display: block; width: 100%; height: 6px; margin-top: 8px; border: 0; border-radius: 999px; background: rgba(14, 26, 18, 0.07); appearance: none; overflow: hidden; }
.rd-bar::-webkit-progress-bar { background: rgba(14, 26, 18, 0.07); border-radius: 999px; }
.rd-bar::-webkit-progress-value { background: var(--leaf); border-radius: 999px; transition: width 0.4s; }
.rd-bar::-moz-progress-bar { background: var(--leaf); border-radius: 999px; }

/* Main column and side column. */
.rd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 16px; align-items: start; }
.rd-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.rd-table { width: 100%; border-collapse: collapse; }
.rd-table th { padding: 8px 16px; border-bottom: 1px solid var(--rule); font: 500 0.66rem/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); text-align: left; white-space: nowrap; }
.rd-table th.rd-right { text-align: right; }
.rd-table td { padding: 9px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.rd-table tr:last-child td { border-bottom: 0; }
.rd-table tbody tr:hover { background: rgba(201, 232, 181, 0.16); }

/* Both cells stay table cells, so each row's rule runs straight across. */
.rd-steps td { vertical-align: middle; line-height: 1.5; }
/* Each step has the agent doing it (mascots.js REPORT_STEPS): its leaf
   works while the step runs and hops when it's done. */
.rd-step__who { display: flex; align-items: center; gap: 10px; }
.rd-step--waiting .mascot { opacity: 0.55; }
.rd-step--waiting td { color: var(--muted); }
.rd-step--running td { font-weight: 700; color: var(--ivy-deep); }
.rd-step__state { font: 500 0.75rem/1.5 var(--mono); }

.rd-impact { display: inline-block; padding: 1px 7px; border-radius: 4px; font: 600 0.68rem/1.6 var(--mono); white-space: nowrap; }
.rd-impact--high { background: var(--red-bg); color: var(--red); }
.rd-impact--medium { background: var(--amber-bg); color: var(--amber); }
.rd-impact--low { background: rgba(14, 26, 18, 0.06); color: var(--muted); }
.rd-priority { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 4px; background: rgba(201, 232, 181, 0.7); color: var(--ivy-deep); font: 600 0.66rem/1.7 var(--mono); }

.rd-list { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.rd-list li { line-height: 1.5; }

/* Questions for the owner and what the report couldn't cover: one row per
   item with a small mark, so each reads on its own. */
.rd-items { list-style: none; margin: 0; padding: 0; }
.rd-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; padding: 12px 16px; border-top: 1px solid var(--rule); line-height: 1.5; }
.rd-item:first-child { border-top: 0; }
.rd-item p { overflow-wrap: anywhere; }
.rd-item__mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(14, 26, 18, 0.06); color: var(--muted); font: 600 0.75rem/1 var(--mono); }
.rd-item__mark--ask { background: var(--amber-bg); color: var(--amber); }
.rd-asks .rd-item p { color: var(--ink); font-weight: 600; }
.rd-panel__foot { padding: 10px 16px 12px; border-top: 1px solid var(--rule); font-size: 0.85rem; color: var(--muted); }
.rd-panel__foot a { font-weight: 600; white-space: nowrap; }

.rd-summary { padding: 16px 18px; }
.rd-summary .rd-muted { max-width: 90ch; }
.rd-summary__headline { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--ivy-deep); margin-bottom: 8px; }

/* Actions table. */
.rd-panel--flush form { margin: 0; }
.rd-approve { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 10px 16px; border-bottom: 1px solid var(--rule); background: rgba(201, 232, 181, 0.22); }
.rd-approve p { flex: 1 1 320px; font-size: 0.85rem; }
.rd-approve .btn:disabled { opacity: 0.42; cursor: default; }
.rd-action__meta { display: none; }
a.pill { text-decoration: none; }
.rd-actions .rd-check { width: 36px; padding-right: 0; }
.rd-actions .rd-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ivy); }
.rd-actions td:nth-child(n) { white-space: nowrap; }
.rd-actions td:has(> .rd-detail) { white-space: normal; width: 100%; }
.rd-detail summary { cursor: pointer; font-weight: 600; color: var(--ink); list-style: none; }
.rd-detail summary::-webkit-details-marker { display: none; }
.rd-detail summary::before { content: '▸'; display: inline-block; width: 1em; color: var(--muted); transition: transform 0.15s; }
.rd-detail[open] summary::before { transform: rotate(90deg); }
.rd-detail__body { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px 1em; color: var(--ink-soft); line-height: 1.55; max-width: 72ch; }
.rd-detail__body strong { color: var(--ink); }
.rd-pages { margin: 0; padding-left: 1.1em; font-size: 0.85rem; }
.rd-pages a { overflow-wrap: anywhere; }

.rd-bars { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.rd-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 0.85rem; }
.rd-bars__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 0.75rem; }
.rd-bars .rd-bar { grid-column: 1 / -1; margin-top: 0; }

@media (max-width: 1100px) {
  .rd-kpis { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rd-kpi:nth-child(4) { border-left: 0; }
  .rd-kpi:nth-child(n+4) { border-top: 1px solid var(--rule); }
  .rd-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .rd-psi .rd-col-wide { display: none; }
  .rd-top { grid-template-columns: minmax(0, 1fr); }
  .rd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd-kpi:nth-child(n) { border-left: 0; border-top: 1px solid var(--rule); }
  .rd-kpi:nth-child(-n+2) { border-top: 0; }
  .rd-kpi:nth-child(even) { border-left: 1px solid var(--rule); }
  /* An odd last tile takes the whole row instead of leaving an empty cell. */
  .rd-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .rd-table th, .rd-table td { padding-inline: 10px; }
  /* The page count moves under each action's title. */
  .rd-actions .rd-col-pages { display: none; }
  .rd-action__meta { display: block; margin: 2px 0 0 1em; font: 500 0.72rem/1.5 var(--mono); color: var(--muted); }
  .rd-tier + .rd-tier { padding-left: 0; border-left: 0; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--rule); }
  .rd-tier .btn { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rd-now--live .rd-now__dot { animation: none; }
}
/* An action's prompt, ready to copy (report → work). */
.rd-prompt { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(31, 92, 51, 0.06); font: 0.78rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16em; overflow: auto; }
.rd-detail__body .actions { margin: 0; }
.rd-queue { margin: 0; padding: 10px 16px 0; font-size: 0.86rem; }
.rd-because { overflow-wrap: anywhere; }

/* A report action's on/off switch, after the first approval. */
.rd-actions .rd-check--switch { width: 72px; padding-right: 4px; }
.rd-switch { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 2px 0; border: 0; background: none; color: var(--quiet); font: 600 0.72rem/1 var(--mono); cursor: pointer; }
.rd-switch__track { position: relative; width: 30px; height: 18px; border-radius: 9px; background: var(--quiet); transition: background 0.15s; }
.rd-switch__track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.rd-switch[aria-checked='true'] { color: var(--ivy-deep); }
.rd-switch[aria-checked='true'] .rd-switch__track { background: var(--ivy); }
.rd-switch[aria-checked='true'] .rd-switch__track::after { transform: translateX(12px); }
.rd-switch:focus-visible { outline: 2px solid var(--ivy); outline-offset: 2px; border-radius: 4px; }
.rd-switch-state { color: var(--quiet); font: 600 0.68rem/1.4 var(--mono); }
.rd-action.is-off > td:not(.rd-check) { opacity: 0.55; }
/* Who worked on the report, and who does each part of it. The leaves hold
   still here; the moving ones are on the Agents page. */
.rd-crew { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 18px; }
.rd-crew .rd-label { margin: 0; }
.rd-crew ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.rd-crew li { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; }
.rd-crew__button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 6px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; cursor: help; }
.rd-crew__button:hover { background: var(--paper); }
.rd-crew__button:focus-visible { outline: 2px solid var(--ivy); outline-offset: 3px; }
.rd-crew__role { position: absolute; top: calc(100% + 6px); left: 18px; z-index: 20; width: min(28rem, calc(100% - 36px)); padding: 10px 14px; border-radius: var(--radius); background: var(--ivy-deep); color: var(--on-dark); font-size: 0.86rem; line-height: 1.5; visibility: hidden; }
.rd-crew__member:hover .rd-crew__role, .rd-crew__member:focus-within .rd-crew__role, .rd-crew__member[data-role-open='true'] .rd-crew__role { visibility: visible; }
.rd-crew__member[data-role-dismissed='true'] .rd-crew__role { visibility: hidden; }
.rd-by { display: inline-flex; align-items: center; gap: 5px; font: 500 0.7rem/1.4 var(--mono); color: var(--muted); white-space: nowrap; }
.rd-panel__head .rd-by { margin-left: auto; }
.rd-who { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.rd-crew .mascot .m-fig, .rd-crew .mascot .m-eyes, .rd-by .mascot .m-fig, .rd-by .mascot .m-eyes, .rd-who .mascot .m-fig, .rd-who .mascot .m-eyes { animation: none; }
