/*
 * Roswell Dealers — page-level styles that are not part of the Vireo theme.
 * Load order: bootstrap.min.css -> fonts.css -> vireo-theme.css -> app.css
 *
 * The CSP forbids style attributes, so every width or state a template needs
 * has a class here. Anything genuinely dynamic is set from JS via the CSSOM.
 */

/* ---- Shared with the PIM ------------------------------------------------ */

/* Audit log values: long JSON must not stretch the table. */
.rx-audit-value { max-width: 40ch; overflow-wrap: anywhere; font-size: 0.8125rem; margin: 0; white-space: pre-wrap; }
.rx-audit-old { color: var(--rx-text-muted); }
.rx-audit-new { color: var(--rx-text-strong); }

/* Permission checkbox grid in the role editor. */
.rx-perm-group + .rx-perm-group { margin-top: 1.5rem; }
.rx-perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.5rem 1.5rem; }

.rx-resend[disabled] { opacity: 0.6; }

/* Self-test and warning panels on the dashboard. */
.rx-selftest-fail { border-color: color-mix(in srgb, var(--rx-danger) 50%, transparent) !important; }
.rx-notice-warn { border-color: color-mix(in srgb, var(--rx-warning) 50%, transparent) !important; }
.rx-notice-ok { border-color: color-mix(in srgb, var(--rx-success) 50%, transparent) !important; }
.rx-launch-badge { min-width: 4.75rem; margin-top: 0.15rem; }
.rx-min-0 { min-width: 0; }
.rx-selftest-list { margin: 0; padding-left: 1.1rem; font-size: 0.8125rem; }
.rx-selftest-list code { overflow-wrap: anywhere; }

a.rx-kpi { text-decoration: none; }
a.rx-kpi:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Column and control widths, so no template needs a style attribute. */
.rx-cw-14 { max-width: 14ch; }
.rx-cw-20 { max-width: 20ch; }
.rx-cw-28 { max-width: 28ch; overflow-wrap: anywhere; }
.rx-mw-7  { max-width: 7rem; }
.rx-mw-11 { max-width: 11rem; }
.rx-mw-16 { max-width: 16rem; }

/* The brand slot (views/partials/brand.php). */
.rx-brand-logo { display: block; width: 32px; height: 32px; flex-shrink: 0; }

/* ---- Dealer platform ---------------------------------------------------- */

/* A nav entry for a section that arrives in a later phase. */
.rx-nav-link.rx-nav-soon { opacity: 0.55; cursor: default; pointer-events: none; }
.rx-nav-soon .badge { font-size: 0.625rem; }

/* Split sign-in page (index.php): dealer sign-in | become a dealer. */
.rx-split { width: 100%; max-width: 960px; }
.rx-split .card { height: 100%; }
.rx-split-pitch { background: var(--rx-accent-wash); }
.rx-split-pitch ul { padding-left: 1.1rem; margin-bottom: 0; }
.rx-staff-link { font-size: 0.8125rem; color: var(--rx-text-subtle); text-decoration: none; }
.rx-staff-link:hover { color: var(--rx-accent); }

/* Settings form: one row per setting. */
.rx-setting-row + .rx-setting-row { border-top: 1px solid var(--rx-border); }
.rx-setting-key { font-size: 0.75rem; }

/* Notification routing matrix: role names as narrow column heads. */
.rx-matrix-head { min-width: 6.5rem; max-width: 8rem; white-space: normal; text-transform: none; letter-spacing: normal; font-size: 0.75rem; }

/* ---- Forms (Phase 3) ------------------------------------------------------ */

/* Builder: drag handles and the item being dragged. */
.rx-drag { cursor: grab; color: var(--rx-text-subtle); padding: 0 0.25rem; }
.rx-drag:active { cursor: grabbing; }
.rx-dragging { opacity: 0.5; }
.rx-empty-row { font-size: 0.8125rem; }

/* Rich text from the builder (intro, agreement body, text blocks). */
.rx-richtext > :last-child { margin-bottom: 0; }
.rx-richtext table { width: 100%; margin-bottom: 1rem; }
.rx-richtext th, .rx-richtext td { border: 1px solid var(--rx-border); padding: 0.375rem 0.5rem; }
.rx-document { max-height: 28rem; overflow-y: auto; }

/* Filling a form: readable width, file drop box. */
.rx-form-narrow { max-width: 820px; }
.rx-fsection > .card-body > legend { float: none; }
.rx-dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 0.375rem; text-align: center;
  padding: 1rem; border: 1px dashed var(--rx-border); border-radius: var(--bs-border-radius);
  background: var(--rx-surface-subtle);
}
.rx-dropzone.is-invalid { border-color: var(--rx-danger); }
.rx-dropzone-over { border-color: var(--rx-accent); background: var(--rx-accent-wash); }
.rx-dropzone input[type=file] { max-width: 22rem; }
.rx-file-list li + li { margin-top: 0.25rem; }

/* Read-only answers and the facts panel beside them. */
.rx-answers dt { font-weight: 500; color: var(--rx-text-muted); }
.rx-answers dd { overflow-wrap: anywhere; }
.rx-facts dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--rx-text-subtle); font-weight: 600; }
.rx-facts dd { margin-bottom: 0.75rem; }
.rx-facts dd:last-child { margin-bottom: 0; }

/* ---- Dealer status (Phase 4) ---------------------------------------------- */
.rx-steps { display: flex; gap: 0.5rem; list-style: none; padding: 0; flex-wrap: wrap; }
.rx-step { display: flex; align-items: center; gap: 0.5rem; flex: 1 1 8rem; color: var(--rx-text-subtle); font-size: 0.875rem; }
.rx-step-dot {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 1px solid var(--rx-border); font-weight: 600; font-size: 0.8125rem;
}
.rx-step-done { color: var(--rx-text-muted); }
.rx-step-done .rx-step-dot { background: var(--rx-accent-wash); border-color: var(--rx-accent); color: var(--rx-accent); }
.rx-step-current { color: var(--rx-text-strong); font-weight: 500; }
.rx-step-current .rx-step-dot { background: var(--rx-accent); border-color: var(--rx-accent); color: #fff; }

/* Getting Started steps (UPDATES-01 U3). */
.rx-gs-mark {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--rx-border); font-weight: 600;
}
.rx-gs-done .rx-gs-mark { background: var(--rx-accent-wash); border-color: var(--rx-accent); color: var(--rx-accent); }
.rx-gs-todo .rx-gs-mark { border-color: var(--rx-accent); color: var(--rx-text-strong); }
.rx-gs-info .rx-gs-mark { color: var(--rx-text-subtle); }
.rx-richtext > :last-child { margin-bottom: 0; }

/* Portal top bar: logo and words side by side, like the sidebar lockup. */
.rx-topbar .rx-brand { display: flex; align-items: center; gap: 10px; font-family: var(--rx-font-display); font-weight: 700; color: var(--rx-text-strong); }

/* History tables: long staff or dealer emails wrap instead of pushing the note off the card. */
.rx-history-by { max-width: 16rem; overflow-wrap: anywhere; }

/* ---- Signing (Phase 5) ---------------------------------------------------- */
.rx-sign-pad {
  display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair;
  background: #fff; border: 1px solid var(--rx-border); border-radius: var(--bs-border-radius);
}
.rx-sign-pad.is-invalid { border-color: var(--rx-danger); }
.rx-sign-image { max-width: 100%; max-height: 140px; background: #fff; border: 1px solid var(--rx-border); border-radius: var(--bs-border-radius); padding: 0.5rem; }

/* ---- Dealer portal (Phase 8) ---------------------------------------------- */
.rx-portal-nav { padding: 8px 24px; background: var(--rx-surface-raised); border-bottom: 1px solid var(--rx-border); }
.rx-portal-nav .nav-link { padding: 0.375rem 0.875rem; font-size: 0.875rem; color: var(--rx-text-muted); }
.rx-portal-nav .nav-link.active, .rx-portal-nav .nav-link:hover { color: var(--rx-accent); }
.rx-portal-nav .dropdown-menu { min-width: 15rem; }
.rx-post-unread { font-weight: 600; }
.rx-post-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--rx-accent); flex-shrink: 0; }
.rx-task-list .list-group-item { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* ---- Content admin (Phase 9) ---------------------------------------------- */
.rx-rich-bar { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.375rem; }
.rx-rich-box { min-height: 16rem; max-height: 40rem; overflow-y: auto; height: auto; }
.rx-rich-box:focus { outline: none; }
.rx-rich-box[contenteditable="false"] { background: var(--rx-surface-subtle); }
/* A post's header image: full width, never taller than a screenful. */
.rx-post-header { display: block; width: 100%; height: auto; max-height: 420px; object-fit: cover; border-radius: var(--bs-border-radius); }
.card-img-top.rx-post-header { border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0; }
.rx-group-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0 1rem; max-height: 10rem; overflow-y: auto; }
.rx-member-list { max-height: 32rem; overflow-y: auto; }
.rx-member + .rx-member { margin-top: 0.375rem; }
