/* ============================================================================
 * mobile-v2.css — OPT mobile redesign (2026-05-11)
 *
 * Ports the editorial mobile prototype (~/Downloads/Mobile Responsive.zip)
 * to the real OPT dashboard. Layouts are taken verbatim from the prototype;
 * design tokens are mapped to the existing OPT editorial system so this
 * file coexists with style.css / editorial-overlay.css without introducing
 * a parallel parchment-gold palette.
 *
 * Token mapping prototype → OPT:
 *   --bg          → var(--paper)         (#fbfaf6)
 *   --bg-elev     → var(--paper-2)       (#f4f1e8)
 *   --bg-sunk     → var(--paper-3)       (#ece8da)
 *   --chrome      → var(--paper-2)
 *   --chrome-dark → var(--ink)           (#0a0a0a)
 *   --ink         → var(--ink)
 *   --mute        → var(--ink-3)
 *   --line        → var(--rule)          (#d9d4c4)
 *   --gold        → var(--accent)        (#f4e14a — OPT yellow, not prototype's muted #caa441)
 *   --gold-soft   → var(--accent-soft)   (#fef9cc)
 *   --f-serif     → var(--serif)         (Newsreader, not EB Garamond)
 *   --f-sans      → var(--sans)          (Inter, not IBM Plex)
 *   --f-mono      → var(--mono)          (JetBrains Mono, not IBM Plex Mono)
 *
 * Everything is scoped to @media (max-width: 767.98px) so desktop is
 * untouched. Components are prefixed with .m- so they don't collide with
 * the legacy .am-*, .client-*, etc. namespaces in style.css.
 *
 * Reference: HANDOFF.md in the prototype zip — match values exactly.
 * ========================================================================= */

@media (max-width: 767.98px) {

/* ── Density variables (used by cards, rows, gaps) ───────────────────────── */
.m-app {
    --m-pad: 14px;
    --m-row-min: 56px;
    --m-gap: 10px;
}
.m-app[data-density="compact"] {
    --m-pad: 10px;
    --m-row-min: 44px;
    --m-gap: 6px;
}

/* ── Page title ─────────────────────────────────────────────────────────── */
.m-h-page {
    font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
    font-weight: 500;
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink, var(--ink-strong));
    margin: 0;
}
.m-h-section {
    font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
    font-weight: 500;
    font-size: 22px;
    line-height: 1.15;
    color: var(--ink, var(--ink-strong));
    margin: 0;
}
.m-page-sub {
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 13px;
    color: var(--ink-3, var(--ink-faint));
    margin-top: 4px;
    border-bottom: 1px dotted var(--ink-4, var(--ink-faint));
    display: inline-block;
    padding-bottom: 1px;
}
.m-brand {
    font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
    font-weight: 600;
    font-size: 26px;
    letter-spacing: -0.02em;
    color: var(--ink, var(--ink-strong));
    line-height: 1;
}

/* ── Section label (eyebrow above any block) ────────────────────────────── */
.m-label {
    font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3, var(--ink-faint));
}

/* ── Card (generic container) ───────────────────────────────────────────── */
.m-card {
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    border: 1px solid var(--rule, var(--border-200, #d9d4c4));
    border-radius: 10px;
    padding: 14px;
    display: block;
}
.m-card + .m-card { margin-top: 10px; }

/* ── Stat block (2-up grid by default) ──────────────────────────────────── */
.m-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.m-stat-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.m-stat {
    padding: 14px;
    border: 1px solid var(--rule, var(--border-200, #d9d4c4));
    border-radius: 8px;
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    display: flex; flex-direction: column; gap: 4px;
    min-width: 0;
}
.m-stat .lbl {
    font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3, var(--ink-faint));
    font-weight: 500;
}
.m-stat .val {
    font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
    font-size: 24px;
    font-weight: 500;
    color: var(--ink, var(--ink-strong));
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
.m-stat .sub {
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 11px;
    color: var(--ink-3, var(--ink-faint));
}

/* ── Score chip (legend distribution) ──────────────────────────────────── */
.m-score-stack { display: flex; gap: 4px; flex-wrap: wrap; }
.m-score-stack .m-score {
    min-width: 28px; height: 22px; padding: 0 7px;
    font-size: 11px;
}

/* ── Score chip (single value) ─────────────────────────────────────────── */
.m-score {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 28px; height: 24px; padding: 0 7px;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-weight: 600;
    font-size: 12px;
    border-radius: 3px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: #fff;
}
.m-score.g { background: var(--up, var(--status-success, #1f7a3a)); }
.m-score.y { background: var(--accent, #f4e14a); color: var(--accent-ink, #0a0a0a); }
.m-score.o { background: var(--status-warning, #d9882a); color: #0a0a0a; }
.m-score.r { background: var(--down, var(--status-danger, #b42318)); }
.m-score.n {
    background: var(--paper-3, var(--surface-2, #ece8da));
    color: var(--ink-3, var(--ink-faint));
    border: 1px solid var(--rule, var(--border-subtle));
}

/* Re-style the legacy .score-dot to match .m-score on mobile so existing
   templates using class="score-dot score-val-N" automatically inherit the
   new look without each template needing a rewrite. */
.score-dot {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    min-width: 28px !important; height: 24px !important;
    padding: 0 7px !important;
    font-family: var(--sans, "Inter", -apple-system, sans-serif) !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    border-radius: 3px !important;
    line-height: 1 !important;
    font-variant-numeric: tabular-nums;
}
.score-dot.score-val-0 {
    background: var(--paper-3, var(--surface-2, #ece8da)) !important;
    color: var(--ink-3, var(--ink-faint)) !important;
    border: 1px solid var(--rule, var(--border-subtle)) !important;
}
.score-dot.score-val-1 { background: var(--down, var(--status-danger, #b42318)) !important; color: #fff !important; border: 0 !important; }
.score-dot.score-val-2 { background: var(--status-warning, #d9882a) !important; color: #0a0a0a !important; border: 0 !important; }
.score-dot.score-val-3 { background: var(--accent, #f4e14a) !important; color: var(--accent-ink, #0a0a0a) !important; border: 0 !important; }
.score-dot.score-val-4 { background: var(--up, var(--status-success, #1f7a3a)) !important; color: #fff !important; border: 0 !important; }

/* ── Stage pill (status badge) ─────────────────────────────────────────── */
.m-pill {
    display: inline-flex; align-items: center; gap: 4px;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 4px;
    background: var(--paper-3, var(--surface-2, #ece8da));
    color: var(--ink-2, var(--ink-body));
    white-space: nowrap;
}
.m-pill.mrr   { background: #dfe2f0; color: #38406b; }
.m-pill.trial { background: #f4e7a8; color: #6b5a14; }
.m-pill.asc   { background: #e3d8ee; color: #4f3a6b; }
.m-pill.gold  { background: var(--accent-soft, #fef9cc); color: var(--accent-dk, #8a7325); }
.m-pill.danger { background: rgba(180, 35, 24, 0.12); color: var(--down, #b42318); }

/* Map the legacy .stage-pill variants to the new pill look on mobile */
.stage-pill {
    font-family: var(--sans, "Inter", -apple-system, sans-serif) !important;
    font-size: 9.5px !important;
    font-weight: 600 !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    padding: 3px 7px !important;
    border-radius: 4px !important;
}
.stage-pill.mrr      { background: #dfe2f0 !important; color: #38406b !important; }
.stage-pill.trial    { background: #f4e7a8 !important; color: #6b5a14 !important; }
.stage-pill.ascended { background: #e3d8ee !important; color: #4f3a6b !important; }
.stage-pill.paused,
.stage-pill.churned  { background: var(--paper-3, #ece8da) !important; color: var(--ink-3, var(--ink-faint)) !important; }

/* ── Button (default / primary / gold / ghost) ─────────────────────────── */
.m-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    height: 44px; padding: 0 16px;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    border: 1px solid var(--rule, var(--border-standard, #d9d4c4));
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    color: var(--ink, var(--ink-strong));
    border-radius: 6px;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}
.m-btn:active { background: var(--paper-3, var(--surface-2, #ece8da)); }
.m-btn.primary {
    background: var(--ink, #0a0a0a);
    color: var(--paper, #fbfaf6);
    border-color: var(--ink, #0a0a0a);
}
.m-btn.gold {
    background: var(--accent-soft, #fef9cc);
    border-color: #e6d57e;
    color: var(--ink, #0a0a0a);
}
.m-btn.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ink-2, var(--ink-body));
}
.m-btn.sm { height: 34px; padding: 0 12px; font-size: 10.5px; }
.m-btn.full { width: 100%; }
.m-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Input ──────────────────────────────────────────────────────────────── */
.m-input {
    height: 44px;
    width: 100%;
    border: 1px solid var(--rule, var(--border-standard, #d9d4c4));
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    border-radius: 6px;
    padding: 0 12px;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 15px;
    color: var(--ink, var(--ink-strong));
    outline: none;
}
.m-input:focus { border-color: var(--accent, #f4e14a); }
textarea.m-input { height: auto; padding: 12px; line-height: 1.5; min-height: 96px; }
select.m-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%235d5d5a' d='M6 8L2 4h8z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ── Filter chips (horizontal scrolling row) ───────────────────────────── */
.m-chips {
    display: flex; gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    background: var(--paper, var(--bg-50, #fbfaf6));
    border-bottom: 1px solid var(--rule, var(--border-subtle));
    scrollbar-width: none;
}
.m-chips::-webkit-scrollbar { display: none; }
.m-chip {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 12px;
    border: 1px solid var(--rule, var(--border-standard, #d9d4c4));
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    border-radius: 999px;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 12px;
    color: var(--ink-2, var(--ink-body));
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.m-chip.active {
    background: var(--accent-soft, #fef9cc);
    border-color: #e6d57e;
    color: var(--ink, var(--ink-strong));
}
.m-chip .badge {
    background: var(--accent, #f4e14a);
    color: var(--accent-ink, #0a0a0a);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 999px;
    font-weight: 600;
}

/* ── Tab strip (horizontal scrolling) ──────────────────────────────────── */
.m-tabs {
    display: flex; gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid var(--rule, var(--border-subtle));
    background: var(--paper, var(--bg-50, #fbfaf6));
    scrollbar-width: none;
}
.m-tabs::-webkit-scrollbar { display: none; }
.m-tab {
    flex: 0 0 auto;
    padding: 14px 18px 12px;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3, var(--ink-faint));
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.m-tab.active {
    color: var(--ink, var(--ink-strong));
    border-bottom-color: var(--accent, #f4e14a);
}

/* ── Client card (the canonical 4-up KPI card layout) ──────────────────── */
.m-client-card {
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    border: 1px solid var(--rule, var(--border-200, #d9d4c4));
    border-radius: 10px;
    padding: 12px;
    display: flex; flex-direction: column;
    gap: 10px;
    width: 100%;
    text-align: left;
    text-decoration: none;
    color: var(--ink, var(--ink-strong));
    cursor: pointer;
}
.m-client-card:active { background: var(--paper-3, var(--surface-2, #ece8da)); }
.m-client-card + .m-client-card { margin-top: 10px; }
.m-client-card-head {
    display: flex; align-items: flex-start; gap: 10px;
}
.m-client-card-head .ident {
    flex: 1; min-width: 0;
}
.m-client-card-head .name {
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink, var(--ink-strong));
    line-height: 1.25;
    margin: 0 0 3px 0;
    text-decoration: none;
}
.m-client-card-head .meta {
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 12px;
    color: var(--ink-3, var(--ink-faint));
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.m-client-card-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    align-items: center;
    padding-top: 8px;
    border-top: 1px dashed var(--rule, var(--border-subtle));
}
.m-kpi {
    display: flex; flex-direction: column; gap: 4px;
    min-width: 0;
}
.m-kpi .lbl {
    font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3, var(--ink-faint));
}
.m-kpi .val {
    font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
    font-size: 15px;
    font-weight: 500;
    color: var(--ink, var(--ink-strong));
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.m-kpi .val.sans {
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 13px;
    font-weight: 600;
}
.m-client-card-foot {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 12px;
    color: var(--ink-3, var(--ink-faint));
}
.m-client-card-foot .av {
    width: 22px; height: 22px; border-radius: 999px;
    background: linear-gradient(135deg, #f3dca0, #c9a23a);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 10px; color: #3a2d0a;
}
.m-client-card-foot .chev {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px;
    color: var(--ink-3, var(--ink-faint));
    text-transform: none;
    letter-spacing: 0;
}

/* ── Drawer (slide-in nav from left) ───────────────────────────────────── */
.m-drawer {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 80%; max-width: 320px;
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    z-index: 10500;
    display: none;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
    overflow-y: auto;
}
.m-drawer.is-open {
    display: flex;
    transform: translateX(0);
}
.m-drawer-section {
    display: block;
    font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 10px; letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3, var(--ink-faint));
    padding: 14px 18px 6px;
}
.m-drawer-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 18px;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 14px;
    color: var(--ink, var(--ink-strong));
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    cursor: pointer;
    text-decoration: none;
}
.m-drawer-item:active { background: var(--paper-3, var(--surface-2, #ece8da)); }
.m-drawer-item .ico { width: 18px; height: 18px; color: var(--ink-3, var(--ink-faint)); display: flex; align-items: center; justify-content: center; }
.m-drawer-item .count {
    margin-left: auto;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--paper-3, var(--surface-2, #ece8da));
    color: var(--ink-3, var(--ink-faint));
    font-weight: 500;
}
.m-drawer-item.active {
    background: var(--accent-soft, #fef9cc);
    color: var(--accent-ink, #0a0a0a);
}
.m-drawer-item.active .ico { color: var(--accent-dk, #8a7325); }

/* Drawer footer — user avatar + name */
.m-drawer-foot {
    margin-top: auto;
    padding: 14px 18px;
    border-top: 1px solid var(--rule, var(--border-subtle));
    display: flex; align-items: center; gap: 10px;
}

.m-backdrop {
    position: fixed; inset: 0;
    background: rgba(20,18,15,0.55);
    z-index: 10400;
    display: none;
    animation: m-fade-in 180ms ease-out;
}
.m-backdrop.is-open { display: block; }
@keyframes m-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Bottom sheet ──────────────────────────────────────────────────────── */
.m-sheet-backdrop {
    position: fixed; inset: 0;
    background: rgba(20,18,15,0.55);
    z-index: 10600;
    display: none;
    animation: m-fade-in 180ms ease-out;
}
.m-sheet-backdrop.is-open { display: block; }

.m-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 78%;
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    border-radius: 22px 22px 0 0;
    z-index: 10700;
    display: none;
    flex-direction: column;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.18);
    transform: translateY(100%);
    transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
}
.m-sheet.is-open {
    display: flex;
    transform: translateY(0);
}
.m-sheet-head {
    display: flex; align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--rule, var(--border-subtle));
    gap: 10px;
}
.m-sheet-head .title {
    font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
    font-weight: 500;
    font-size: 18px;
    flex: 1;
    color: var(--ink, var(--ink-strong));
}
.m-sheet-body {
    flex: 1; overflow-y: auto;
    padding: 16px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
}
.m-sheet-foot {
    display: flex; gap: 10px;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--rule, var(--border-subtle));
    background: var(--paper-2, var(--surface-0, #f4f1e8));
}

/* Icon button (topbar / sheet head) */
.m-iconbtn {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--ink, var(--ink-strong));
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
}
.m-iconbtn:active { background: var(--paper-3, var(--surface-2, #ece8da)); }

/* ── List row (drawer items, action sheet items, task rows) ────────────── */
.m-row {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    border-bottom: 1px solid var(--rule, var(--border-subtle));
    min-height: 56px;
    text-decoration: none;
    color: var(--ink, var(--ink-strong));
    cursor: pointer;
}
.m-row:active { background: var(--paper-3, var(--surface-2, #ece8da)); }
.m-row .ident { flex: 1; min-width: 0; }
.m-row .title {
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink, var(--ink-strong));
    line-height: 1.25;
}
.m-row .meta {
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 12px;
    color: var(--ink-3, var(--ink-faint));
    margin-top: 2px;
}
.m-row .end {
    flex-shrink: 0;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 12px;
    color: var(--ink-3, var(--ink-faint));
    text-align: right;
}

/* ── Section header inside a scrolled list (e.g. "Overdue (36)") ───────── */
.m-section-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 14px 6px;
    font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3, var(--ink-faint));
}
.m-section-head.danger { color: var(--down, var(--status-danger, #b42318)); }
.m-section-head .right {
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-3, var(--ink-faint));
    display: inline-flex; align-items: center; gap: 4px;
    text-decoration: none;
}

/* ── Activity feed (gold dotted left rule) ─────────────────────────────── */
.m-activity {
    border-left: 1px dotted var(--accent-dk, #8a7325);
    padding-left: 14px;
    margin-left: 7px;
}
.m-activity-item {
    padding: 8px 0;
    display: flex; align-items: baseline; gap: 8px;
}
.m-activity-item .body {
    flex: 1;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 13px;
    color: var(--ink-2, var(--ink-body));
}
.m-activity-item .ts {
    font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 10px;
    color: var(--ink-3, var(--ink-faint));
}

/* ── Action sheet item ─────────────────────────────────────────────────── */
.m-action-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    min-height: 48px;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 15px;
    color: var(--ink, var(--ink-strong));
    border-bottom: 1px solid var(--rule, var(--border-subtle));
    text-decoration: none;
    cursor: pointer;
}
.m-action-item:active { background: var(--paper-3, var(--surface-2, #ece8da)); }
.m-action-item.danger { color: var(--down, var(--status-danger, #b42318)); }
.m-action-item .ico { width: 20px; height: 20px; }
.m-action-item:last-child { border-bottom: none; }

/* ── Empty state ───────────────────────────────────────────────────────── */
.m-empty {
    text-align: center;
    padding: 48px 24px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.m-empty .ico {
    font-size: 36px;
    color: var(--ink-4, var(--ink-faint));
}
.m-empty .title {
    font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
    font-size: 20px;
    color: var(--ink, var(--ink-strong));
}
.m-empty .sub {
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 13px;
    color: var(--ink-3, var(--ink-faint));
}

/* ── Toast ─────────────────────────────────────────────────────────────── */
.m-toast {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: 50%; transform: translateX(-50%);
    background: var(--ink, #0a0a0a);
    color: var(--paper, #fbfaf6);
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 8px;
    z-index: 10800;
    animation: m-toast-in 200ms ease-out;
    max-width: calc(100% - 32px);
}
@keyframes m-toast-in {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ── Safe-area bottom gutter (above home indicator) ───────────────────── */
.m-screen-end {
    height: calc(32px + env(safe-area-inset-bottom));
}

/* ── Scroll-table (alternate to cards) ─────────────────────────────────── */
.m-dtable-wrap {
    overflow-x: auto;
    border: 1px solid var(--rule, var(--border-subtle));
    border-radius: 10px;
    background: var(--paper-2, var(--surface-0, #f4f1e8));
}
.m-dtable {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--sans, "Inter", -apple-system, sans-serif);
    font-size: 12px;
}
.m-dtable th, .m-dtable td {
    white-space: nowrap;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--rule, var(--border-subtle));
}
.m-dtable th {
    font-family: var(--mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3, var(--ink-faint));
    font-weight: 600;
    background: var(--paper, var(--bg-50, #fbfaf6));
}
.m-dtable td.sticky-l, .m-dtable th.sticky-l {
    position: sticky; left: 0;
    background: var(--paper-2, var(--surface-0, #f4f1e8));
    z-index: 2;
    box-shadow: 1px 0 0 var(--rule, var(--border-subtle));
}
.m-dtable th.sticky-l { background: var(--paper, var(--bg-50, #fbfaf6)); z-index: 3; }

/* ── Focus ring (accessibility) ────────────────────────────────────────── */
.m-card:focus-visible,
.m-chip:focus-visible,
.m-tab:focus-visible,
.m-btn:focus-visible,
.m-row:focus-visible,
.m-iconbtn:focus-visible {
    outline: 2px solid var(--accent, #f4e14a);
    outline-offset: 2px;
}

/* ────────────────────────────────────────────────────────────────────────
   Existing page overrides — coerce wide desktop rows to stack on mobile
   ──────────────────────────────────────────────────────────────────────── */

/* Client-brain GBP profile row — Ben round 15: buttons were overlapping
   wrapped profile name. The desktop layout is `flex-row: info | actions`
   with `flex-shrink: 0` on the actions block. On a narrow viewport the
   long client name wraps under the action buttons. Stack vertically on
   mobile so the action row sits BELOW the info, full width. */
.cm-gmb-row .cm-gmb-view {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
}
.cm-gmb-row .cm-gmb-view > div:last-child {
    /* Action button group (Manage / Edit / Unassign) */
    flex-wrap: wrap;
    justify-content: flex-end;
    width: 100%;
}
/* Stretch the action buttons to roughly equal width when wrapped */
.cm-gmb-row .cm-gmb-view > div:last-child > a,
.cm-gmb-row .cm-gmb-view > div:last-child > button {
    flex: 1 1 calc(33.333% - 4px);
    min-width: 0;
    justify-content: center;
    padding: 8px 6px !important;
    font-size: 0.7rem !important;
    min-height: 36px;
}
/* "Open GBP" link wraps onto its own line cleanly */
.cm-gmb-row .cm-gmb-view > div:first-child > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
}
/* Meta row (location · CID · email · status) — already flex-wrap */
.cm-gmb-row .cm-gmb-view > div:first-child > div:nth-child(2) {
    gap: 6px 10px !important;
}

/* Generic safety net: any inline-flex header row with flex-shrink:0
   action buttons should wrap cleanly on mobile rather than overflow. */
.cm-collapsible__summary,
.sc-section-title {
    flex-wrap: wrap !important;
}

/* ────────────────────────────────────────────────────────────────────────
   GLOBAL MOBILE OVERRIDES — apply across every page
   These fix the recurring "clipping" / "overflow" / "too wide" issues
   by enforcing safe defaults for common patterns: wide flex rows, stat
   grids of 4+ cells, filter bars, tables with too many columns.
   ──────────────────────────────────────────────────────────────────────── */

/* Inbox stat grid — already 2-col on mobile (inline @media in inbox.html);
   ensure stat values aren't too big to fit */
.inbox-stat-value { font-size: 1.4rem !important; }
.inbox-stat { padding: 12px 14px !important; }

/* Inbox task rows — wide horizontal layouts → stack on mobile */
.inbox-task-row {
    flex-wrap: wrap !important;
    gap: 6px 10px !important;
}
.inbox-task-row > * { min-width: 0; }

/* Account managers cards — desktop is 3-up grid; mobile is 1-up stack */
.am-cards-grid,
.am-portfolio-grid,
.am-portfolio-cards {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

/* Account hub — generate-summaries button full width, filter bar stacks */
.ah-actions,
.ah-filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
}
.ah-actions button,
.ah-actions a,
.ah-actions .btn {
    width: 100%;
    justify-content: center;
}

/* Account-hub manager group cards — full width on mobile */
.ah-am-group,
.ah-am-card {
    width: 100% !important;
    max-width: none !important;
}

/* Dashboard / Overview — hero stat grids 4-up → 2-up on mobile */
.opt-hero-stats,
.dashboard-hero-grid,
.metric-grid,
.kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
}
/* Inner stat blocks shrink fonts to fit */
.opt-hero-stat .value,
.dashboard-stat-value,
.metric-value {
    font-size: 1.5rem !important;
}
.opt-hero-stat .label,
.dashboard-stat-label,
.metric-label {
    font-size: 0.65rem !important;
}

/* Any wide horizontal scroll table — give it a fade indicator that it scrolls */
.table-responsive,
.opt-table-wrap,
.dtable-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Wide flex rows with right-floated action buttons — force wrap with
   actions on their own line. Common pattern: "title text + flex-shrink:0
   button group" which overlaps on narrow viewports. */
.opt-row-with-actions,
.row-actions,
.list-row {
    flex-wrap: wrap !important;
    gap: 6px 8px !important;
}

/* Modal / dialog widths — never exceed viewport */
.modal-dialog,
.opt-modal,
.nx-modal {
    max-width: calc(100vw - 24px) !important;
    margin: 12px !important;
}

/* Forms in modals — single column on mobile */
.modal-body .row,
.modal-body .opt-row,
.opt-form-row {
    flex-direction: column !important;
    gap: 12px !important;
}
.modal-body .col,
.modal-body [class^="col-"],
.opt-form-col {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* Page heading consistency — ensure h1 fits */
.am-header h1,
.page-header h1,
.opt-page-title,
h1.opt-h1 {
    font-size: 1.75rem !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere;
}

/* Bot Registry, Heat Grid, similar dense layouts — give them
   breathing room. */
.heat-grid-cell,
.bot-card,
.heat-cell {
    min-width: 0;
}

/* Tasks page — the dispatch table on the main inbox often has too
   many cols. Force the description cell to wrap. */
.task-description,
.inbox-task-title {
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal !important;
}

/* Universal: kill any rogue `width: Xpx` on form elements that pushes
   layouts past viewport */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="search"],
select,
textarea {
    max-width: 100%;
}

/* Universal: any flexbox with flex-shrink: 0 children that wraps badly
   should be allowed to wrap */
[style*="flex-shrink:0"],
[style*="flex-shrink: 0"] {
    min-width: 0;
}

/* Tighter padding on app-content so cards aren't pushed too far in */
.app-content,
.app-main > main {
    padding: 12px !important;
}

/* Sidebar nav popovers should not overflow viewport */
.dropdown-menu,
.popover,
.tippy-content {
    max-width: calc(100vw - 24px) !important;
}

/* ──────────────────────────────────────────────────────────────────────
   Client Brain (content_map.html) — header + modal mobile fixes
   ────────────────────────────────────────────────────────────────────── */

/* The .cm-header packs back arrow + h1 + page count + slug + Edit btn +
   "..." dropdown all on one row — wraps to 4+ lines on mobile. Stack
   it into a clean two-row layout: identity on top, actions below. */
.cm-page .cm-header {
    flex-wrap: wrap !important;
    gap: 6px 8px !important;
    padding: 10px 12px !important;
    align-items: center !important;
}
.cm-page .cm-header h1 {
    font-size: 1.1rem !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}
.cm-page .cm-header .cm-back {
    flex-shrink: 0;
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
}
.cm-page .cm-header .cm-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
}
/* Hide the inline client-id slug pill (the long blue underlined text)
   on mobile — it's a debug aid that wastes precious header space. */
.cm-page .cm-header > span[title="Client ID — click to select"] {
    display: none !important;
}
/* Action buttons (Edit, Extend, "...") wrap to their own row */
.cm-page .cm-header > div:last-child {
    flex: 1 1 100%;
    justify-content: flex-end;
    margin-left: 0 !important;
    gap: 6px;
}
.cm-page .cm-header .cm-extend-btn {
    padding: 6px 10px !important;
    font-size: 0.7rem !important;
}

/* Weekly-score modal (Edit past week) — Ben round 16: "I can't see
   anything past the content editor, can't scroll any further".
   Make the modal full-height on mobile so the body scrolls internally
   and the Save footer is always reachable. */
.cm-ws-modal-overlay {
    padding: 0 !important;
    align-items: stretch !important;
}
.cm-ws-modal {
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
}
.cm-ws-modal__head {
    flex-shrink: 0;
    padding: 12px 14px !important;
}
.cm-ws-modal__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px !important;
    padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
    -webkit-overflow-scrolling: touch;
}
/* Make the textarea bigger inside the modal so notes have room */
.cm-ws-modal__body textarea {
    min-height: 100px;
    max-height: 200px;
}
/* If the modal has a footer/save block, make it sticky at the bottom */
.cm-ws-modal__footer,
.cm-ws-modal .cm-ws-status + button,
.cm-ws-modal__body > div:last-child:has(button) {
    position: sticky;
    bottom: 0;
    background: var(--surface-1);
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 12px;
}

/* Tab strip on the Client Brain page should scroll horizontally
   on mobile, not wrap. */
.cm-page .cm-tabs,
.cm-page [role="tablist"] {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.cm-page .cm-tabs::-webkit-scrollbar,
.cm-page [role="tablist"]::-webkit-scrollbar { display: none; }

/* Client Brain dropdown menu — narrow + scrollable so the long menu
   fits + scrolls within the viewport */
.cmw-dropdown-menu {
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 80px) !important;
    overflow-y: auto;
}

/* GBP profile action buttons — round 16 left the row stacked but
   now collapse the button labels' icons / text padding so all three
   fit on one row on most mobiles without wrapping. */
.cm-gmb-row .cm-gmb-view > div:last-child > a,
.cm-gmb-row .cm-gmb-view > div:last-child > button {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =============================================================================
   MOBILE: account_managers/list  (PR: mobile/am-list)
   -----------------------------------------------------------------------------
   Per HANDOFF.md §5.6 — Account Managers: stacked editorial cards with serif
   manager name (22px), 56px avatar, gold-soft client count pill top-right,
   3 mini-stats (Health/Results/MRR), email/phone, "View Profile →" footer.
   Page title + full-width primary CTA per §5.6 + §4.9 (.btn.primary).
   ============================================================================= */

/* Page header — title + CTA */
.am-dashboard > .am-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rule);
}

.am-dashboard > .am-header .am-profile {
    gap: 12px;
}

/* .am-name is already serif 1.75rem !important via the .am-header h1 rule
   higher in this file (per HANDOFF.md page-title scale). Subtitle and CTA
   below are AM-list specific. */

.am-dashboard > .am-header .am-contact {
    flex-wrap: wrap;
    gap: 6px 12px;
    font-family: var(--sans);
    font-size: 12px;
    color: var(--ink-3);
}

.am-dashboard > .am-header .am-actions {
    width: 100%;
}

.am-dashboard > .am-header .am-actions > .btn {
    width: 100%;
    min-height: 44px;
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    justify-content: center;
}

/* Manager card — flat editorial surface per §4.5 (bg-elev, line border, r-md, no shadow) */
.am-dashboard .manager-card {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 10px;
    box-shadow: none;
}

.am-dashboard .manager-card .card-body {
    padding: 14px;
}

.am-dashboard .manager-card .card-footer {
    padding: 0 14px 12px;
    border-top: none;
}

/* Card header row: avatar (lg = 56px per spec), name, count pill */
.am-dashboard .manager-card .manager-avatar,
.am-dashboard .manager-card .manager-avatar-placeholder {
    width: 56px;
    height: 56px;
    border-width: 2px;
    flex-shrink: 0;
}

/* Manager name — serif 22px per HANDOFF §5.6 + §2 (h-section) */
.am-dashboard .manager-card h5 {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.15;
    color: var(--ink);
    margin: 0;
}

.am-dashboard .manager-card .text-muted {
    font-family: var(--sans);
    font-size: 12px;
    color: var(--ink-3);
}

/* Client count pill (top-right) — editorial gold-soft, replaces desktop gradient */
.am-dashboard .client-count-badge {
    background: var(--accent-soft);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 6px 10px;
    min-width: 56px;
    max-width: 72px;
    box-shadow: none;
}

.am-dashboard .client-count-badge .count {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1;
}

.am-dashboard .client-count-badge .label {
    font-family: var(--sans);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-top: 2px;
}

.am-dashboard .client-count-badge .badge-breakdown {
    gap: 6px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--rule);
}

.am-dashboard .client-count-badge .badge-stat {
    font-family: var(--sans);
    font-size: 9.5px;
    color: var(--ink-3);
}

.am-dashboard .client-count-badge .badge-stat i {
    font-size: 9px;
}

/* 3-mini-stats row per §5.6 — flat editorial stat blocks per §4.6 */
.am-dashboard .manager-stats {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 12px 8px;
    gap: 8px;
}

.am-dashboard .manager-stats .stat-box {
    padding: 0 4px;
}

.am-dashboard .manager-stats .stat-box:not(:last-child) {
    border-right: 1px solid var(--rule);
}

.am-dashboard .manager-stats .stat-value {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.1;
}

.am-dashboard .manager-stats .stat-label {
    font-family: var(--sans);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-top: 4px;
}

/* Email / phone rows — long emails wrap cleanly */
.am-dashboard .manager-contact {
    gap: 6px;
    margin-top: 12px;
}

.am-dashboard .manager-contact .contact-item {
    font-family: var(--sans);
    font-size: 12px;
    color: var(--ink-3);
    align-items: flex-start;
}

.am-dashboard .manager-contact .contact-item span {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.am-dashboard .manager-contact .contact-item i {
    color: var(--ink-3);
    flex-shrink: 0;
    margin-top: 2px;
}

/* "View Profile →" footer link — button-style label per §2 */
.am-dashboard .view-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
    min-height: 44px;
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink);
    opacity: 0.85;
}

/* Empty state — editorial, no AI-slop styling */
.am-dashboard .empty-state {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 24px 16px;
    text-align: center;
}

.am-dashboard .empty-state h4 {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    color: var(--ink);
    margin: 12px 0 6px;
}

.am-dashboard .empty-state p {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink-3);
}

.am-dashboard .empty-state .btn {
    width: 100%;
    margin-top: 16px;
    min-height: 44px;
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* =============================================================================
   MOBILE: company/account_hub  (PR: mobile/account-hub)
   -----------------------------------------------------------------------------
   Per HANDOFF.md §5.5 — Account Hub (Weekly Ledger tab focus):
   - Page header + tabs stack & equal-width on mobile (already partially done
     by template's inline @media, this is the polish layer)
   - Problem stats strip wraps cleanly + becomes scrollable
   - Toolbar (search · AM · week · jump-to · generate) stacks vertically,
     each control becomes a 44px tap target
   - Generate All Summaries CTA goes full-width per §5.5 + §4.9
   - Trend tiles (Avg Health / Avg Results) become a 2-up grid per §4.6
   - Status table gets horizontal scroll with sticky first column per §4.12
   - Weekly note drawer rows reflow to full width
   ============================================================================= */

/* Account Hub page header — tighten under the template's inline @media rules */
.acc-pageheader {
    margin: 12px var(--pad, 14px) 12px;
    padding-bottom: 12px;
}

.acc-pageheader__title {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.acc-pageheader__sub {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink-3);
    margin-top: 6px;
}

/* Segmented tab pill — full width, equal columns, taller for tap targets */
.acc-tabs {
    width: 100%;
    margin-top: 12px;
    padding: 4px;
}

.acc-tab {
    flex: 1;
    min-height: 40px;
    justify-content: center;
    padding: 8px 12px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.acc-tab .bi {
    font-size: 14px;
}

/* Problem-clients stats strip — wrap and scroll-friendly on phones */
.acc-stats-strip {
    margin: 0 var(--pad, 14px) 12px;
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-family: var(--sans);
    font-size: 12px;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--rule);
    color: var(--ink-body);
}

.acc-stats-strip strong {
    font-weight: 600;
    color: var(--ink);
}

.acc-stats-strip__link {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    color: var(--ink);
}

.acc-stats-strip__link:first-of-type {
    margin-left: 0;
}

/* === Ledger tab specifics === */

/* Section wrapper inherits page horizontal pad */
.status-ledger {
    padding: 0 var(--pad, 14px);
}

/* Toolbar — stack every cell vertically. Each control is full-width 44px tall */
.status-ledger .sl-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    background: transparent;
    border: 0;
}

.status-ledger .sl-toolbar-cell {
    width: 100%;
}

.status-ledger .sl-toolbar-cell--push {
    margin-left: 0;
}

.status-ledger .sl-toolbar-label {
    display: block;
    font-family: var(--sans);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 4px;
    min-height: 0;
}

.status-ledger .sl-input-wrap {
    width: 100%;
}

.status-ledger .sl-input,
.status-ledger .sl-control,
.status-ledger select.sl-control {
    width: 100%;
    height: 44px;
    font-family: var(--sans);
    font-size: 15px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--rule);
    background: var(--paper-2);
    color: var(--ink);
}

.status-ledger .sl-input {
    padding-left: 36px;
}

.status-ledger .sl-input-icon {
    font-size: 16px;
    left: 12px;
    color: var(--ink-3);
}

/* Week navigator stays horizontal with chevrons */
.status-ledger .sl-week-nav {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: stretch;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--paper-2);
    overflow: hidden;
}

.status-ledger .sl-week-nav .sl-icon-btn {
    flex: 0 0 44px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--ink);
}

.status-ledger .sl-week-label {
    flex: 1 1 auto;
    min-height: 44px;
    border: 0;
    background: transparent;
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink);
    padding: 0 8px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.status-ledger .sl-week-cal {
    font-size: 14px;
    color: var(--ink-3);
}

/* Generate All Summaries — primary gold CTA, full-width per §5.5 */
.status-ledger .sl-btn-primary {
    width: 100%;
    min-height: 44px;
    padding: 0 16px;
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    background: var(--accent);
    color: var(--accent-ink, #0a0a0a);  /* var(--ink) is editorial-only — fall back to accent-ink (defined globally in tokens.css) so Nexus also gets dark text on the yellow accent */
    border: 1px solid var(--rule);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-ledger .btn-generate {
    width: 100%;
    min-height: 44px;
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* Trend tiles — 2-up grid per §4.6 */
.status-ledger .sl-trend-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 14px 0;
}

.status-ledger .sl-trend-tile {
    padding: 12px;
    border-radius: 10px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    box-shadow: none;
}

.status-ledger .sl-trend-label {
    font-family: var(--sans);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.status-ledger .sl-trend-value {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--ink);
    margin-top: 4px;
}

.status-ledger .sl-trend-max {
    font-family: var(--sans);
    font-size: 11px;
    color: var(--ink-3);
    margin-left: 2px;
}

.status-ledger .sl-trend-delta {
    font-family: var(--sans);
    font-size: 11px;
    margin-top: 4px;
}

.status-ledger .sl-trend-meta {
    font-family: var(--sans);
    font-size: 10.5px;
    color: var(--ink-3);
    margin-top: 4px;
}

.status-ledger .sl-trend-spacer {
    display: none;
}

.status-ledger .sl-results-meta {
    grid-column: 1 / -1;
    font-family: var(--sans);
    font-size: 12px;
    color: var(--ink-3);
    text-align: right;
    padding: 0 4px;
}

/* Status table — horizontal scroll with sticky first column per §4.12 */
.status-ledger .status-table-wrapper,
.status-ledger .cc-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: var(--paper-2);
    margin: 0 calc(-1 * var(--pad, 14px));
    border-left: 0;
    border-right: 0;
    border-radius: 0;
}

.status-ledger .status-table,
.status-ledger .sl-table {
    font-family: var(--sans);
    font-size: 12px;
    min-width: 720px;
}

.status-ledger .status-table thead th,
.status-ledger .sl-table thead th {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 10px 12px;
    background: var(--paper-2);
}

.status-ledger .status-table tbody td,
.status-ledger .sl-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--rule);
    color: var(--ink-body);
}

/* Sticky first column (client name) */
.status-ledger .status-table thead th.col-client,
.status-ledger .sl-table thead th.col-client,
.status-ledger .status-table tbody td.col-client,
.status-ledger .sl-table tbody td.col-client {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--paper-2);
    box-shadow: 1px 0 0 var(--rule);
    min-width: 160px;
}

.status-ledger .client-name {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
}

.status-ledger .client-meta {
    font-family: var(--sans);
    font-size: 11px;
    color: var(--ink-3);
}

/* Drawer row (notes/summary editor expanded below each client row) */
.status-ledger .sl-drawer-inner {
    padding: 12px;
}

.status-ledger .sl-drawer-head,
.status-ledger .sl-drawer-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.status-ledger .sl-drawer-label {
    font-family: var(--sans);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.status-ledger .sl-drawer-save,
.status-ledger .btn-save-row {
    width: 100%;
    min-height: 44px;
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    border-radius: 6px;
}

/* Empty state */
.status-ledger .status-empty {
    padding: 24px 16px;
    text-align: center;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 10px;
    margin: 14px 0;
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink-3);
}

/* =============================================================================
   MOBILE: company/inbox  (PR: mobile/inbox)
   -----------------------------------------------------------------------------
   Per HANDOFF.md §5.2 — Inbox: KPI strip stacks 2-up, filter row becomes
   horizontal scroll/wrap chips, group section headers use the editorial
   uppercase label style, task rows reflow so the chip cluster wraps below
   the title instead of squeezing alongside it.
   ============================================================================= */

/* Page padding */
.inbox-page {
    padding: var(--pad, 14px) !important; /* tightened from 1.5rem; inline rule wins without !important */
}

/* Page header — title + tagline */
.inbox-page .am-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
}

.inbox-page .am-name {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--ink);
}

.inbox-page .am-tagline {
    font-family: var(--sans);
    font-size: 12px;
    color: var(--ink-3);
}

/* "Whoami" / logged-in-as banner — keep readable but tight */
.inbox-page .inbox-whoami {
    font-family: var(--sans);
    font-size: 11px;
    color: var(--ink-3);
    flex-wrap: wrap;
    gap: 4px 8px;
}

.inbox-page .inbox-whoami-warn {
    font-family: var(--sans);
    font-size: 12px;
    padding: 8px 10px;
    max-width: 100%;
}

/* KPI stats strip — 2-up grid per HANDOFF.md §5.2 (mobile-v2.css already
   sets .kpi-grid; this targets the inbox-specific class) */
.inbox-page .inbox-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.inbox-page .inbox-stat {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--rule);
    background: var(--paper-2);
}

.inbox-page .inbox-stat-value {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.1;
}

.inbox-page .inbox-stat-label {
    font-family: var(--sans);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-top: 4px;
}

/* Filter row — wrap cleanly, every control becomes 44px tap target.
   The row's wrapper is an inline-styled <div>; we target its select +
   button children. !important needed to override inline padding/border. */
.inbox-page > div[style*="display:flex"][style*="flex-wrap:wrap"] {
    gap: 8px !important; /* tighter than inline's 10px on small screens */
    margin-bottom: 12px !important;
}

.inbox-page > div[style*="display:flex"][style*="flex-wrap:wrap"] > select,
.inbox-page > div[style*="display:flex"][style*="flex-wrap:wrap"] > button {
    min-height: 44px !important; /* tap target — overrides 6px inline padding */
    padding: 8px 12px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    flex: 1 1 calc(50% - 4px);
    max-width: none !important;
}

/* "View" picker button (multi-user assignee selector) goes full-width */
.inbox-page .inbox-view-picker {
    width: 100%;
    margin-bottom: 8px;
}

.inbox-page .inbox-view-btn {
    width: 100%;
    min-height: 44px;
    min-width: 0;
    justify-content: space-between;
    font-family: var(--sans);
    font-size: 13px;
}

.inbox-page .inbox-view-popover {
    position: fixed;
    left: var(--pad, 14px);
    right: var(--pad, 14px);
    top: 64px;
    bottom: auto;
    width: auto;
    max-height: 70vh;
    overflow-y: auto;
}

/* Bulk action bar — wrap buttons, keep sticky behavior */
.inbox-page .inbox-bulkbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 10px;
}

.inbox-page .inbox-bulkbar button {
    min-height: 36px;
    font-size: 11px;
    padding: 6px 10px;
}

.inbox-page .inbox-bulkbar .ib-spacer {
    display: none;
}

.inbox-page .inbox-bulkbar .ib-count {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
}

/* Group section headers per §5.2 — uppercase 0.14em editorial label */
.inbox-page .inbox-group-header {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 12px 4px 4px;
    margin-top: 12px;
    margin-bottom: 4px;
}

/* Task row — reflow so the chip cluster wraps below the title instead
   of squeezing alongside it on narrow viewports. The right-column div
   has inline `flex-shrink:0` so !important is needed to override. */
.inbox-page .inbox-task-row {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 12px;
    gap: 8px 10px;
    border-radius: 10px;
    background: var(--paper-2);
    min-height: 44px;
}

.inbox-page .inbox-task-row .inbox-row-check {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 4px;
}

/* The priority dot div (2nd child) — keep small + aligned with row */
.inbox-page .inbox-task-row > div[style*="border-radius:50%"] {
    margin-top: 8px;
}

/* The middle column (title + meta) — stretches, ellipsis OK */
.inbox-page .inbox-task-row > div[style*="flex:1"] > div:first-child {
    font-size: 14px !important; /* override inline 0.82rem ≈ 13px */
    line-height: 1.3;
}

.inbox-page .inbox-task-row > div[style*="flex:1"] > div:nth-child(2) {
    font-size: 11px !important;
    flex-wrap: wrap !important;
    gap: 4px 8px !important;
}

/* Right-column chip cluster — wraps to full width below title */
.inbox-page .inbox-task-row > div[style*="flex-shrink:0"]:last-child {
    width: 100% !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    padding-left: 30px; /* align under content, not checkbox */
    gap: 6px !important;
    flex-shrink: 1 !important;
}

/* Chips — slightly tighter for mobile */
.inbox-page .inbox-status-chip,
.inbox-page .inbox-unassigned-chip {
    font-size: 9.5px;
    letter-spacing: 0.14em;
    padding: 3px 8px;
}

.inbox-page .inbox-due-chip {
    font-size: 11px;
}

.inbox-page .inbox-client-pill {
    font-size: 11px;
    padding: 2px 8px;
    max-width: 160px;
}

/* =============================================================================
   MOBILE: clients/results_v2  (PR: mobile/results-v2)
   -----------------------------------------------------------------------------
   Client-facing performance results page (auth + public share view).
   HANDOFF.md doesn't have a dedicated §5.X for this page, so structure follows
   §4 components: tabs §4.3 horizontal scroll, cards §4.5 flat, stat blocks
   §4.6 grid, sheets §4.11 for the share modal.
   ============================================================================= */

/* Report header — stack logo+title from action buttons */
.results-v2 .report-header {
    padding: 16px var(--pad, 14px);
    margin-bottom: 12px;
}

.results-v2 .report-header > .d-flex {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px !important;
}

.results-v2 .report-header h1 {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.1;
}

.results-v2 .report-header p {
    font-family: var(--sans);
    font-size: 12px;
}

.results-v2 .report-logo img {
    height: 32px !important;
}

.results-v2 .report-header .results-back-btn {
    flex: 1;
    min-height: 44px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    justify-content: center;
}

/* Tab nav — horizontal scroll strip per HANDOFF.md §4.3 */
.results-v2 .tab-nav {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0 var(--pad, 14px);
    margin: 0 0 12px;
    border-bottom: 1px solid var(--rule);
}

.results-v2 .tab-nav::-webkit-scrollbar {
    display: none;
}

.results-v2 .tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 12px 14px;
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    border: 0;
    background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    min-height: 44px;
}

.results-v2 .tab-btn.active {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.results-v2 .tab-btn i {
    margin-right: 4px;
    font-size: 13px;
}

/* Results-tabs content area — edge padding */
.results-v2 .results-tabs,
.results-v2 .tab-content {
    padding: 0 var(--pad, 14px);
}

/* Hero section — stack metrics 1-up (or 2-up tight), tighten padding */
.results-v2 .hero-section {
    padding: 16px 14px;
    margin-bottom: 12px;
    border-radius: 10px;
}

.results-v2 .hero-section-content {
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto;
    gap: 12px !important;
    align-items: start !important;
}

.results-v2 .hero-metric {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
}

.results-v2 .hero-metric-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.results-v2 .hero-metric-icon i {
    font-size: 14px;
}

.results-v2 .hero-metric-value {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.05;
}

.results-v2 .hero-metric-label {
    font-family: var(--sans);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.results-v2 .hero-metric-sublabel {
    font-family: var(--sans);
    font-size: 10px;
}

.results-v2 .hero-metric-delta {
    font-family: var(--sans);
    font-size: 10px;
    margin-top: 2px;
}

.results-v2 .hero-chart {
    grid-column: 1 / -1;
    height: 56px;
    margin-top: 4px;
}

.results-v2 .hero-chart-label {
    font-family: var(--sans);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* KPI grid — 2-up on mobile, tighter tiles */
.results-v2 .v2-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-bottom: 12px;
}

.results-v2 .v2-kpi-tile {
    padding: 12px;
    border-radius: 10px;
}

.results-v2 .v2-kpi-value {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.1;
}

.results-v2 .v2-kpi-label {
    font-family: var(--sans);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 4px;
}

.results-v2 .v2-kpi-delta {
    font-family: var(--sans);
    font-size: 10px;
}

/* Widget panels — full-width, tighter padding */
.results-v2 .v2-widget {
    border-radius: 10px;
    margin-bottom: 12px;
}

.results-v2 .v2-widget-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
}

.results-v2 .v2-widget-header h3,
.results-v2 .v2-widget-header h4,
.results-v2 .v2-widget-title {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 500;
}

.results-v2 .v2-widget-body {
    padding: 12px 14px;
}

/* Section divider / title */
.results-v2 .section-divider {
    margin: 16px 0 10px;
}

.results-v2 .section-title {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 500;
}

/* Leads / SEMrush report tab filter row — stack and full-width */
.results-v2 .semrush-report-tab .filter-bar,
.results-v2 .semrush-report-tab .filter-row {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.results-v2 .semrush-report-tab .filter-group {
    width: 100%;
}

.results-v2 .semrush-report-tab .filter-group .btn,
.results-v2 .semrush-report-tab .filter-group select,
.results-v2 .semrush-report-tab .filter-group input {
    width: 100%;
    min-height: 44px;
}

.results-v2 .semrush-report-tab .leads-disclaimer-inline {
    width: 100%;
    margin: 0;
    font-size: 11px;
}

/* Share modal — bottom sheet style per HANDOFF.md §4.11 */
.share-modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
}

.share-modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
}

.share-modal .share-modal-header {
    padding: 14px var(--pad, 14px);
}

.share-modal .share-modal-header h5 {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 500;
    margin: 0;
}

.share-modal .share-modal-body {
    padding: 14px var(--pad, 14px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0) + 24px);
}

.share-modal .share-label {
    font-family: var(--sans);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.share-modal .share-url-group {
    flex-direction: column;
    gap: 8px;
}

.share-modal .share-url-input,
.share-modal .share-copy-btn,
.share-modal .share-btn-generate,
.share-modal .share-btn-regenerate,
.share-modal .share-btn-revoke {
    width: 100%;
    min-height: 44px;
    font-family: var(--sans);
    font-size: 13px;
}

.share-modal .share-actions {
    flex-direction: column;
    gap: 8px;
}

.share-modal .share-expiry-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.share-modal .share-expiry-btn {
    flex: 1;
    min-width: 80px;
    min-height: 44px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* =============================================================================
   MOBILE FIX: sidebar drawer safe-area insets  (PR: fix/mobile-sidebar-safe-area)
   -----------------------------------------------------------------------------
   On iOS the sidebar is fixed/full-height and renders behind the notch (top)
   and home indicator (bottom), clipping the OPT logo and the user-name row.
   Pad the inner header/footer to push content into the safe area.

   max(<existing>, env(...)) preserves the desktop-spec padding on browsers
   without a notch while honoring the inset where it exists.
   ============================================================================= */
.sidebar-header {
    padding-top: max(1.25rem, calc(env(safe-area-inset-top) + 12px));
}

.sidebar-footer {
    padding-bottom: max(0.75rem, calc(env(safe-area-inset-bottom) + 8px));
}

/* =============================================================================
   MOBILE: clients/results (legacy 5-tab report)  (PR: mobile/results-legacy)
   -----------------------------------------------------------------------------
   Legacy client-facing results page with 5 tabs: Overview, WhatConverts, GA4,
   GSC, SEMrush. Shares the .results-page shell + .report-header + tab-nav
   pattern with results_v2 but uses per-tab .wc-*, .ga4-*, .gsc-* class
   namespaces. Tab structure follows HANDOFF.md §4.3; cards §4.5; stat blocks
   §4.6; tables §4.12 scroll-table with sticky first column.
   ============================================================================= */

/* Page wrapper edge padding */
.results-page {
    padding: 0 var(--pad, 14px) calc(env(safe-area-inset-bottom, 0) + 24px);
}

/* Breadcrumb — sans 10.5px uppercase 0.14em per HANDOFF.md §5.7 */
.results-page .breadcrumb {
    font-family: var(--sans);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin: 12px 0 8px;
    padding: 0;
    background: transparent;
    flex-wrap: wrap;
    gap: 4px 6px;
}

.results-page .breadcrumb-item,
.results-page .breadcrumb-item a {
    color: var(--ink-3);
    text-decoration: none;
}

.results-page .breadcrumb-item.active {
    color: var(--ink);
}

/* Report header — stack vertically (mirrors .results-v2 rules) */
.results-page .report-header {
    padding: 14px 0;
    margin-bottom: 12px;
}

.results-page .report-header > .d-flex {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px !important;
}

.results-page .report-header h1 {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.1;
}

.results-page .report-header p {
    font-family: var(--sans);
    font-size: 12px;
}

.results-page .report-header .report-logo img,
.results-page .report-header img[alt*="OPT"] {
    height: 32px !important;
}

.results-page .report-header .results-back-btn,
.results-page .report-header > .d-flex > .d-flex:last-child > .btn {
    flex: 1;
    min-height: 44px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    justify-content: center;
}

/* Tab nav — horizontal scroll strip per HANDOFF.md §4.3 */
.results-page .tab-nav {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 0;
    margin: 0 calc(-1 * var(--pad, 14px)) 12px;
    padding: 0 var(--pad, 14px);
    border-bottom: 1px solid var(--rule);
}

.results-page .tab-nav::-webkit-scrollbar {
    display: none;
}

.results-page .tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 12px 14px;
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    border: 0;
    background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    min-height: 44px;
}

.results-page .tab-btn.active {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.results-page .tab-btn i {
    margin-right: 4px;
    font-size: 13px;
}

/* tab-content / cc-section padding */
.results-page .tab-content {
    padding: 0;
}

.results-page .cc-section {
    padding: 0;
}

/* === OVERVIEW TAB === */

/* .kpi-grid is already 2-up globally in mobile-v2.css (line 881);
   here we polish .kpi-box sizing for this page. */
.results-page .kpi-box {
    padding: 12px;
    border-radius: 10px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    box-shadow: none;
}

.results-page .kpi-box .kpi-value,
.results-page .kpi-box [class*="value"] {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.1;
}

.results-page .kpi-box .kpi-label,
.results-page .kpi-box [class*="label"] {
    font-family: var(--sans);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Two-col chart grid → single column */
.results-page .two-col-grid {
    display: block;
}

.results-page .chart-card {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    box-shadow: none;
}

.results-page .chart-card canvas {
    max-height: 240px;
}

/* === WHATCONVERTS / GA4 / GSC / SEMRUSH SHARED PATTERNS === */

/* Filter bars (wc-filter-bar, unified-filter-bar, ga4-filter-bar) — stack */
.results-page .wc-filter-bar,
.results-page .unified-filter-bar,
.results-page .ga4-filter-bar,
.results-page .gsc-filter-bar,
.results-page .semrush-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.results-page .wc-filter-bar > *,
.results-page .unified-filter-bar > *,
.results-page .ga4-filter-bar > *,
.results-page .gsc-filter-bar > *,
.results-page .semrush-filter-bar > * {
    width: 100%;
    min-width: 0;
}

.results-page .wc-date-picker-group,
.results-page .unified-date-picker-group {
    width: 100%;
}

.results-page .wc-filter-bar select,
.results-page .wc-filter-bar input,
.results-page .wc-filter-bar button,
.results-page .unified-filter-bar select,
.results-page .unified-filter-bar input,
.results-page .unified-filter-bar button {
    width: 100%;
    min-height: 44px;
}

/* KPI grids per tab — force 2-up */
.results-page .wc-kpi-grid,
.results-page .ga4-kpi-grid,
.results-page .gsc-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.results-page .wc-kpi-tile,
.results-page .ga4-kpi-tile,
.results-page .gsc-kpi-tile {
    padding: 12px;
    border-radius: 10px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    box-shadow: none;
}

.results-page .wc-kpi-value,
.results-page .ga4-kpi-value,
.results-page .gsc-kpi-value {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.1;
}

.results-page .wc-kpi-label,
.results-page .ga4-kpi-label,
.results-page .gsc-kpi-label {
    font-family: var(--sans);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 4px;
}

.results-page .wc-kpi-delta,
.results-page .ga4-kpi-delta,
.results-page .gsc-kpi-delta {
    font-family: var(--sans);
    font-size: 10px;
}

/* Chart rows (wc-charts-row, ga4-row, gsc-row) — single column stack */
.results-page .wc-charts-row,
.results-page .ga4-row,
.results-page .gsc-row {
    display: block;
    margin-bottom: 12px;
}

/* Widget containers (wc-widget, ga4-widget, gsc-widget) */
.results-page .wc-widget,
.results-page .ga4-widget,
.results-page .gsc-widget {
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: none;
}

.results-page .wc-widget-header,
.results-page .ga4-widget-header,
.results-page .gsc-widget-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
}

.results-page .wc-widget-title,
.results-page .ga4-widget-title,
.results-page .gsc-widget-title {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 500;
}

.results-page .wc-widget-body,
.results-page .ga4-widget-body,
.results-page .gsc-widget-body {
    padding: 12px 14px;
}

/* Hero rows (gsc-row-hero / gsc-row-full) — keep stacked */
.results-page .gsc-row-hero,
.results-page .gsc-row-full {
    display: block;
}

/* Tables (.wc-table, .cc-table) — horizontal scroll with sticky first col */
.results-page .wc-table-wrapper,
.results-page .cc-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
}

.results-page .wc-table,
.results-page .cc-table {
    font-family: var(--sans);
    font-size: 12px;
    min-width: 600px;
}

.results-page .wc-table thead th,
.results-page .cc-table thead th {
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 10px 12px;
}

.results-page .wc-table tbody td,
.results-page .cc-table tbody td {
    padding: 10px 12px;
}

/* Sticky first column for legacy tables that use a first-col pattern */
.results-page .wc-table thead th:first-child,
.results-page .wc-table tbody td:first-child,
.results-page .cc-table thead th:first-child,
.results-page .cc-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--paper-2);
    box-shadow: 1px 0 0 var(--rule);
    min-width: 140px;
}

/* "Not configured" empty state */
.results-page .not-configured {
    padding: 24px 16px;
    text-align: center;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 10px;
    margin: 12px 0;
    font-family: var(--sans);
    font-size: 13px;
    color: var(--ink-3);
}

.results-page .not-configured h3,
.results-page .not-configured h4 {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--ink);
}

.results-page .not-configured .btn {
    width: 100%;
    min-height: 44px;
    margin-top: 12px;
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* Chart canvas constraints so they reflow */
.results-page canvas {
    max-width: 100% !important;
    height: auto !important;
    max-height: 280px;
}

/* =============================================================================
   MOBILE FIX: viewport-fit=cover companion — topbar safe-area padding
   (PR: fix/mobile-viewport-fit)
   -----------------------------------------------------------------------------
   The earlier sidebar safe-area fix (PR #6) didn't take effect because the
   viewport meta lacked viewport-fit=cover — iOS Safari was returning 0 for
   env(safe-area-inset-*). This PR adds viewport-fit=cover, which means the
   page now extends edge-to-edge UNDER the notch and home indicator.

   With viewport-fit=cover active, every element pinned to the viewport top
   or bottom needs safe-area padding. The sidebar header/footer already got
   theirs in PR #6 (now actually working). The topbar (position: sticky;
   top: 0) needs the same treatment so the hamburger button doesn't sit
   under the notch when the sidebar is closed.
   ============================================================================= */
.topbar {
    padding-top: max(0px, env(safe-area-inset-top));
}

/* =============================================================================
   MOBILE: clients/status (standalone Client Status Ledger page)
   (PR: mobile/client-status-header)
   -----------------------------------------------------------------------------
   The body of this page is wrapped in .status-ledger, so all the Account-Hub
   ledger mobile rules from PR #2 already apply (toolbar stacks, trend tiles
   2-up, table horizontal scroll with sticky first column, drawer rows, etc.).
   The one piece that's unique to this page is its own H1 + subtitle header
   (inline-styled, sized for desktop). This block scopes mobile sizing to it
   without disturbing the Account-Hub-wrapped variant.
   ============================================================================= */

/* The status.html page header is an inline-styled <div> with an H1 + <p>
   subtitle, wrapped directly inside .status-ledger as its first child. We
   target it by being the first child div with a bottom border style. */
.status-ledger > div[style*="border-bottom"]:first-child {
    margin: 0 0 14px !important;
    padding: 0 0 12px !important;
}

.status-ledger > div[style*="border-bottom"]:first-child h1 {
    font-family: var(--serif) !important;
    font-size: 24px !important;
    font-weight: 500 !important;
    line-height: 1.1 !important;
    letter-spacing: -0.01em !important;
}

.status-ledger > div[style*="border-bottom"]:first-child p {
    font-family: var(--sans) !important;
    font-size: 10.5px !important;
    letter-spacing: 0.14em !important;
    margin-top: 6px !important;
}

/* Page-wrapper edge padding so the status table flush-edge rule from PR #2
   visually aligns with the header instead of having different gutters. */
.status-ledger {
    padding-left: var(--pad, 14px);
    padding-right: var(--pad, 14px);
}

/* =============================================================================
   MOBILE FIX: sidebar drawer top + bottom overlap with chrome
   (PR: fix/mobile-sidebar-overlap-and-bottom)
   -----------------------------------------------------------------------------
   User-reported issue (third attempt — earlier fixes targeted the wrong root
   cause):

   1. The page's topbar (hamburger + search + theme toggle) was rendering ON
      TOP of the open sidebar's OPT logo. .sidebar has z-index 1050 and
      .topbar has z-index 100, but stacking-context interactions between the
      sticky topbar and the fixed sidebar produce inconsistent results across
      iOS Safari. Simplest fix: hide the topbar entirely while the drawer is
      open — the drawer IS the nav, the hamburger isn't needed (the chevron
      at sidebar bottom + backdrop tap both close it).

   2. The sidebar footer (user avatar + name) was being clipped by iOS Safari's
      bottom URL bar because .sidebar uses height: 100vh, which on iOS Safari
      is the LARGEST viewport (URL bar collapsed). Fix: 100dvh (dynamic
      viewport height) so the sidebar shrinks while the URL bar is visible
      and the footer stays above it. 100vh fallback for older browsers.
   ============================================================================= */

body.sidebar-open .topbar {
    display: none;
}

.sidebar {
    height: 100vh;
    height: 100dvh;
}

/* =============================================================================
   MOBILE: NO horizontal scrolling, ever
   (PR: mobile/no-horizontal-scroll)
   -----------------------------------------------------------------------------
   User-stated rule: nothing on the mobile site should require horizontal
   scrolling — every column / cell of every page must be reachable by
   VERTICAL scrolling only. Specific bug reported on the All Clients page:
   the data-table headers (Client/Stage/Health/Results/Tenure/Manager/MRR)
   don't fit on a 375px viewport and MRR (rightmost column) was hidden
   behind a horizontal scrollbar.

   Two-layer defense:

   1. Global safety net — html / body / .app-content / .app-main don't
      produce a horizontal scrollbar even if rogue content overflows.
      Uses overflow-x: clip where supported (doesn't create a scroll
      container, preserves position:sticky), falls back to hidden.

   2. Force the All Clients table to card-stack mode regardless of what
      mobile-overhaul.css's `table:not([data-mobile="cards"])` rule
      sets (it sets overflow-x: auto !important, which is what's
      causing the horizontal scroll the user is seeing).
   ============================================================================= */

/* Layer 1: global page-level horizontal scroll prevention.
   IMPORTANT: use overflow-x: clip (not hidden) on body so position:sticky
   on .topbar keeps working. `hidden` creates a scroll container, which
   on iOS Safari makes scroll events fire on body instead of window —
   that breaks the topbar auto-hide JS (window.pageYOffset doesn't update).
   `clip` clips overflow WITHOUT creating a scroll container.
   Safari ≥16 / Chrome ≥90 / Firefox ≥81 (mobile-followup PR).
   Falls back to hidden on older browsers. */
html,
body {
    overflow-x: hidden;   /* fallback for browsers without `clip` */
    overflow-x: clip;     /* preserve position:sticky + window scroll */
}

.app-content,
.app-main,
.app-main > main {
    overflow-x: hidden;   /* fallback */
    overflow-x: clip;     /* preserve position:sticky */
    max-width: 100vw;
}

/* Layer 2: force the All Clients table into card-stack layout.
   The page's inline @media block tries to do this already but loses to
   mobile-overhaul.css's `table:not([data-mobile="cards"])` rule that has
   !important on overflow-x: auto. These rules use !important + higher
   specificity to win. */
.am-clients-section .status-table,
.am-clients-section .status-table-wrapper {
    overflow-x: hidden !important;
    overflow-y: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.am-clients-section .status-table {
    display: block !important;
    border: 0 !important;
}

.am-clients-section .status-table thead {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.am-clients-section .status-table tbody {
    display: block !important;
    width: 100% !important;
}

.am-clients-section .status-table tr.client-row {
    display: block !important;
    width: 100% !important;
    padding: 12px 14px !important;
    margin-bottom: 8px !important;
    border: 1px solid var(--rule) !important;
    border-radius: 10px !important;
    background: var(--paper-2) !important;
}

.am-clients-section .status-table tr.client-row > td {
    display: block !important;
    width: 100% !important;
    padding: 4px 0 !important;
    border: 0 !important;
    text-align: left !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Show the column header above each cell on mobile (data-label is set on
   every td in clients/index.html template). */
.am-clients-section .status-table tr.client-row > td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--sans);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 2px;
}

/* Hide the bulk-select checkbox column on mobile (admin-only feature
   that doesn't translate to card layout cleanly). */
.am-clients-section .status-table tr.client-row > td.col-bulk {
    display: none !important;
}

/* Client name cell gets emphasis as the card title */
.am-clients-section .status-table tr.client-row > td.col-client::before {
    display: none !important; /* skip the "CLIENT" label — name itself is title */
}

.am-clients-section .status-table tr.client-row > td.col-client {
    margin-bottom: 6px;
}

.am-clients-section .status-table tr.client-row > td.col-client .client-name {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

/* =============================================================================
   MOBILE: clients/index — compact metric grid inside each card
   -----------------------------------------------------------------------------
   Per HANDOFF.md §5.3 (All Clients = card list) + §4 component patterns:
   editorial card with small-caps label-above-value cells laid out in a tight
   3-col × 2-row grid (Stage / Health / Results, then Tenure / Manager / MRR).
   PR #14 stacked every cell as its own row which made cards too tall. This
   keeps the same data-label::before label trick but flips the row container
   into CSS grid so the 6 metric cells sit side-by-side.

   DOM order inside tr.client-row (after .col-bulk admin checkbox):
     1. .col-client         (full-width header — name + meta)
     2. td.text-center      data-label="Stage"
     3. td.col-health       data-label="Health"
     4. td.col-results      data-label="Results"
     5. td.col-tenure       data-label="Tenure"
     6. td                  data-label="Manager"
     7. td.col-mrr          data-label="MRR" (admin only — only 5 metrics for non-admin)
   ============================================================================= */

    /* Flip the row into a 3-col grid. Override PR #14's `display: block`. */
    .am-clients-section .status-table tr.client-row {
        display: grid !important; /* override PR #14 display:block !important */
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: 10px;
        row-gap: 10px;
        align-items: start;
    }

    /* All metric cells default to a single grid track (1/3 of the row). */
    .am-clients-section .status-table tr.client-row > td {
        display: block !important; /* keep block formatting context inside the grid cell */
        padding: 0 !important;     /* gap handles spacing now */
        min-width: 0 !important;   /* allow ellipsis inside grid tracks */
        max-width: 100% !important;
        overflow: hidden;
    }

    /* Client name cell spans the full row (acts as card header). */
    .am-clients-section .status-table tr.client-row > td.col-client {
        grid-column: 1 / -1;
        margin-bottom: 2px; /* small visual break before the metric grid */
    }

    /* Compact label-above-value pattern for the 6 metric cells.
       HANDOFF.md §2: labels = sans 9.5px uppercase letter-spacing 0.14em, muted. */
    .am-clients-section .status-table tr.client-row > td[data-label]:not(.col-client)::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-faint);
        margin-bottom: 4px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Value text: sans 13px, slightly muted body color, single-line ellipsis so
       long manager names / big MRR numbers never blow out the track. */
    .am-clients-section .status-table tr.client-row > td[data-label]:not(.col-client) {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 500;
        color: var(--ink-body);
        line-height: 1.25;
        text-align: left !important; /* override inline style="text-align:center" on Stage/Health/Results/Tenure */
    }

    /* Inline-styled inner spans on Tenure/Manager need the muted body color
       applied at the cell level — the templates hard-code color via style="" so
       we let those tokens through but normalize size. */
    .am-clients-section .status-table tr.client-row > td.col-tenure,
    .am-clients-section .status-table tr.client-row > td[data-label="Manager"] {
        font-size: 13px !important; /* override inline style="font-size:0.78rem" */
        color: var(--ink-body) !important; /* override inline color: var(--ink-muted)/--ink-faint */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* MRR is the most important right-side metric — keep it tabular and strong. */
    .am-clients-section .status-table tr.client-row > td.col-mrr strong {
        font-size: 13px;
        font-variant-numeric: tabular-nums;
    }

    /* Score dots (Health / Results) — make sure they sit left-aligned within
       their cell now that the cell itself is left-aligned, and don't inherit
       the larger desktop sizing. */
    .am-clients-section .status-table tr.client-row > td.col-health .score-dot,
    .am-clients-section .status-table tr.client-row > td.col-results .score-dot {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 24px;
        height: 22px;
        padding: 0 6px;
        font-size: 12px;
        font-weight: 600;
    }

    /* Stage pill — keep compact, no wrap. */
    .am-clients-section .status-table tr.client-row > td[data-label="Stage"] .stage-pill {
        display: inline-block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
    }

    /* =========================================================================
       PR #15 follow-up — fix horizontal scroll regression.
       PR #14 set `width: 100% !important` on every <td> so each cell took the
       full row in its block-stack layout. PR #15 flipped <tr> to display:grid
       but did NOT override that width: 100% — so each grid item still demanded
       full row width, causing the row to overflow horizontally (cells pushed
       off the right edge; Health/Results disappeared from initial viewport).
       This rule lets the grid tracks (1fr each) actually determine cell width.
       ========================================================================= */
    .am-clients-section .status-table tr.client-row > td {
        width: auto !important;        /* override PR #14 width: 100% */
        box-sizing: border-box !important;
    }

    /* Belt-and-braces: the table/tbody must never exceed the viewport. */
    .am-clients-section .status-table,
    .am-clients-section .status-table > tbody {
        box-sizing: border-box !important;
        table-layout: auto !important;
        min-width: 0 !important;
    }

    /* Tighten card padding so 3 grid tracks have more room at 360px. */
    .am-clients-section .status-table tr.client-row {
        padding: 10px 12px !important; /* PR #14 used 12px 14px */
        column-gap: 8px !important;    /* PR #15 used 10px */
        row-gap: 8px !important;
    }

    /* =============================================================================
       MOBILE: company/account_hub.html + _ledger_tab.html + _activity_tab.html
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5.5 — Account Hub on mobile is a card-style client list with
       Health/Results scores + last-note date + note icon button. Replaces the
       desktop wide table + 3-pane sidebar/main/stats layout. No horizontal scroll.
       Reuses the All Clients card-stack pattern (PR #15 lessons applied: cells
       get `width: auto` so the grid tracks can shrink to viewport).
       ============================================================================= */

    /* ── Page header tweaks: kill bleed and tighten ───────────────────────── */
    .acc-pageheader {
        margin-left: 12px;
        margin-right: 12px;
    }

    /* The page-level inline @media rule already stacks .acc-pageheader at 768px,
       but on tiny phones we want the title to sit a touch tighter. */
    .acc-pageheader__title {
        font-size: 26px;
    }

    /* Problem-clients stats strip: stack the metric pills + action links on
       narrow widths. Already wraps via existing rule; tighten link spacing. */
    .acc-stats-strip {
        margin-left: 12px;
        margin-right: 12px;
    }
    .acc-stats-strip__link {
        min-height: 32px;
        display: inline-flex;
        align-items: center;
    }

    /* ─────────────────────────────────────────────────────────────────────────
       LEDGER TAB — table → card-stack
       The desktop table (.status-table.sl-table) has 7–8 columns and currently
       overflows horizontally inside .status-table-wrapper (overflow-x: auto +
       min-width: 720px in the existing mobile rule at line ~1686). Override:
       flatten each <tr.sl-row> to a card; lay out the cells in a small grid;
       hide the <thead>. Drawer row (.sl-drawer-row) becomes inline content
       under its parent card.
       ───────────────────────────────────────────────────────────────────────── */

    /* Kill the horizontal scroll wrapper — convert to a vertical card stack. */
    .status-ledger .status-table-wrapper,
    .status-ledger .cc-table-scroll {
        overflow-x: visible;
        margin: 0;
        border: 0;
        background: transparent;
        border-radius: 0;
    }

    .status-ledger .status-table,
    .status-ledger .sl-table {
        display: block;
        width: 100%;
        min-width: 0;            /* override the 720px set earlier */
        border-collapse: separate;
        font-family: var(--sans);
    }

    /* Hide the table head — labels go inline via ::before. */
    .status-ledger .status-table thead,
    .status-ledger .sl-table thead {
        display: none;
    }

    .status-ledger .status-table tbody,
    .status-ledger .sl-table tbody {
        display: block;
        width: 100%;
    }

    /* Each client row is a card. Grid: 1st row = name (full), 2nd row = stage +
       health + results, 3rd row = last-note date + contact + notes-toggle + save. */
    .status-ledger .status-table tbody tr.sl-row,
    .status-ledger .sl-table tbody tr.sl-row {
        display: grid;
        grid-template-columns: 1fr auto auto auto auto;
        column-gap: 8px;
        row-gap: 8px;
        align-items: center;
        padding: 12px 14px;
        margin: 0 0 10px 0;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        animation: none;         /* desktop has fade-in keyframes — drop on mobile */
    }

    /* All <td>s become block / contents; reset desktop widths so grid wins. */
    .status-ledger .status-table tbody tr.sl-row > td,
    .status-ledger .sl-table tbody tr.sl-row > td {
        display: block;
        width: auto;             /* prevent any inherited width: 100% from re-triggering overflow */
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0;
        border: 0;
        background: transparent;
        white-space: normal;
    }

    /* Client cell spans the full first row */
    .status-ledger .status-table tbody tr.sl-row > td.col-client,
    .status-ledger .sl-table tbody tr.sl-row > td.col-client {
        grid-column: 1 / -1;
        min-width: 0;
    }
    .status-ledger .client-cell {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }
    .status-ledger .client-cell .client-name {
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 600;
        color: var(--ink);
        line-height: 1.25;
        text-decoration: none;
        word-break: break-word;
    }
    .status-ledger .client-cell .client-meta {
        font-size: 11px;
        color: var(--ink-3);
        line-height: 1.3;
    }

    /* Stage (pill) sits on row 2 col 1; pill compact */
    .status-ledger .status-table tbody tr.sl-row > td.col-stage,
    .status-ledger .sl-table tbody tr.sl-row > td.col-stage {
        grid-column: 1 / 2;
        grid-row: 2;
        justify-self: start;
    }
    .status-ledger .status-table tbody tr.sl-row > td.col-stage .stage-pill {
        font-size: 9.5px;
        letter-spacing: 0.14em;
        padding: 3px 8px;
    }

    /* Health + Results on row 2 right side */
    .status-ledger .status-table tbody tr.sl-row > td.col-health,
    .status-ledger .sl-table tbody tr.sl-row > td.col-health {
        grid-column: 2 / 3;
        grid-row: 2;
        justify-self: end;
    }
    .status-ledger .status-table tbody tr.sl-row > td.col-results,
    .status-ledger .sl-table tbody tr.sl-row > td.col-results {
        grid-column: 3 / 4;
        grid-row: 2;
        justify-self: end;
    }
    /* Tiny eyebrow labels for the score chips so they're readable without a thead */
    .status-ledger .status-table tbody tr.sl-row > td.col-health::before,
    .status-ledger .sl-table tbody tr.sl-row > td.col-health::before {
        content: "Health";
        display: block;
        font-size: 9px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
        text-align: center;
    }
    .status-ledger .status-table tbody tr.sl-row > td.col-results::before,
    .status-ledger .sl-table tbody tr.sl-row > td.col-results::before {
        content: "Results";
        display: block;
        font-size: 9px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
        text-align: center;
    }

    .status-ledger .status-table tbody tr.sl-row .score-dot {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 28px;
        height: 24px;
        padding: 0 7px;
        font-size: 12px;
        font-weight: 600;
        border-radius: 6px;
    }

    /* Row 3 — date + contacted + notes-toggle + save action */
    .status-ledger .status-table tbody tr.sl-row > td.col-last-note,
    .status-ledger .sl-table tbody tr.sl-row > td.col-last-note {
        grid-column: 1 / 3;
        grid-row: 3;
        font-size: 11px;
        color: var(--ink-3);
        align-self: center;
    }
    .status-ledger .status-table tbody tr.sl-row > td.col-last-note::before,
    .status-ledger .sl-table tbody tr.sl-row > td.col-last-note::before {
        content: "Last note ";
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }

    .status-ledger .status-table tbody tr.sl-row > td.col-contacted,
    .status-ledger .sl-table tbody tr.sl-row > td.col-contacted {
        grid-column: 3 / 4;
        grid-row: 3;
        justify-self: end;
        align-self: center;
    }

    .status-ledger .status-table tbody tr.sl-row > td.col-notes-toggle,
    .status-ledger .sl-table tbody tr.sl-row > td.col-notes-toggle {
        grid-column: 4 / 5;
        grid-row: 3;
        justify-self: end;
        align-self: center;
    }

    .status-ledger .status-table tbody tr.sl-row > td.col-actions,
    .status-ledger .sl-table tbody tr.sl-row > td.col-actions {
        grid-column: 5 / 6;
        grid-row: 3;
        justify-self: end;
        align-self: center;
    }

    /* Make the notes-toggle and save buttons real tap targets (44×44 not strict —
       they sit side by side; 36px tall is acceptable per HANDOFF.md tap target
       guidance when stacked horizontally with adequate spacing). */
    .status-ledger .sl-notes-toggle,
    .status-ledger .sl-save-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 6px 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        font-size: 12px;
    }

    /* Drawer row — full-width inside the card stack. The sl-drawer-row sits as
       a separate <tr> after each sl-row; flip to block so it appears below. */
    .status-ledger .sl-drawer-row {
        display: block;
        margin: -10px 0 10px 0;   /* tuck under the card above */
    }
    .status-ledger .sl-drawer-row .sl-drawer-cell {
        display: block;
        width: 100%;
        padding: 0;
        border: 0;
        background: transparent;
    }
    .status-ledger .sl-drawer-inner {
        padding: 12px 14px;
        background: var(--paper-3);
        border: 1px solid var(--rule);
        border-top: 0;
        border-radius: 0 0 10px 10px;
    }
    .status-ledger .sl-drawer-textarea {
        width: 100%;
        font-size: 14px;          /* 16px would be ideal to stop iOS zoom; 14px matches OPT density */
        min-height: 80px;
        padding: 8px 10px;
    }

    /* Trend row tweaks — the two tone tiles stack to a 2-up grid, full-width */
    .status-ledger .sl-trend-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin: 12px 0;
    }
    .status-ledger .sl-trend-tile {
        padding: 10px 12px;
    }
    .status-ledger .sl-trend-spacer { display: none; }
    .status-ledger .sl-results-meta {
        grid-column: 1 / -1;
        font-size: 11px;
        color: var(--ink-3);
        text-align: center;
    }

    /* Generate All Summaries button — full-width on mobile per HANDOFF.md §5.5 */
    .status-ledger .sl-toolbar-cell--push {
        align-self: stretch;
    }
    .status-ledger .sl-btn-primary {
        width: 100%;
        min-height: 44px;
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        border-radius: 6px;
    }

    /* ─────────────────────────────────────────────────────────────────────────
       ACTIVITY TAB — 3-pane (sidebar/main/stats) → single-column scrolling
       The desktop layout uses .ah-layout { display: flex; height: calc(100vh - 220px) }.
       Below 600px the inline template @media already hides .ah-sidebar; we need
       to also unlock the fixed height + show a "Clients" jump-shortcut, and
       reflow the comm-item rows (which are inline-flex with fixed widths on
       desktop) into card stacks.
       ───────────────────────────────────────────────────────────────────────── */

    /* Container: drop the fixed viewport-height + flex layout; let content flow. */
    .ah-layout {
        display: block;
        height: auto;
        max-height: none;
        overflow: visible;
    }
    .ah-main {
        display: block;
        max-height: none;
        overflow: visible;
        min-width: 0;
    }
    /* Sidebar hidden on mobile (matches the inline @media at 600px); keep it
       hidden across 360–767. The client filter lives in the existing #ahClientLabel
       chip + the bulk-bar's "Assign to client" select. */
    .ah-sidebar {
        display: none;
    }

    /* Auto-match details panel — keep readable inside a card */
    .ah-automatch {
        margin: 8px 12px 12px;
        border-radius: 10px;
    }
    .ah-automatch__summary {
        padding: 10px 12px;
        font-size: 12px;
        gap: 8px;
    }
    .ah-automatch__row {
        display: grid;
        grid-template-columns: 1fr auto;
        column-gap: 8px;
        row-gap: 4px;
        padding: 10px 12px;
        align-items: center;
    }
    .ah-automatch__row .ah-am-name {
        grid-column: 1 / 2;
        font-size: 13px;
        font-weight: 600;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .ah-automatch__row .ah-am-phone {
        grid-column: 1 / 2;
        grid-row: 2;
        font-size: 11px;
        color: var(--ink-3);
    }
    .ah-automatch__row .ah-am-count {
        grid-column: 2 / 3;
        grid-row: 1;
        font-size: 10px;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        white-space: nowrap;
    }
    .ah-automatch__row button.ah-am-apply {
        grid-column: 2 / 3;
        grid-row: 2;
        min-height: 32px;
        padding: 6px 12px;
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        border-radius: 6px;
    }
    .ah-automatch__footer {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
        font-size: 11px;
    }
    .ah-automatch__footer button {
        width: 100%;
        min-height: 40px;
    }

    /* Assigned/Unassigned segmented filter — equal columns, full width */
    .ah-asgn-filter {
        display: flex;
        gap: 4px;
        padding: 4px;
        margin: 8px 12px 0;
    }
    .ah-asgn-seg {
        flex: 1;
        min-height: 40px;
        justify-content: center;
        font-size: 12px;
    }

    /* Channel tabs — horizontal scroll strip (the one place HANDOFF.md §11
       explicitly permits horizontal scroll). Override the desktop's flex-wrap
       so they don't stack to 4 rows on phones. */
    .ah-main .comms-channels {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 12px;
        padding: 4px;
        gap: 4px;
        border-radius: 10px;
    }
    .ah-main .comms-channels::-webkit-scrollbar { display: none; }
    .ah-main .comms-channel-tab {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }
    /* The "Action Items" tab uses margin-left:auto on desktop to pin right;
       drop that on mobile so the strip scrolls naturally. */
    .ah-main .comms-channels > .comms-channel-tab[onclick*="showActionItems"] {
        margin-left: 0;
    }

    /* Search/sentiment toolbar — stack and widen inputs */
    .ah-main > div[style*="padding: 8px 20px"] {
        padding: 8px 12px;
        gap: 8px;
    }
    .ah-main #commSearch {
        max-width: none;
        width: 100%;
        min-height: 40px;
    }
    .ah-main #sentimentFilter {
        width: 100%;
        min-height: 40px;
    }

    /* Bulk action bar */
    .bulk-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
        margin: 4px 12px;
    }
    .bulk-bar #bulkAssignClient {
        width: 100%;
    }

    /* ── Comm item → card. Desktop uses inline flex with hard-coded min/max
       widths on the inner divs; on mobile we treat the row as a card stack. ── */
    .comm-item {
        margin: 8px 12px;
        border-radius: 10px;
        border: 1px solid var(--rule);
        background: var(--paper-2);
        overflow: hidden;
    }
    .comm-item::after { display: none; }       /* drop the desktop gradient hairline */

    /* The clickable row inside .comm-item — desktop sets:
       padding: 14px 20px; display: flex; align-items: center; gap: 14px;
       and the children have explicit min-width/width. Convert to a 2-row grid:
       row 1 = client/number (full), row 2 = type pill + summary + date + chev. */
    .comm-item > div[onclick*="toggleCommDetail"] {
        display: grid;
        grid-template-columns: 18px 1fr auto;   /* checkbox · main · chevron */
        column-gap: 10px;
        row-gap: 6px;
        padding: 12px 14px;
        align-items: center;
    }
    /* Checkbox cell stays small on row 1 col 1 */
    .comm-item > div[onclick*="toggleCommDetail"] > div:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 1;
    }
    /* Client name / number block goes full width on row 1 col 2 */
    .comm-item > div[onclick*="toggleCommDetail"] > div:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1;
        min-width: 0 !important;        /* override inline min-width: 150px */
        max-width: none !important;     /* override inline max-width: 320px */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Type pill — row 2 col 1-2 (left), forced to auto width */
    .comm-item > div[onclick*="toggleCommDetail"] > div:nth-child(3) {
        grid-column: 1 / 3;
        grid-row: 2;
        width: auto !important;         /* override inline width: 70px */
        font-size: 11px !important;
    }
    /* Summary line — row 3 spans cols 1-2; full-width text */
    .comm-item > div[onclick*="toggleCommDetail"] > div:nth-child(4) {
        grid-column: 1 / 3;
        grid-row: 3;
        font-size: 12px !important;
        min-width: 0;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        display: block !important;
        line-height: 1.4;
    }
    /* Date / duration — row 2 col 3 */
    .comm-item > div[onclick*="toggleCommDetail"] > div:nth-child(5) {
        grid-column: 3 / 4;
        grid-row: 2;
        width: auto !important;         /* override inline width: 55px */
        text-align: right;
        font-size: 10.5px !important;
    }
    /* Chevron — row 1 col 3 */
    .comm-item > div[onclick*="toggleCommDetail"] > .comm-chevron {
        grid-column: 3 / 4;
        grid-row: 1;
        align-self: center;
    }

    /* Suggestion chip — wrap so the "Confirm" button doesn't push off-screen */
    .ah-suggestion-chip {
        flex-wrap: wrap;
        margin-left: 6px;
        font-size: 10.5px;
    }
    .ah-suggestion-chip button {
        font-size: 10.5px;
    }

    /* Comm detail open state — limit max-height + kill horizontal scroll */
    .comm-detail.open {
        max-height: none;
        overflow-x: visible;
        padding: 0 14px 16px !important;
    }
    .comm-detail audio { width: 100%; }
    .text-bubble {
        max-width: 88%;
        font-size: 13px;
    }

    /* ── Action Items panel (the second view inside .ah-main) ───────────────
       Three tables (Needs Review, In Progress, Completed) each get the
       card-stack treatment. Tables have hard-coded TH widths via inline style,
       which we leave alone — display:block on the table strips them out. */
    #actionItemsPanel {
        padding: 14px 12px !important;
    }

    /* KPI strip at top: was flex with 100px min-width per tile → 2-col grid */
    #actionItemsPanel > div.nx-stagger-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
        margin-bottom: 14px !important;
    }
    #actionItemsPanel > div.nx-stagger-grid > .nx-stat-card {
        min-width: 0 !important;
        padding: 10px 12px !important;
        border-radius: 10px;
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left;
        gap: 2px !important;
    }

    /* Tables inside cc-panel: flatten thead, card-stack each row */
    #actionItemsPanel .table-responsive {
        max-height: none !important;
        overflow: visible !important;
    }
    #actionItemsPanel .opt-table {
        display: block;
        width: 100%;
        min-width: 0;
    }
    #actionItemsPanel .opt-table thead { display: none; }
    #actionItemsPanel .opt-table tbody { display: block; width: 100%; }
    #actionItemsPanel .opt-table tbody tr {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 8px;
        row-gap: 6px;
        padding: 10px 12px;
        margin: 0 0 8px 0;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
    }
    #actionItemsPanel .opt-table tbody tr > td {
        display: block;
        width: auto !important;       /* override inline width: 65px / 90px / 130px / 200px */
        max-width: 100%;
        padding: 0 !important;        /* override inline padding: 12px 8px */
        border: 0;
        background: transparent;
        font-size: 12px;
    }
    /* First two cells (priority + title) sit on row 1: priority left, title right-flex */
    #actionItemsPanel .opt-table tbody tr > td:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 1;
    }
    #actionItemsPanel .opt-table tbody tr > td:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1;
        min-width: 0;
    }
    /* Remaining cells stack full-width below */
    #actionItemsPanel .opt-table tbody tr > td:nth-child(n+3) {
        grid-column: 1 / -1;
    }
    /* The action buttons row (last cell in Needs Review) — wrap */
    #actionItemsPanel .opt-table tbody tr > td > div[style*="display: flex"] {
        flex-wrap: wrap;
        gap: 6px;
    }
    #actionItemsPanel .opt-table .ai-assignee-sel {
        width: 100% !important;       /* override inline 100px */
        min-height: 36px;
        font-size: 12px !important;
    }
    /* Hide the muted description preview to save vertical space at 360px;
       full text is in the source row + visible after expand on desktop. */
    #actionItemsPanel .opt-table tbody tr > td:nth-child(2) > div.text-muted {
        display: none;
    }

    /* Sticky-top thead hint is harmless when thead is display:none, but the
       cc-panel-header bars are clutter at narrow widths — keep them, just pad. */
    #actionItemsPanel .cc-panel-header {
        padding: 8px 4px;
        font-size: 12px;
    }

    /* Gmail sync strip above auto-match — keep on a single line, allow wrap */
    .am-dashboard.company-dashboard > div[style*="justify-content:flex-end"] {
        flex-wrap: wrap;
        gap: 8px !important;
        margin: 0 12px !important;
        padding-top: 8px !important;
    }

    /* ─────────────────────────────────────────────────────────────────────────
       Problem-drawer modals (_problem_drawer.html) — Bootstrap modals already
       size sanely on phones, but the embedded log-history <table> can overflow.
       Allow horizontal scroll inside the modal body (acceptable per HANDOFF
       §11 — modals are explicit scroll containers).
       ───────────────────────────────────────────────────────────────────────── */
    #logHistoryBody {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #logHistoryBody .status-table {
        min-width: 480px;          /* lets columns keep readable widths */
        font-size: 12px;
    }

    /* =============================================================================
       MOBILE: clients/ga4_report  (PR: mobile/no-horizontal-scroll)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5 (per-page card-stack pattern) and §11 (no overflow-x:auto
       on page content). GA4 analytics report has 4 wide tables (channel, landing
       pages, geo, device) and several Chart.js canvases. Convert each table to a
       card-stack with data-label pseudo-elements; cap canvas heights; tighten KPI
       tiles + filter bar + card-header search to keep 360px viewport clean.

       CRITICAL: every <tr> flipped to display:grid is paired with td { width:auto;
       box-sizing:border-box } to prevent re-introduced horizontal scroll (see
       lesson from PRs #15/#17/#19).
       ============================================================================= */

    /* Page wrapper — tighten gutters at narrow widths so cards reach edge-to-edge
       within the existing 16px horizontal padding from base. Desktop sets 1rem. */
    .ga4-report-page {
        padding: 0 12px 24px;
        max-width: 100%;
        overflow-x: hidden;        /* belt-and-suspenders against rogue children */
    }

    /* Header bar — stack title + property id, keep back-button touch target ≥44px */
    .ga4-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 0;
    }
    .ga4-header-left {
        flex: 1 1 100%;
        min-width: 0;
    }
    .ga4-header-title h1 {
        font-size: 22px;
        line-height: 1.2;
    }
    .ga4-header-title {
        min-width: 0;
        flex: 1;
    }
    .ga4-client-name {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        max-width: 100%;
    }
    .ga4-header-right {
        flex: 1 1 100%;
    }
    .ga4-property-id {
        font-size: 11px;
        word-break: break-all;     /* property IDs are long numeric strings */
        display: inline-block;
        max-width: 100%;
    }
    .ga4-back-btn {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Filter bar — desktop @media already stacks left/right groups; tighten gaps
       and make selects/buttons full-width for finger-friendly tap targets. */
    .ga4-filter-bar {
        gap: 10px;
        padding: 12px 0;
    }
    .ga4-filters-left,
    .ga4-filters-right {
        gap: 10px;
        width: 100%;
    }
    .ga4-filter-group {
        width: 100%;
        min-width: 0;
    }
    .ga4-filter-select {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }
    .ga4-apply-btn {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }
    /* Date-range-picker container — JS-rendered, force-constrain its width */
    .ga4-filter-group .date-range-picker-container,
    .ga4-filter-group .date-range-picker-container > * {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* KPI tiles — desktop mobile rule sets repeat(2, 1fr); tighten paddings + font
       so 360px width fits comfortably; ensure long numbers wrap rather than scroll. */
    .ga4-kpi-row {
        gap: 8px;
    }
    .ga4-kpi-tile {
        padding: 10px 12px;
        min-width: 0;
    }
    .ga4-kpi-label {
        font-size: 10px;
        letter-spacing: 0.04em;
        margin-bottom: 4px;
    }
    .ga4-kpi-value {
        font-size: 20px;
        word-break: break-word;
        line-height: 1.15;
    }
    .ga4-kpi-compare,
    .ga4-kpi-delta {
        font-size: 10px;
        word-break: break-word;
    }

    /* Charts rows — desktop @media (max-width:1200px) already collapses to 1fr.
       Ensure cards never exceed viewport + cap canvas heights so phones don't get
       a 600px-tall blank chart while loading. */
    .ga4-charts-row {
        gap: 12px;
        min-width: 0;
    }
    .ga4-card {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;          /* contain inner table/chart overflow */
    }
    .ga4-card-body {
        padding: 12px;
        min-height: 0;             /* desktop sets 180px which wastes space */
        overflow: hidden;
    }
    .ga4-card-body canvas {
        max-height: 220px;
        max-width: 100% !important; /* override style.css's inline-style-style canvas sizing */
    }

    /* Card header — search input was 180px fixed; let it flow under the title on
       phones, full-width. */
    .ga4-card-header {
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 8px;
    }
    .ga4-card-header > span {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .ga4-card-header .ga4-search-input {
        width: 100%;
        margin-left: 0;
        flex: 1 1 100%;
        min-height: 40px;
        font-size: 14px;
    }

    /* Donut layout — desktop @media already sets flex-direction:column; cap canvas
       so it doesn't dominate the card, and let legend wrap. */
    .ga4-donut-container {
        min-height: 0;
    }
    .ga4-donut-wrapper {
        gap: 12px;
        align-items: stretch;
    }
    .ga4-donut-wrapper canvas {
        max-width: 160px !important;
        max-height: 160px !important;
        align-self: center;
    }
    .ga4-donut-legend {
        width: 100%;
    }
    .ga4-legend-item {
        font-size: 13px;
        gap: 8px;
        flex-wrap: wrap;
    }
    .ga4-legend-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* =============================================
       Tables → card-stack pattern.
       Kill the desktop overflow-x:auto + sticky thead.
       Each <tr> becomes a stacked card; each <td>
       gets a label via data-label (set inline by JS
       OR — since we can't edit JS — we use ::before
       with hard-coded labels matching the desktop
       <th> order. Apply per-table via :nth-child().
       ============================================= */

    /* Kill horizontal scroll on the wrappers */
    .ga4-report-page .ga4-table-wrapper {
        overflow-x: visible;
        overflow-y: visible;
        max-height: none;          /* desktop sets 320px scroll cap */
        width: 100%;
    }
    .ga4-report-page .ga4-table-scroll {
        max-height: none;
        overflow: visible;
    }

    /* Base: flatten table + hide thead */
    .ga4-report-page .ga4-table {
        display: block;
        width: 100%;
        font-size: 13px;
        border-collapse: collapse;
    }
    .ga4-report-page .ga4-table thead {
        display: none;             /* labels come from ::before pseudo-elements */
    }
    .ga4-report-page .ga4-table tbody {
        display: block;
        width: 100%;
    }
    .ga4-report-page .ga4-table tbody tr {
        display: block;
        width: 100%;
        margin-bottom: 10px;
        padding: 10px 12px;
        background: var(--paper, var(--bg-0));
        border: 1px solid var(--rule, rgba(0,0,0,0.08));
        border-radius: 10px;
        box-sizing: border-box;
    }
    .ga4-report-page .ga4-table tbody tr:last-child {
        margin-bottom: 0;
    }
    .ga4-report-page .ga4-table tbody tr:hover {
        background: var(--paper, var(--bg-0));  /* kill desktop hover row tint */
    }
    .ga4-report-page .ga4-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        width: auto !important;    /* CRITICAL: grid items demand row width without this */
        box-sizing: border-box;
        padding: 6px 0;
        border-bottom: 1px solid var(--rule, rgba(0,0,0,0.04));
        white-space: normal;
        word-break: break-word;
        min-width: 0;
    }
    .ga4-report-page .ga4-table tbody tr td:last-child {
        border-bottom: none;
    }
    .ga4-report-page .ga4-table tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--ink-3, var(--text-tertiary));
        margin-right: 8px;
        min-width: 90px;
    }

    /* Per-table column labels via nth-child — applied to the *first cell rule*
       so we can label without touching JS-generated markup. */

    /* Channel breakdown (#channelTable): Channel | Users | New Users | Sessions | Bounce Rate | Key Events */
    #channelTable tbody tr td:nth-child(1)::before { content: "Channel"; }
    #channelTable tbody tr td:nth-child(2)::before { content: "Users"; }
    #channelTable tbody tr td:nth-child(3)::before { content: "New Users"; }
    #channelTable tbody tr td:nth-child(4)::before { content: "Sessions"; }
    #channelTable tbody tr td:nth-child(5)::before { content: "Bounce Rate"; }
    #channelTable tbody tr td:nth-child(6)::before { content: "Key Events"; }
    #channelTable tbody tr td:nth-child(1) {
        /* First col is the channel name; give it prominence */
        font-weight: 600;
        font-size: 14px;
        padding-bottom: 8px;
    }
    #channelTable tbody tr td:nth-child(1)::before {
        display: none;             /* name is self-evident as card heading */
    }

    /* Landing pages (#landingPagesTable):
       Page | Users | New Users | Sessions | Views | Avg Duration | Bounce Rate | Key Events */
    #landingPagesTable tbody tr td:nth-child(1)::before { content: "Page"; display: none; }
    #landingPagesTable tbody tr td:nth-child(2)::before { content: "Users"; }
    #landingPagesTable tbody tr td:nth-child(3)::before { content: "New Users"; }
    #landingPagesTable tbody tr td:nth-child(4)::before { content: "Sessions"; }
    #landingPagesTable tbody tr td:nth-child(5)::before { content: "Views"; }
    #landingPagesTable tbody tr td:nth-child(6)::before { content: "Avg Duration"; }
    #landingPagesTable tbody tr td:nth-child(7)::before { content: "Bounce Rate"; }
    #landingPagesTable tbody tr td:nth-child(8)::before { content: "Key Events"; }
    /* First cell — page URL: full-width, wrappable, no ellipsis at phone widths */
    #landingPagesTable tbody tr td.ga4-page-cell,
    #landingPagesTable tbody tr td:nth-child(1) {
        display: block;
        max-width: 100%;
        white-space: normal;
        word-break: break-all;     /* URLs can be very long */
        overflow: visible;
        text-overflow: clip;
        font-weight: 600;
        font-size: 13px;
        padding-bottom: 8px;
        text-align: left;
    }

    /* Geo (.ga4-card #geoCard table): Region | Users | Share */
    #geoCard .ga4-table tbody tr td:nth-child(1)::before { content: "Region"; display: none; }
    #geoCard .ga4-table tbody tr td:nth-child(2)::before { content: "Users"; }
    #geoCard .ga4-table tbody tr td:nth-child(3)::before { content: "Share"; }
    #geoCard .ga4-table tbody tr td:nth-child(1) {
        font-weight: 600;
        font-size: 14px;
        padding-bottom: 8px;
    }
    /* Bar-cell in share column — let bar grow to fill remaining width */
    #geoCard .ga4-bar-cell {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: flex-end;
    }
    #geoCard .ga4-bar {
        flex: 1 1 auto;
        max-width: 140px;
        min-width: 40px;
    }

    /* Device breakdown (#deviceCard table): Device | Users | Sessions */
    #deviceCard .ga4-table tbody tr td:nth-child(1)::before { content: "Device"; display: none; }
    #deviceCard .ga4-table tbody tr td:nth-child(2)::before { content: "Users"; }
    #deviceCard .ga4-table tbody tr td:nth-child(3)::before { content: "Sessions"; }
    #deviceCard .ga4-table tbody tr td:nth-child(1) {
        font-weight: 600;
        font-size: 14px;
        padding-bottom: 8px;
    }
    /* Device layout — desktop @media collapses to 1 col; ensure chart canvas
       caps to a sensible size on phones so it doesn't dominate. */
    .ga4-device-content {
        gap: 12px;
    }
    .ga4-device-chart canvas {
        max-width: 140px !important;
        max-height: 140px !important;
    }

    /* Demographics — desktop @media already sets 50px 1fr 70px; further tighten
       label/value cols for 360px viewport. */
    .ga4-demo-bar {
        grid-template-columns: 44px 1fr 88px;
        gap: 8px;
    }
    .ga4-demo-label {
        font-size: 12px;
    }
    .ga4-demo-value {
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Global error banner — wrap message text */
    .ga4-global-error {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
        font-size: 13px;
    }
    .ga4-global-error #globalErrorMsg {
        flex: 1 1 100%;
        min-width: 0;
        word-break: break-word;
    }

    /* =============================================================================
       MOBILE: company/semrush_sandbox  (PR: mobile/no-horizontal-scroll)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5 + §11 — admin keyword/rank API tester. Page has
       9 result tables (3 static debug + 6 JS-rendered .results-table variants)
       plus a 12-field form. On phones:
         · Stack all form columns (.col-md-*) full-width
         · Tab strip = horizontal scroll per §4.3
         · Every .results-table row becomes a card with the keyword/date/domain
           as title and the remaining metrics in a label/value grid. Labels
           are synthesized via ::before with :nth-child since the JS renderers
           don't emit data-label attributes.
         · Debug request-detail tables (label/value pairs) flow as two-column
           grids that wrap naturally.
         · Inline th width: 150px and JS-emitted style="max-width:300/400px"
           are neutralized with width:auto + box-sizing.
         · Raw response <pre> blocks keep horizontal scroll (acceptable per
           §11 — explicit scroll container for code/JSON dumps).
       ============================================================================= */

    /* Page container — kill desktop max-width so it spans full viewport */
    .sandbox-page {
        max-width: 100% !important; /* defeats inline-block .sandbox-page { max-width:1400px } in template */
        padding-left: 14px;
        padding-right: 14px;
    }

    /* Header: stack title + admin badge, tighten */
    .sandbox-page .am-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 0;
    }
    .sandbox-page .am-name {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.15;
        margin: 0;
    }
    .sandbox-page .am-contact {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
    }
    .sandbox-page .am-actions {
        width: 100%;
    }

    /* ── Controls form ─────────────────────────────────────────────────── */
    .sandbox-page .sandbox-controls .card-body {
        padding: 12px;
    }
    /* Every form column reflows to full width regardless of col-md-* */
    .sandbox-page .sandbox-form .row.g-3 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
    }
    .sandbox-page .sandbox-form .form-label {
        font-family: var(--sans);
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 0.06em;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    .sandbox-page .sandbox-form .form-control,
    .sandbox-page .sandbox-form .form-select {
        min-height: 44px;
        font-size: 14px;
    }
    .sandbox-page .sandbox-form .form-check {
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .sandbox-page .sandbox-form .form-check-input {
        width: 18px;
        height: 18px;
        margin: 0;
    }
    .sandbox-page .sandbox-form .form-check-label {
        font-size: 14px;
    }
    /* Run button — full width tap target */
    .sandbox-page .sandbox-form #runBtn {
        width: 100%;
        min-height: 44px;
        font-family: var(--sans);
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }
    .sandbox-page .sandbox-form .mt-3.d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* ── Results summary bar — wrap chips ─────────────────────────────── */
    .sandbox-page .results-summary .card-body {
        padding: 10px 12px;
    }
    .sandbox-page .results-summary .d-flex {
        gap: 8px !important; /* override Bootstrap g-3 inline */
        font-size: 12px;
    }

    /* ── Tabs strip — horizontal scroll per §4.3 ──────────────────────── */
    .sandbox-page #resultTabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-bottom: 0;
    }
    .sandbox-page #resultTabs::-webkit-scrollbar {
        display: none;
    }
    .sandbox-page #resultTabs .nav-item {
        flex: 0 0 auto;
    }
    .sandbox-page #resultTabs .nav-link {
        white-space: nowrap;
        min-height: 44px;
        padding: 10px 14px;
        font-size: 12px;
    }

    .sandbox-page #resultTabContent {
        border-radius: 6px;
    }
    .sandbox-page #resultTabContent .tab-pane.p-3 {
        padding: 12px !important; /* tighter than Bootstrap p-3 (1rem) on small screens */
    }

    /* ── Tables: results + debug — universal card-stack ───────────────── */
    /* Outer wrapper: no horizontal scroll (rows become cards) */
    .sandbox-page .table-responsive {
        overflow-x: visible;
        overflow-y: visible;
        width: 100%;
    }

    /* Generic table reset for both .results-table and .table.table-sm
       inside the sandbox page (.debug-section etc.) */
    .sandbox-page table.table {
        display: block;
        width: 100%;
        font-size: 12px;
        margin-bottom: 12px;
    }
    .sandbox-page table.table thead,
    .sandbox-page table.table colgroup {
        display: none;
    }
    .sandbox-page table.table tbody {
        display: block;
        width: 100%;
    }
    .sandbox-page table.table tbody tr {
        display: grid;
        grid-template-columns: minmax(110px, 38%) 1fr;
        column-gap: 10px;
        row-gap: 4px;
        padding: 10px 12px;
        margin: 0 0 8px 0;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
    }
    /* CRITICAL: when flipping <tr> to grid, neutralize fixed/inline td widths
       so cells flow within the grid track. (Lesson from PR #15/#17/#19.) */
    .sandbox-page table.table tbody tr > td,
    .sandbox-page table.table tbody tr > th {
        display: block;
        width: auto !important; /* override th[style="width:150px;"] + td[style="max-width:300px"] */
        max-width: 100%;
        min-width: 0;
        padding: 0;
        border: 0;
        background: transparent;
        text-align: left !important; /* override .text-end / .text-center on small cards */
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }
    /* Debug request-details tables: <th> = label, <td> = value. Put them
       side by side. */
    .sandbox-page .debug-section table.table tbody tr > th {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        align-self: start;
        padding-top: 1px;
    }
    .sandbox-page .debug-section table.table tbody tr > td {
        font-size: 12px;
        color: var(--ink-body);
    }
    .sandbox-page .debug-section table.table tbody tr > td code,
    .sandbox-page .debug-section table.table tbody tr > td pre {
        word-break: break-all;
        white-space: pre-wrap;
        font-size: 11px;
    }

    /* ── results-table: rows are <td>-only (no <th>). Convert each row to
       a card: first cell = serif title (date / keyword / domain), remaining
       cells = simple flex rows where ::before injects a column-index label.

       Renderers (kept as comments for future reference):
         · Overview Trend (7 cols): Date | Rank | Org Kw | Org Tr | Org Cost | Paid Kw | Paid Tr
         · Top Keywords  (7 cols): Keyword | Pos | Change | Volume | CPC | Traffic | URL
         · Competitors   (6 cols): Domain | Common Kw | Org Kw | Org Tr | Org Cost | Paid Kw
         · Visibility    (4 cols): Date | Visibility% | Avg Pos | Est Traffic
         · Rankings      (8 cols): Keyword | Pos A | Pos B | Diff | Volume | Visibility | Est Tr | URL

       Since the column count varies, we don't try to label every metric by
       name — instead we drop the desktop header row visually and present
       cells in their original column order. Power users can flip to the Raw
       Response tab if they need column names. (Acceptable trade-off: this
       page is admin-only API testing per the page badge.) */
    .sandbox-page table.results-table tbody tr {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .sandbox-page table.results-table tbody tr > td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 10px;
        font-size: 12px;
        color: var(--ink-body);
        padding: 3px 0;
        width: auto !important;        /* override any inline width */
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .sandbox-page table.results-table tbody tr > td::before {
        content: "Col " counter(sb-col);
        counter-increment: sb-col;
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        white-space: nowrap;
        flex: 0 0 auto;
    }
    .sandbox-page table.results-table tbody tr {
        counter-reset: sb-col;
    }

    /* First cell becomes card title — full-width serif, no label prefix */
    .sandbox-page table.results-table tbody tr > td:first-child {
        display: block;
        font-family: var(--serif);
        font-size: 16px;
        font-weight: 500;
        color: var(--ink);
        padding: 0 0 6px 0;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--rule);
        text-align: left;
    }
    .sandbox-page table.results-table tbody tr > td:first-child::before {
        display: none;
    }
    .sandbox-page table.results-table tbody tr > td:first-child strong {
        font-family: var(--serif);
        font-weight: 500;
    }

    /* URL cell (last cell in Top Keywords + Rankings) — truncate */
    .sandbox-page table.results-table tbody tr > td .kw-url {
        max-width: 60vw;
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        vertical-align: bottom;
    }

    /* Position-change span (.pos-up/.pos-down/.pos-same) keeps inline display */
    .sandbox-page table.results-table .pos-up,
    .sandbox-page table.results-table .pos-down,
    .sandbox-page table.results-table .pos-same {
        white-space: nowrap;
    }

    /* ── Raw response / debug pre blocks: allow horizontal scroll (acceptable
       per §11 — code/JSON dump is an explicit scroll container) ──────── */
    .sandbox-page .raw-output,
    .sandbox-page pre.raw-output {
        font-size: 11px;
        padding: 10px;
        max-height: 320px;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        white-space: pre;          /* preserve formatting; users can scroll horizontally */
        word-break: normal;
    }

    /* Tab content area inside debug — pre with inline max-height keeps scroll */
    .sandbox-page #debugPane pre {
        font-size: 11px;
        -webkit-overflow-scrolling: touch;
    }

    /* Banners (alert .alert-warning / .alert-danger generated by JS):
       wrap their inner flex rows so icons + text + buttons stack cleanly */
    .sandbox-page #positionTrackingControls .alert .d-flex {
        flex-wrap: wrap;
        gap: 6px;
    }
    .sandbox-page #positionTrackingControls .alert .d-flex.gap-2 {
        flex-direction: column;
        align-items: stretch;
    }
    .sandbox-page #positionTrackingControls .alert .btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }
    /* Banner-embedded details/summary attempts table — apply universal
       table reset (already covered by .sandbox-page table.table above) */
    .sandbox-page #positionTrackingControls .alert details summary {
        cursor: pointer;
        min-height: 28px;
        padding: 4px 0;
    }

    /* PT controls hr divider + label */
    .sandbox-page #positionTrackingControls hr {
        margin: 8px 0;
    }

    /* =============================================================================
       MOBILE: company/payments  (PR: mobile/payments-tracker)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5.3 (tables → cards), §4.6 (stat block grid), §4.12 (cards
       are the default mobile table pattern), §11 (iframes are an explicit scroll
       container — page itself must not scroll horizontally).

       Sources of horizontal overflow on this page:
         1. .payments-header flex row with 5 controls (3 selects + 2 buttons).
         2. .payments-hero-row 4-up card strip (declared 1fr at <720px in
            payments-tracker.css but the cards themselves can still overshoot).
         3. .payments-tabs nav (already overflow-x: auto — keep that).
         4. .payments-toolbar filters row (radio pills + meta on the right).
         5. #overdueTable — the main grouped table, 10 columns + colgroup widths.
         6. .payments-upcoming-groups + .payments-review-list — JS-rendered
            stacks, mostly fine, but contain dense grids.
         7. .email-settings-body two-column grid + iframe — iframe has intrinsic
            email-template width that blows out the viewport.
       ============================================================================= */

    /* --- 1. Header: stack title + controls ---------------------------------- */
    .payments-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 0 12px;
    }
    .payments-header-titles {
        min-width: 0;        /* override 240px from desktop */
    }
    .payments-h1 {
        font-family: var(--serif);
        font-size: 28px;
        line-height: 1.15;
    }
    .payments-sub {
        font-size: 13px;
        color: var(--ink-3);
    }
    .payments-header-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    .payments-header-actions .payments-select,
    .payments-header-actions .payments-btn {
        width: 100%;
        min-height: 44px;     /* HANDOFF §3.5 tap target */
        box-sizing: border-box;
        font-size: 13px;
    }
    /* "Customer IDs" + "Sync now" buttons take full row each */
    .payments-header-actions > a.payments-btn,
    .payments-header-actions > button.payments-btn {
        grid-column: 1 / -1;
    }

    /* --- 2. Hero stats: 2x2 grid (HANDOFF §4.6) ----------------------------- */
    .payments-hero-row {
        display: grid !important;     /* override desktop auto-fit grid */
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin: 12px;
    }
    .payments-hero-card {
        padding: 12px;
        min-width: 0;
        border-radius: 10px;
    }
    .payments-hero-label {
        font-size: 10.5px;
        letter-spacing: 0.14em;
    }
    .payments-hero-value {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.1;
        word-break: break-word;       /* "$10,000" never overflows narrow tile */
    }
    .payments-hero-meta {
        font-size: 11.5px;
        color: var(--ink-3);
    }
    .payments-hero-trial {
        font-size: 11px;
    }
    /* MRR composition <details> inside the hero card — keep on one tile width */
    .payments-mrr-composition {
        font-size: 12px;
    }
    .payments-mrr-composition summary {
        font-size: 11px;
    }
    .payments-mrr-comp-list li {
        display: grid;
        grid-template-columns: 1fr auto;
        column-gap: 8px;
        row-gap: 2px;
        font-size: 12px;
    }
    .payments-mrr-comp-meta {
        grid-column: 1 / -1;
        font-size: 10.5px;
    }

    /* --- 3. Tabs already overflow-x:auto in payments-tracker.css — confirm
       the page-wrapper doesn't trap that scroll. */
    .payments-tabs {
        margin: 0 12px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .payments-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        min-height: 44px;
        font-size: 12px;
    }

    /* --- 4. Toolbar (filter pills + meta) ----------------------------------- */
    .payments-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }
    .payments-toolbar-filters {
        flex-wrap: wrap;
        gap: 6px;
    }
    .payments-toolbar-meta {
        font-size: 11.5px;
        text-align: left;
    }
    .payments-pill-filter {
        font-size: 12px;
        padding: 8px 12px;
        min-height: 36px;
    }
    .payments-date-input {
        font-size: 12px;
        flex: 1 1 calc(50% - 6px);    /* From / To sit side-by-side */
        min-width: 0;
    }
    .payments-date-input input {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .payments-select--sm {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        min-height: 40px;
        box-sizing: border-box;
    }

    /* --- 5. Overdue table → card-stack ------------------------------------- */
    /* The page-level payments-tracker.css sets `.payments-table-wrap{overflow-x:auto}`
       at <720px. We force the table to layout as a card list so it never
       needs to scroll. Per the CRITICAL LESSON: when flipping <tr> to grid,
       always pair with width: auto + box-sizing on the <td>s. */
    .payments-table-wrap {
        overflow-x: hidden !important; /* override payments-tracker.css <720px */
        overflow-y: visible !important;
        width: 100%;
        max-width: 100%;
        padding: 0 12px;
        box-sizing: border-box;
    }
    .payments-table[data-mobile="cards"] {
        display: block;
        width: 100%;
        max-width: 100%;
        table-layout: auto;
        border: 0;
    }
    .payments-table[data-mobile="cards"] colgroup {
        display: none;            /* desktop col widths irrelevant in card mode */
    }
    .payments-table[data-mobile="cards"] thead {
        position: absolute;
        left: -9999px;
        top: -9999px;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }
    .payments-table[data-mobile="cards"] tbody {
        display: block;
        width: 100%;
    }

    /* Bucket header row (Overdue / This week / Later / No date) — full-width
       banner spanning the card stack. */
    .payments-table[data-mobile="cards"] tbody tr.payments-bucket-row {
        display: block;
        width: 100%;
        margin: 12px 0 8px;
    }
    .payments-table[data-mobile="cards"] tbody tr.payments-bucket-row > td {
        display: block;
        width: auto !important;       /* CRITICAL: pair with box-sizing */
        box-sizing: border-box;
        padding: 8px 12px;
        border: 0;
    }
    .payments-bucket-row-inner {
        flex-wrap: wrap;
        gap: 4px 10px;
    }
    .payments-bucket-title {
        font-size: 11px;
        letter-spacing: 0.14em;
    }
    .payments-bucket-count,
    .payments-bucket-sub,
    .payments-bucket-total {
        font-size: 11px;
    }

    /* Data row → card. Grid of label/value cells. */
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 10px;
        row-gap: 8px;
        align-items: start;
        width: 100%;
        margin-bottom: 8px;
        padding: 12px;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper-2);
        box-sizing: border-box;
    }
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td {
        display: block;
        width: auto !important;       /* CRITICAL: pair with box-sizing */
        box-sizing: border-box;
        padding: 0;
        border: 0;
        min-width: 0;
        max-width: 100%;
        text-align: left;
        font-size: 13px;
        color: var(--ink-body);
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Small-caps label rendered from data-label="..." on every td (JS-built). */
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-faint);
        margin-bottom: 4px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Client cell = full-width card header (no label, name acts as title) */
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td[data-label="Client"] {
        grid-column: 1 / -1;
        margin-bottom: 2px;
    }
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td[data-label="Client"]::before {
        display: none;
    }
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td[data-label="Client"] a {
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 600;
        color: var(--ink);
    }
    .payments-table[data-mobile="cards"] .payments-am {
        font-size: 11.5px;
        color: var(--ink-3);
    }
    /* Actions cell = full-width footer; reflow to wrap and become tap-friendly.
       Zero font-size on the cell hides the bare " · " text nodes the JS inserts
       between actions; child buttons/links restore their own font-size. */
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td.payments-actions,
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td[data-mobile-action] {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px dotted var(--rule);
        font-size: 0;
    }
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td.payments-actions::before,
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td[data-mobile-action]::before {
        display: none;
    }
    .payments-action,
    button.payments-send-action,
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td.payments-actions a,
    .payments-table[data-mobile="cards"] tbody tr[data-client-id] > td[data-mobile-action] a {
        font-size: 12px;
        min-height: 36px;
        padding: 8px 12px;
        white-space: nowrap;
    }

    /* Empty-state row */
    .payments-table[data-mobile="cards"] tbody tr > td.payments-empty {
        display: block;
        width: auto !important;
        box-sizing: border-box;
        grid-column: 1 / -1;
        padding: 24px 12px;
        text-align: center;
        font-size: 13px;
    }

    /* Inline next-billing edit button shouldn't overflow */
    .payments-date-edit-btn {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* --- 6. Upcoming / Review JS-rendered stacks --------------------------- */
    .payments-upcoming-groups,
    .payments-review-list {
        padding: 0 12px;
    }
    .payments-upcoming-group {
        padding: 12px;
    }
    .payments-upcoming-group-header {
        flex-wrap: wrap;
        gap: 6px 10px;
    }
    .payments-upcoming-group-header h3 {
        font-size: 14px;
    }
    .payments-flag-card {
        padding: 12px;
    }
    .payments-flag-card-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    .payments-flag-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .payments-flag-actions {
        flex-wrap: wrap;
    }
    .payments-flag-action {
        min-height: 36px;
        flex: 1 1 auto;
    }

    /* --- 7. Kill-switch banner --------------------------------------------- */
    .payments-killswitch-banner {
        margin: 12px;
        padding: 12px;
    }
    .payments-killswitch-banner-eyebrow {
        font-size: 10.5px;
        letter-spacing: 0.14em;
    }
    .payments-killswitch-banner-body {
        font-size: 13px;
    }

    /* --- 8. Email Settings tab: stack columns, constrain iframe ----------- */
    /* The page CSS already stacks .email-settings-body at <1100px. We tighten
       padding and force the iframe to behave per HANDOFF §11 (allow scroll
       INSIDE the iframe wrapper, but the page itself never scrolls X). */
    .email-settings {
        padding: 12px;
    }
    .email-settings-tabbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .email-settings-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .email-settings-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        min-height: 44px;
    }
    .email-settings-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .email-settings-actions .payments-btn {
        flex: 1 1 auto;
        min-height: 44px;
        justify-content: center;
    }
    .email-settings-body {
        gap: 16px;
    }
    .email-settings-controls {
        min-width: 0;
    }
    .email-settings-subject-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    .email-settings-input {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .email-settings-preview {
        position: static;             /* sticky pane fights the stacked layout */
        min-width: 0;
    }
    .email-settings-preview-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    .email-settings-preview-help {
        font-size: 10px;
    }
    /* Iframe wrapper: clip to viewport, allow inner scroll if needed (§11).
       The Stripe/email-template iframe has intrinsic desktop width — the
       wrapper becomes the explicit scroll container so the PAGE never scrolls. */
    .email-settings-preview-frame {
        max-width: 100%;
        width: 100%;
        overflow-x: auto;             /* §11: explicit scroll container */
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }
    .email-settings-preview-frame iframe {
        width: 100% !important;       /* defensive vs intrinsic iframe width */
        max-width: 100%;
        height: 560px;                /* shorter on mobile — full email rarely needed */
        display: block;
    }

    /* --- 9. Global guard: payments page wrapper never overflows ----------- */
    .payments-tracker {
        max-width: 100%;
        overflow-x: hidden;           /* page-level safety; tabs nav keeps its own scroll */
    }

    /* =============================================================================
       MOBILE: company/action_items  (PR: mobile/action-items)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §4.12 (Cards default) + §5 (per-page card-stack pattern) and
       §11 (no overflow-x: auto on page content). The team Action Items board has
       three wide tables (Needs Review, In Progress, Completed) plus a 4-up KPI
       hero strip and a 5-control filter bar that all blow out at 360px on the
       desktop layout.

       Conversions:
       1. .am-hero-grid 4-up → 2-up grid (matches §5.2 KPI pattern)
       2. Filter bar inputs wrap, become 40px tap targets, search goes full-width
       3. All three opt-tables: flatten thead, flip <tr> into editorial cards
          - .ai-row (Needs Review): grid with priority+title on row 1, the rest
            (category, client, date) stacked below; chevron column hidden
          - .ai-expand: full-width detail panel; selects become full-width, btns
            wrap into 2-per-row tap targets
          - In Progress / Completed rows: priority+title on row 1, remaining
            cells full-width with auto-tagged data-label as small-caps eyebrow
       4. Prompt Agent modal — input sizes bumped to 40px tap targets

       CRITICAL (lesson from PRs #15/#17/#19): every <tr> flipped to display:grid
       is paired with `width: auto !important; box-sizing: border-box` on the
       <td>s — otherwise inline `style="width: 70px / 100px / 140px"` on the
       <th>s leaks via table-layout and re-introduces horizontal scroll.
       ============================================================================= */

    /* ── Page padding ───────────────────────────────────────────────────── */
    .am-dashboard.company-dashboard {
        padding: 14px 12px !important; /* overrides style.css .am-dashboard padding */
    }

    /* ── Page header: title + tagline stack ─────────────────────────────── */
    .am-dashboard.company-dashboard > .am-header {
        margin-bottom: 12px;
    }
    .am-dashboard.company-dashboard > .am-header .am-name {
        font-family: var(--serif);
        font-size: 28px;
        font-weight: 500;
        line-height: 1.1;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard > .am-header .am-contact {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
        margin-top: 4px;
    }
    .am-dashboard.company-dashboard > .am-header .am-contact span {
        white-space: normal; /* allow the tagline to wrap */
    }

    /* Inline alert (Supabase warning) — keep tight */
    .am-dashboard.company-dashboard > .alert {
        font-size: 12px;
        padding: 10px 12px;
        margin: 8px 0 12px;
    }

    /* ── Hero KPI strip: 4-up → 2-up grid per HANDOFF.md §5.2 ───────────── */
    .am-dashboard.company-dashboard .am-hero-section {
        margin-bottom: 16px;
    }
    .am-dashboard.company-dashboard .am-hero-grid {
        grid-template-columns: 1fr 1fr !important; /* override style.css 576px → 1col */
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard .am-hero-card {
        padding: 10px 12px !important; /* overrides --space-6 (24px) */
        gap: 8px !important;
        border-radius: 10px;
        align-items: center;
    }
    .am-dashboard.company-dashboard .am-hero-icon {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }
    .am-dashboard.company-dashboard .am-hero-content {
        min-width: 0;
    }
    .am-dashboard.company-dashboard .am-hero-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .am-dashboard.company-dashboard .am-hero-value {
        font-family: var(--serif);
        font-size: 22px;
        font-weight: 500;
        line-height: 1.1;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard .am-hero-subtext {
        font-family: var(--sans);
        font-size: 10.5px;
        color: var(--ink-faint);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ── cc-panel + cc-panel-header tighten ─────────────────────────────── */
    .am-dashboard.company-dashboard .cc-section {
        margin-left: 0;
        margin-right: 0;
    }
    .am-dashboard.company-dashboard .cc-panel {
        border-radius: 10px;
    }
    .am-dashboard.company-dashboard .cc-panel-header {
        padding: 10px 12px !important;
        flex-wrap: wrap;
        gap: 6px;
    }
    .am-dashboard.company-dashboard .cc-panel-header h6 {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
    }
    .am-dashboard.company-dashboard .cc-panel-header .cc-badge {
        font-size: 10px;
    }

    /* ── Filter bar (inline-styled div above #reviewTable) ──────────────── */
    /* Target the immediate div under .cc-panel that has the filter inline
       styles. We can't rely on a class, so use the inline-style signature. */
    .am-dashboard.company-dashboard .cc-panel > div[style*="border-bottom"][style*="display: flex"] {
        padding: 10px 12px !important;
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard .cc-panel > div[style*="border-bottom"][style*="display: flex"] > div[style*="position: relative"] {
        flex: 1 1 100% !important;     /* search wrapper goes full-width */
        max-width: none !important;
        min-width: 0 !important;
    }
    .am-dashboard.company-dashboard .cc-panel > div[style*="border-bottom"][style*="display: flex"] input[type="text"] {
        width: 100% !important;
        min-height: 40px !important;   /* tap target */
        padding: 8px 10px 8px 30px !important; /* preserve search-icon offset */
        font-size: 13px !important;
        max-width: none !important;
    }
    .am-dashboard.company-dashboard .cc-panel > div[style*="border-bottom"][style*="display: flex"] select {
        width: 100% !important;
        min-height: 40px !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
        max-width: none !important;
        flex: 1 1 calc(50% - 4px);     /* two selects per row */
    }

    /* ── Table → card stack: shared rules for all three opt-tables ──────── */
    .am-dashboard.company-dashboard .table-responsive {
        max-height: none !important;   /* override inline max-height: 700px / 400px */
        overflow: visible !important;  /* no internal scroll on phone */
    }
    .am-dashboard.company-dashboard .opt-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    .am-dashboard.company-dashboard .opt-table thead { display: none !important; }
    .am-dashboard.company-dashboard .opt-table tbody {
        display: block !important;
        width: 100% !important;
    }

    /* ── Needs Review rows (.ai-row) — Priority + Title on row 1 ────────── */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row {
        display: grid !important;
        grid-template-columns: auto 1fr;
        column-gap: 10px;
        row-gap: 6px;
        padding: 12px;
        margin: 0 0 8px 0;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        cursor: pointer;
        width: auto;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td {
        display: block !important;
        width: auto !important;            /* override inline th widths leaking via table-layout */
        max-width: 100% !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-sizing: border-box;
        min-width: 0;
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-body);
    }
    /* Row 1: priority badge (col 1) + title (col 2) */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 1;
        align-self: start;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1;
        min-width: 0;
    }
    /* Title text — bump a touch for legibility, allow wrap */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(2) > div[style*="font-weight"] {
        font-size: 13px !important;
        line-height: 1.3;
        white-space: normal;
    }
    /* Hide the muted single-line description preview at 360px — full text
       is shown after expansion. */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(2) > div.text-muted {
        display: none;
    }
    /* Row 2-4: category / client / date — each full-width */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(3),
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(4),
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(5) {
        grid-column: 1 / -1;
        display: inline-flex !important;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(3) { grid-row: 2; }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(4) { grid-row: 3; }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(5) {
        grid-row: 4;
        font-size: 11px !important;
        color: var(--ink-faint) !important;
    }
    /* "Submitted" eyebrow on the date cell (it has no innate label) */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(5)::before {
        content: "Submitted";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-faint);
    }
    /* Hide the chevron column — whole card is tappable; chevron clutter at 360 */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(6) {
        display: none !important;
    }

    /* ── Needs Review expand row (.ai-expand) — full-width detail panel ─── */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand {
        display: block;                    /* JS toggles inline style="display: none / ''" */
        width: 100%;
        margin: -6px 0 8px 0;              /* nestle under the row that opened it */
        background: transparent;
        border: 0;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand > td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }
    /* The inner expand wrapper (the div inside the colspan=6 td) */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand > td > div {
        padding: 12px !important;
        border-radius: 10px !important;
        border: 1px solid var(--rule) !important;
        background: var(--paper-3) !important;
    }
    /* Action button row inside the expand panel — wrap with grid-2 layout */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand > td > div > div[style*="display: flex"] {
        flex-wrap: wrap !important;
        gap: 6px !important;
        align-items: stretch !important;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand select {
        width: 100% !important;            /* override inline width: 140px / 180px / 100px */
        min-height: 40px !important;
        font-size: 13px !important;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand .btn {
        font-size: 12px !important;
        padding: 8px 12px !important;
        min-height: 40px;
        flex: 1 1 calc(50% - 3px);
    }
    /* The dismiss "ms-auto" button — allow it to wrap with the rest */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand .btn.ms-auto {
        margin-left: 0 !important;
    }

    /* ── In Progress + Completed rows (no .ai-row / .ai-expand class) ───── */
    /* mobile-tables.js auto-tags every <td> with data-label="<col header>",
       so we can drive the small-caps eyebrows from data-label. */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) {
        display: grid !important;
        grid-template-columns: auto 1fr;
        column-gap: 10px;
        row-gap: 6px;
        padding: 12px;
        margin: 0 0 8px 0;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        width: auto;
        align-items: start;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td {
        display: block !important;
        width: auto !important;
        max-width: 100% !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-sizing: border-box;
        min-width: 0;
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-body);
    }
    /* Row 1: col 1 (priority badge / ✓ icon) + col 2 (title) */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 1;
        align-self: center;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1;
        font-size: 13px !important;
        font-weight: 700;
        line-height: 1.3;
        white-space: normal !important;
        min-width: 0;
    }
    /* Subsequent cells: full-row label-above-value (label from data-label) */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(n+3) {
        grid-column: 1 / -1;
        display: flex !important;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(n+3)[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-faint);
        flex-shrink: 0;
    }
    /* Drop empty cells (e.g. blank chevron column on tables that have one) */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(n+3):empty,
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td[data-label=""]:empty {
        display: none !important;
    }
    /* In Progress "Done" button cell — make full-width tap target */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) .btn-outline-success {
        flex: 1 1 100%;
        min-height: 40px;
        font-size: 12px !important;
        padding: 8px 12px !important;
    }

    /* ── "No results" empty-state inside #noResults ─────────────────────── */
    .am-dashboard.company-dashboard #noResults {
        padding: 24px 16px !important;
    }
    .am-dashboard.company-dashboard #noResults p {
        font-size: 12px !important;
    }

    /* ── Prompt Agent modal — tighten paddings + bump inputs to 40px ────── */
    #promptModal .modal-body {
        padding: 12px;
    }
    #promptModal .form-label {
        font-size: 11px !important;
    }
    #promptModal #promptTaskTitle {
        font-size: 13px !important;
    }
    #promptModal .form-select,
    #promptModal .form-control {
        font-size: 13px !important;
        min-height: 40px;
    }
    #promptModal textarea.form-control {
        min-height: 96px;
    }

    /* =============================================================================
       MOBILE: company/activities  (PR: mobile/no-horizontal-scroll)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5 (per-page card-stack pattern) and §11 (no overflow-x:auto
       on page content). Activity Hub is the dashboard's worst inline-width offender
       (~57 fixed widths across 3 action-item tables + the comm-item rows + a 3-pane
       layout). Prior work already:
         · flattened .ah-layout to single-column
         · hid .ah-sidebar at ≤767
         · converted .comm-item rows to card-stack grids
         · card-stacked the 3 #actionItemsPanel tables
         · made the channel-tabs strip horizontally scrollable (§11 exception)

       This round mops up the remaining 360px overflow sources that those rules
       didn't catch: the Activity-Hub page header (justify-content:space-between
       with no wrap), the toolbar's margin-left:auto right cluster, the bulk-bar
       right cluster, the assign-detail select (width:200px), the recording audio
       (min-width:200px), and the two detail-panel info columns (min-width:180px).

       CRITICAL: any selector that touches a row flipped to display:grid (or its
       td/div children) re-asserts width:auto !important; min-width:0; max-width:
       100% to defeat the inline width declarations on the template. (See PR #15/
       #17/#19 lesson — display:grid alone does not neutralise inline widths.)
       ============================================================================= */

    /* ── Page header strip (line 151 of template) — desktop sets
       display:flex; align-items:center; justify-content:space-between with no
       wrap, so on a 360px viewport the Gmail-sync chip + button get pushed off
       the right edge. Allow wrap and set gap. Selector targets the first child
       div under the page wrapper that carries the bottom border + space-between. */
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] {
        flex-wrap: wrap;
        gap: 10px;
        padding-bottom: 12px !important;     /* override inline 1rem (16px) */
        margin-bottom: 12px !important;
    }
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] > div {
        min-width: 0;
        max-width: 100%;
    }
    /* Title within that header — keep readable at narrow widths, drop the
       desktop letter-spacing -0.02em crunch. */
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] h1.nx-section-heading {
        font-size: 24px !important;          /* desktop is 2rem (32px) */
        line-height: 1.15 !important;
        letter-spacing: -0.01em !important;
    }
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] p {
        font-size: 13px !important;
    }
    /* Gmail sync cluster — let it flow under the title block, full width */
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] > div[style*="gap:0.75rem"] {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px !important;
    }
    #gmail-sync-btn {
        min-height: 36px;
        font-size: 12px !important;
    }

    /* ── Toolbar (line 242) — right-cluster with margin-left:auto can stay
       inline on tablet widths but at ≤480 should flow to its own row, full
       width. The existing rule (.ah-main > div[style*="padding: 8px 20px"])
       already pads + gaps the parent; this rule targets the inner cluster. */
    .ah-main > div[style*="padding: 8px 20px"] > div[style*="margin-left: auto"] {
        margin-left: 0 !important;            /* desktop margin-left: auto */
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .ah-main > div[style*="padding: 8px 20px"] > div[style*="margin-left: auto"] > button {
        min-height: 36px;
        min-width: 36px;
    }
    /* The client-filter chip — ensure long client names ellipsis */
    #ahClientLabel {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* ── Bulk-bar inner right cluster (line 268) — parent already wraps via
       earlier rule, but the margin-left:auto on this child sticks. Reset. */
    .bulk-bar > div[style*="margin-left: auto"] {
        margin-left: 0 !important;
        width: 100%;
        justify-content: flex-end;
    }
    .bulk-bar button {
        min-height: 36px;
    }

    /* ── Detail panel: "Assign to client" row (line 458–467) appears for any
       comm whose thread.client_id is null. The select has inline width:200px
       which collides with the visible button on a 360px viewport. Stack to
       a full-width column. */
    .comm-detail > div[style*="padding-top: 1.5rem"] > div[style*="align-items: center"] {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .comm-detail select[id^="assign-detail-"] {
        width: 100% !important;               /* override inline width: 200px */
        min-height: 40px;
        font-size: 13px !important;
    }
    .comm-detail > div[style*="padding-top: 1.5rem"] button {
        min-height: 40px;
        width: 100%;                          /* button below the select */
    }

    /* ── Detail panel: single-comm details (line 400) — two columns each with
       inline flex:1; min-width:180px; on a 360px viewport (≈332px usable
       inside the detail) two 180px cols don't fit so flex-wrap kicks in, but
       the inner grid (line 405) `auto 1fr` can still blow out with long phone
       numbers. Stack to one column + force word-break. */
    .comm-detail > div[style*="gap: 20px"] {
        gap: 12px !important;
        flex-direction: column;
    }
    .comm-detail > div[style*="gap: 20px"] > div[style*="min-width: 180px"] {
        min-width: 0 !important;              /* override inline min-width: 180px */
        max-width: 100% !important;
        width: 100%;
    }
    .comm-detail > div[style*="gap: 20px"] > div[style*="min-width: 180px"] > div[style*="grid-template-columns"] {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* ── Detail panel: recording row (line 429) — audio has inline
       min-width:200px which pushes the "Open" button off-screen at 360px when
       combined with internal audio controls. Allow audio full width + button
       wraps below. */
    .comm-detail > div[style*="margin-bottom: 14px"] > div[style*="flex-wrap: wrap"] {
        gap: 8px !important;
    }
    .comm-detail audio[controls] {
        min-width: 0 !important;              /* override inline min-width: 200px */
        max-width: 100% !important;
        width: 100% !important;
        flex: 1 1 100% !important;
    }
    .comm-detail audio[controls] + a.btn {
        width: 100%;
        min-height: 40px;
    }

    /* ── Thread message detail (line 374) — tighten padding so each bordered
       sub-card fits at 360px. */
    .comm-detail > div[style*="padding-top: 14px"] > div[style*="border-left"] {
        padding: 10px 12px !important;
    }

    /* ── Text-bubble MMS images (line 354) — never overflow the bubble */
    .text-bubble img {
        max-width: 100% !important;           /* override inline max-width: 200px */
        height: auto !important;
    }
    .text-bubble a[href][target="_blank"] {
        max-width: 100%;
    }

    /* ── Comm action-item card inside detail (line 444) — wrap so the priority
       pill on the right never gets pushed beyond viewport. */
    .comm-action-item {
        flex-wrap: wrap;
        padding: 10px 12px !important;
        gap: 6px !important;
    }
    .comm-action-item > div[style*="flex: 1"] {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* ── Action-Items panel (#actionItemsPanel) — existing rules already
       card-stack the 3 tables. Add belt-and-suspenders so any tr/td that still
       carries inline width or long client names doesn't reintroduce overflow. */
    #actionItemsPanel .opt-table tbody tr,
    #actionItemsPanel .opt-table tbody tr > td {
        max-width: 100%;
        box-sizing: border-box;
    }
    #actionItemsPanel .opt-table tbody tr > td > div,
    #actionItemsPanel .opt-table tbody tr > td > span {
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    /* In-Progress + Completed tables don't have an action-buttons cell; the
       "Done" button (line 597) still needs a tap target. */
    #actionItemsPanel .opt-table tbody tr > td .btn-primary-opt,
    #actionItemsPanel .opt-table tbody tr > td .btn-secondary-opt,
    #actionItemsPanel .opt-table tbody tr > td .btn-danger-opt {
        min-height: 36px;
        padding: 6px 10px !important;         /* override inline padding: 4px 8px */
    }

    /* ── cc-panel headers within the action-items panel — at narrow widths
       the title + badge + chevron crowd. Allow wrap. */
    #actionItemsPanel .cc-panel-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    #actionItemsPanel .cc-panel-header h3 {
        font-size: 14px;
        margin: 0;
    }

    /* ── Global safety net: the .am-dashboard.company-dashboard wrapper should
       never produce horizontal scroll. Anything that slips past the rules
       above gets clipped at the page wrapper. */
    .am-dashboard.company-dashboard {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* =============================================================================
       MOBILE: clients/semrush_report  (PR: mobile/semrush-report)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5 (card-stack tables), §3 (spacing scale), §4.5 (flat
       cards), §11 (no horizontal scroll). Source template has 2 wide tables
       (Organic Keywords 8 cols, Tracked Keywords 5 cols) and 23 inline
       width/min-width/max-width declarations that are the main horizontal-scroll
       source. Strategy:

         1. Shrink the .semrush-report wrapper (was 20px 30px → 14px) so we
            stop blowing the viewport width.
         2. Stack .report-header vertically; back button + refresh wrap.
         3. Hero section: drop the 4-column grid → 1 column, kill the heavy
            gradient background + animated canvas at phone widths (visual noise
            that also forces overflow on slow phones).
         4. KPI stack: 3 columns compact (Tracked / Top 3 / Top 10) rather
            than the 1-col fallback the template's own <576 breakpoint forces.
         5. Both <table>s become card-stacks (thead hidden, each <tr> a card,
            each <td> a labelled row inside the card) — same pattern as
            .am-clients-section above.
         6. Override every inline width / min-width / max-width on tds and
            ths with width: auto !important; max-width: 100% !important.
         7. Search inputs inside widget-header — full-width drop below title.
       ============================================================================= */

    /* ── 1. Page wrapper — kill the 20/30 padding that was overflowing 360px */
    .semrush-report {
        padding: 14px !important;          /* override page-style block 20px 30px */
        min-height: auto !important;
        background: var(--paper);
    }

    /* ── 2. Header — stack vertically, shrink title, allow buttons to wrap */
    .semrush-report .report-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
        margin-bottom: 16px;
        border-radius: 10px;
        border: 1px solid var(--rule);
        background: var(--paper-2);
    }
    .semrush-report .report-header .breadcrumb {
        font-size: 12px;
        margin-bottom: 4px;
    }
    .semrush-report .report-title {
        font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
        font-size: 22px;
        font-weight: 500;
        line-height: 1.15;
        color: var(--ink);
    }
    .semrush-report .report-subtitle {
        font-size: 12px;
        color: var(--ink-3);
        word-break: break-word;
    }
    .semrush-report .header-right {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-self: stretch;
    }
    .semrush-report .header-right .btn {
        flex: 1 1 auto;
        min-height: 44px;       /* HIG tap target */
        font-size: 12px;
        margin: 0 !important;   /* override .me-2 utility that adds right margin */
    }

    /* ── 3. Filter bar — single-col, full-width children */
    .semrush-report .filter-bar {
        padding: 12px;
        margin-bottom: 16px;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper-2);
        box-shadow: none;       /* editorial = flat, per §4.5 */
    }
    .semrush-report .filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .semrush-report .filter-group {
        width: 100%;
    }
    .semrush-report .filter-group.ms-auto {
        margin-left: 0 !important;  /* override Bootstrap ms-auto utility */
    }
    .semrush-report .filter-group label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        color: var(--ink-3);
    }

    /* ── 4. Hero section — collapse 4-col grid to a single column,
           suppress decorative background chart to stop GPU thrash on phones */
    .semrush-report .hero-section {
        padding: 16px;
        border-radius: 10px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
    }
    .semrush-report .hero-bg-chart,
    .semrush-report .hero-bg-gradient {
        display: none;                /* editorial / no AI-slop animated bg on phones */
    }
    .semrush-report .hero-section-row {
        margin-bottom: 16px;
    }
    .semrush-report .hero-section-content {
        grid-template-columns: 1fr !important;   /* override inline 1fr 1fr 1.5fr 1fr */
        grid-template-rows: auto !important;
        gap: 14px !important;
    }
    .semrush-report .hero-metric {
        gap: 12px;
        justify-content: flex-start;
        text-align: left;
    }
    .semrush-report .hero-metric-icon {
        width: 40px;
        height: 40px;
        border-radius: 8px;
    }
    .semrush-report .hero-metric-icon i {
        font-size: 1.1rem;
    }
    .semrush-report .hero-metric-value {
        font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
        font-size: 24px;
        font-weight: 500;
        letter-spacing: -0.01em;
        line-height: 1.1;
    }
    .semrush-report .hero-metric-secondary .hero-metric-value {
        font-size: 20px;
    }
    .semrush-report .hero-metric-label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        color: var(--ink-3);
    }
    .semrush-report .hero-metric-sublabel {
        font-size: 11px;
        color: var(--ink-faint, var(--ink-3));
    }
    .semrush-report .hero-metric-change {
        margin-left: 0;
        padding: 4px 8px;
        align-self: flex-start;
    }
    .semrush-report .hero-metric-change .change-value {
        font-size: 13px;
    }
    .semrush-report .hero-chart {
        height: 60px;
        margin: 4px 0 0 0;
        grid-column: 1 / -1;
        order: -1;
    }
    .semrush-report .hero-chart-label {
        font-size: 10.5px;
        letter-spacing: 0.14em;
    }

    /* ── 5. Section divider */
    .semrush-report .section-divider {
        gap: 12px;
        margin: 16px 0 12px 0;
    }
    .semrush-report .section-title {
        font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
        font-size: 18px;
        font-weight: 500;
    }

    /* ── 6. Tracked section — KPI strip + table stacked */
    .semrush-report .tracked-section-row {
        display: block !important;     /* override grid layout from page CSS */
        margin-bottom: 16px;
    }
    .semrush-report .tracked-kpi-stack {
        display: grid !important;      /* override flex column / row from page CSS */
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }
    .semrush-report .tracked-kpi-stack .kpi-card {
        flex: none;
        padding: 10px 8px;
        border-radius: 10px;
        border: 1px solid var(--rule);
        background: var(--paper-2);
        box-shadow: none;              /* flat per §4.5 */
    }
    .semrush-report .tracked-kpi-stack .kpi-card::before {
        height: 2px;                   /* slimmer accent bar in compact card */
    }
    .semrush-report .tracked-kpi-stack .kpi-value {
        font-family: var(--serif, "Newsreader", ui-serif, Georgia, serif);
        font-size: 22px;
        font-weight: 500;
        line-height: 1.1;
    }
    .semrush-report .tracked-kpi-stack .kpi-label {
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.14em;
        color: var(--ink-3);
    }
    .semrush-report .tracked-kpi-stack .kpi-delta {
        font-size: 11px;
        margin-top: 4px;
    }
    .semrush-report .tracked-keywords-table .widget {
        max-height: none;
    }

    /* ── 7. Widget — flat, fluid */
    .semrush-report .widget {
        border-radius: 10px;
        border: 1px solid var(--rule);
        box-shadow: none;              /* flat per §4.5 */
        background: var(--paper-2);
    }
    .semrush-report .widget-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px;
        background: var(--paper-2);
        border-bottom: 1px solid var(--rule);
    }
    .semrush-report .widget-header-left,
    .semrush-report .widget-header-right {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }
    .semrush-report .widget-title {
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        color: var(--ink);
    }
    .semrush-report .widget-subtitle {
        font-size: 11px;
    }
    /* Search inputs in widget headers — override inline width: 140px / 180px */
    .semrush-report .widget-header input[type="text"],
    .semrush-report .widget-header .form-control {
        width: 100% !important;        /* override inline width:140px / 180px */
        min-height: 40px;
        font-size: 14px;
        border-radius: 6px;
    }
    .semrush-report .widget-body {
        padding: 10px;
        min-height: 0;
        /* override inline style="max-height: 400px; overflow-y: auto;" — at phone
           widths we don't want a nested vertical scroller; let the page scroll. */
        max-height: none !important;
        overflow: visible !important;
    }

    /* ── 8. TABLES → CARD-STACK (both organic and tracked keyword tables) */

    /* Kill horizontal scroll wrapper at phone widths */
    .semrush-report .table-responsive,
    .semrush-report .cc-table-scroll {
        overflow: visible !important;
        max-height: none !important;
    }

    /* Flatten the table itself */
    .semrush-report .table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        border-collapse: collapse;
    }

    /* Hide thead — sortable column headers don't translate to card layout.
       Column tap-to-sort is lost on phones (acceptable — AMs rarely sort on
       mobile, and search input is still available). */
    .semrush-report .table thead {
        display: none !important;
    }

    .semrush-report .table tbody {
        display: block !important;
        width: 100% !important;
    }

    /* Each row becomes a card */
    .semrush-report .table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto;
        column-gap: 10px;
        row-gap: 4px;
        padding: 10px 12px;
        margin: 0 0 8px 0;
        background: var(--paper);
        border: 1px solid var(--rule);
        border-radius: 10px;
    }

    /* Every td — neutralize inline widths/padding/text-align that fight grid.
       The 23 inline width/min-width/max-width declarations in the template
       (8 on the organic thead, 4 on the tracked thead, 2 on td max-widths,
       2 on search inputs, plus extra ad-hoc widths) all get overridden here. */
    .semrush-report .table tbody tr > td {
        display: block;
        width: auto !important;            /* override inline th widths cascading via colgroup */
        min-width: 0 !important;           /* override inline min-width:120px on URL th */
        max-width: 100% !important;        /* override td inline max-width:150px / 180px */
        padding: 0 !important;             /* override .ps-2 / .ps-3 padding-start on td */
        border: 0 !important;
        background: transparent;
        text-align: left !important;       /* override .text-center / .text-end on td */
        font-size: 13px;
        line-height: 1.35;
        color: var(--ink-body, var(--ink));
        overflow: visible;
        white-space: normal;
        word-break: break-word;
    }

    /* === Organic Keywords table (8 cols) — column ordering ===
       td order in DOM: 1 keyword, 2 SERP, 3 position, 4 change, 5 volume,
                        6 traffic, 7 share, 8 url
       Layout intent on phone:
         row 1: [keyword]              [position badge]
         row 2: [URL truncated]
         row 3: [Δ · Vol · Traffic · Share · SERP] inline meta, wrap
    */
    .semrush-report .organic-keywords-row .table tbody tr {
        grid-template-columns: 1fr auto;
    }
    /* keyword — title, row 1 col 1 */
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(1) {
        grid-row: 1;
        grid-column: 1;
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 600;
        color: var(--ink);
    }
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(1) .fw-medium {
        font-weight: 600;
    }
    /* position badge — top-right */
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(3) {
        grid-row: 1;
        grid-column: 2;
        text-align: right !important;
        align-self: start;
    }
    /* URL — full width on its own row */
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(8) {
        grid-row: 2;
        grid-column: 1 / -1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(8) small {
        font-size: 11px;
        color: var(--ink-3);
    }
    /* Meta cells: SERP / change / volume / traffic / share — inline on row 3 */
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(2),
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(4),
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(5),
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(6),
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(7) {
        grid-row: 3;
        grid-column: span 2;
        display: inline-flex;
        align-items: center;
        font-size: 11px;
        color: var(--ink-3);
    }
    /* Inject column labels before each meta cell so the cards are self-describing */
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(5)::before {
        content: "Vol ";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-right: 4px;
    }
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(6)::before {
        content: "Traffic ";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin: 0 4px 0 10px;
    }
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(7)::before {
        content: "Share ";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin: 0 4px 0 10px;
    }
    .semrush-report .organic-keywords-row .table tbody tr > td:nth-child(4)::before {
        content: "Δ ";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin: 0 4px 0 10px;
    }

    /* === Tracked Keywords table (5 cols) ===
       td order: 1 keyword, 2 position, 3 change, 4 volume, 5 url */
    .semrush-report .tracked-keywords-table .table tbody tr {
        grid-template-columns: 1fr auto;
    }
    /* keyword — title */
    .semrush-report .tracked-keywords-table .table tbody tr > td:nth-child(1) {
        grid-row: 1;
        grid-column: 1;
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 600;
        color: var(--ink);
    }
    /* position badge — top right */
    .semrush-report .tracked-keywords-table .table tbody tr > td:nth-child(2) {
        grid-row: 1;
        grid-column: 2;
        text-align: right !important;
    }
    /* URL — full width row 2 */
    .semrush-report .tracked-keywords-table .table tbody tr > td:nth-child(5) {
        grid-row: 2;
        grid-column: 1 / -1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .semrush-report .tracked-keywords-table .table tbody tr > td:nth-child(5) small {
        font-size: 11px;
        color: var(--ink-3);
    }
    /* change + volume — meta row */
    .semrush-report .tracked-keywords-table .table tbody tr > td:nth-child(3),
    .semrush-report .tracked-keywords-table .table tbody tr > td:nth-child(4) {
        grid-row: 3;
        grid-column: span 2;
        display: inline-flex;
        align-items: center;
        font-size: 11px;
        color: var(--ink-3);
    }
    .semrush-report .tracked-keywords-table .table tbody tr > td:nth-child(3)::before {
        content: "Δ ";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-right: 4px;
    }
    .semrush-report .tracked-keywords-table .table tbody tr > td:nth-child(4)::before {
        content: "Vol ";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin: 0 4px 0 10px;
    }

    /* Position badge sizing inside the cards */
    .semrush-report .position-badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* SERP features cell — let badges wrap, shrink */
    .semrush-report .serp-features-cell {
        white-space: normal !important;     /* override .serp-features-cell nowrap */
    }
    .semrush-report .serp-badge {
        font-size: 9.5px;
        padding: 1px 4px;
        margin-right: 3px;
    }

    /* Empty/loading/error states inside widgets */
    .semrush-report .widget-loading,
    .semrush-report .widget-empty,
    .semrush-report .widget-error {
        padding: 24px 12px;
        font-size: 13px;
        text-align: center;
    }

    /* The date-picker secondary refresh button — make it full-width */
    .semrush-report #refreshBtn2 {
        width: 100%;
    }

    /* Global error banner inside semrush — wrap text */
    .semrush-report .global-error {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 13px;
    }

    /* =============================================================================
       MOBILE: company/content_output  (PR: mobile/content-output)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5 patterns + §11 (no horizontal scroll on page content) —
       this is the content production tracker, the heaviest table page in the app
       with 8 separate tables (My Entries, Writer Leaderboard, CM Team, Client
       Breakdown, Daily Work, Team Efficiency, Manage Teams modal, Bulk Add modal)
       plus ~28 inline fixed-width styles. All page-level tables flatten to
       card-stacks. Modal tables are allowed to horizontal-scroll inside the
       modal body per HANDOFF §11 (modals = explicit scroll containers), but we
       still cap the inline widths so they fit better.

       Strategy:
       1. Force `.am-dashboard.company-dashboard .table-responsive` to NOT
          horizontally scroll on the page (override line ~902's `overflow-x: auto`).
       2. Flatten every `.opt-table.gmb-table` inside `.am-dashboard.company-dashboard`
          (but NOT inside `.modal`) to a card-stack via `display: block` on
          table/thead/tbody/tr/td, with the column header injected per-table
          via positional `nth-child()` selectors (the templates don't ship
          `data-label` attrs on these tables, but column order is stable in markup).
       3. Pair every grid/flex flip on <tr> with `width: auto !important` and
          `box-sizing: border-box` on the <td>s (PR #15/#17/#19 lesson).
       4. Neutralise inline `style="width:NNNpx"` on filter selects, date inputs,
          search inputs, action buttons, etc. by overriding at the class level.
       ============================================================================= */

    /* ── 1. Page header: stack title + buttons ──────────────────────────────── */
    .am-dashboard.company-dashboard .am-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .am-dashboard.company-dashboard .am-header .d-flex.gap-2 {
        flex-wrap: wrap;
    }
    .am-dashboard.company-dashboard .am-header .btn {
        min-height: 44px;
    }

    /* ── 2. Filter row (Month/Year/Manager): full-width selects ─────────────── */
    .am-dashboard.company-dashboard > form.d-flex {
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard > form.d-flex > .d-flex {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard > form.d-flex select.form-select-sm {
        flex: 1 1 100%;
        width: 100% !important;       /* override inline style="width: auto; min-width:130px" etc. */
        min-width: 0 !important;
        min-height: 40px;
    }

    /* ── 3. Hero stat grid: 2-up, not 1-up ──────────────────────────────────── */
    /* style.css collapses .am-hero-grid to 1 column at 576px which makes 7 stat
       cards (writer view) into a tall stack. 2-col is denser and still readable
       at 360px. */
    .am-dashboard.company-dashboard .am-hero-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;  /* override 1fr in style.css @media 576px */
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard .am-hero-card {
        padding: 12px;
        border-radius: 10px;
        min-width: 0;
        overflow: hidden;
    }
    .am-dashboard.company-dashboard .am-hero-value {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.1;
    }
    .am-dashboard.company-dashboard .am-hero-label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }
    .am-dashboard.company-dashboard .am-hero-subtext {
        font-size: 11px;
        line-height: 1.3;
        word-break: break-word;
    }

    /* ── 4. Monthly Goal section: stack label + edit pencil + bar ───────────── */
    .am-dashboard.company-dashboard #goalSection .card-body {
        padding: 12px !important;
    }
    .am-dashboard.company-dashboard #goalSection .d-flex.align-items-center.gap-2 {
        flex-wrap: wrap;
        row-gap: 6px;
    }
    .am-dashboard.company-dashboard #goalSection #goalEditForm,
    .am-dashboard.company-dashboard #goalSection #goalSetForm {
        flex: 1 1 100%;
    }
    .am-dashboard.company-dashboard #goalSection #goalInput {
        width: 80px !important;
        flex: 0 0 80px;
    }

    /* ── 5. Card headers across the page: wrap controls, full-width fields ──── */
    .am-dashboard.company-dashboard section.card > .card-header {
        flex-wrap: wrap;
        row-gap: 8px;
        padding: 10px 12px;
    }
    .am-dashboard.company-dashboard section.card > .card-header > .d-flex {
        flex-wrap: wrap;
        width: 100%;
    }
    .am-dashboard.company-dashboard section.card > .card-header .form-control,
    .am-dashboard.company-dashboard section.card > .card-header .form-select {
        width: 100% !important;     /* neutralise inline style="width:160px|200px|150px|130px" */
        min-width: 0 !important;
        flex: 1 1 100%;
    }
    .am-dashboard.company-dashboard #dailyWorkSection .card-header .btn {
        min-width: 44px;
        min-height: 40px;
    }
    /* Team Efficiency: range button-group spans full width, dates stack */
    .am-dashboard.company-dashboard #efficiencySection .btn-group {
        width: 100%;
    }
    .am-dashboard.company-dashboard #efficiencySection .btn-group .btn {
        flex: 1 1 0;
        min-height: 40px;
    }
    .am-dashboard.company-dashboard #efficiencySection .card-header input[type="date"] {
        width: 100% !important;
        flex: 1 1 100%;
    }

    /* ── 6. Team Overview separator: tighten ────────────────────────────────── */
    .am-dashboard.company-dashboard .d-flex.align-items-center.gap-2.mb-3.mt-4 {
        margin-top: 16px !important;
    }

    /* =========================================================================
       7. PAGE TABLES → CARD STACKS
       Shared rule for every `.opt-table.gmb-table` inside the page wrapper
       (excludes tables nested in modals, which keep their tabular layout).
       ========================================================================= */

    /* Disable .table-responsive's horizontal scroll on this page so flattened
       cards can flow naturally. */
    .am-dashboard.company-dashboard .table-responsive {
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
    /* Preserve modal scroll containers — the templates wrap their own
       max-height / overflow-y: auto divs and SHOULD scroll inside per HANDOFF §11. */
    .am-dashboard.company-dashboard .modal .table-responsive,
    .am-dashboard.company-dashboard .modal [style*="overflow-y: auto"] {
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Flatten every page-level opt-table.gmb-table to a card stack. */
    .am-dashboard.company-dashboard > section .opt-table.gmb-table,
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border: 0;
        font-family: var(--sans);
    }
    .am-dashboard.company-dashboard > section .opt-table.gmb-table thead {
        /* Visually hide thead but keep accessible to AT */
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
    }
    .am-dashboard.company-dashboard > section .opt-table.gmb-table tbody {
        display: block;
        width: 100%;
    }
    .am-dashboard.company-dashboard > section .opt-table.gmb-table tbody tr {
        display: block;
        width: 100% !important;     /* paired with td width:auto below — PR #15/#17 lesson */
        box-sizing: border-box;
        padding: 12px 14px;
        margin: 0 12px 10px 12px;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper-2);
    }
    .am-dashboard.company-dashboard > section .opt-table.gmb-table tbody tr > td {
        display: block;
        width: auto !important;      /* never inherit width:100% — PR #15/#17 lesson */
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 3px 0 !important;
        border: 0 !important;
        text-align: left !important; /* override .text-center desktop alignment */
        white-space: normal;
        font-size: 13px;
        line-height: 1.35;
        color: var(--ink-body);
    }

    /* ── 8. MY RECENT ENTRIES (#myEntriesTable) — 10 cols → card layout ──────
       cols: 1 date | 2 client | 3 svc | 4 aux | 5 loc | 6 blog | 7 pub | 8 rev
             | 9 notes | 10 actions */
    /* Client (col 2) acts as card title */
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(2) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 4px !important;
    }
    /* Date (col 1) — small meta line under client */
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(1) {
        font-size: 11px !important;
        color: var(--ink-3) !important;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 8px;
    }
    /* Page-count cells (svc/aux/loc/blog/pub/rev) — inline label + value */
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(3)::before { content: "Service"; }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(4)::before { content: "Aux"; }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(5)::before { content: "Location"; }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(6)::before { content: "Blog"; }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(7)::before { content: "Published"; }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(8)::before { content: "Revisions"; }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(n+3):nth-child(-n+8) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(n+3):nth-child(-n+8)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    /* Notes (col 9) — full-width muted block */
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(9) {
        padding-top: 8px !important;
        border-top: 1px dotted var(--rule) !important;
        margin-top: 6px;
    }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(9) small {
        font-size: 12px !important;
    }
    /* Actions (col 10) — full-width row of pill buttons */
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(10) {
        display: flex !important;
        gap: 8px;
        padding-top: 8px !important;
    }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(10) .btn {
        flex: 1 1 0;
        min-height: 40px;
    }
    /* Edit-mode: inputs inside any cell expand to fill its container */
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td input,
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td select {
        min-height: 40px;
    }
    .am-dashboard.company-dashboard #myEntriesTable tbody tr > td:nth-child(n+3):nth-child(-n+8) input {
        max-width: 100px;
    }

    /* ── 9. WRITER LEADERBOARD (#writerTable) — 11 cols → card layout ─────────
       cols: 1 writer | 2 team | 3 svc | 4 aux | 5 loc | 6 blog | 7 total |
             8 pub | 9 rev | 10 efficiency | 11 cost/page */
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 4px !important;
    }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(2) {
        font-size: 11px !important;
        color: var(--ink-3) !important;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(3)::before  { content: "Service"; }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(4)::before  { content: "Aux"; }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(5)::before  { content: "Location"; }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(6)::before  { content: "Blog"; }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(7)::before  { content: "Total"; }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(8)::before  { content: "Published"; }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(9)::before  { content: "Revisions"; }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(10)::before { content: "Efficiency"; }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(11)::before { content: "Cost/Page"; }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(n+3) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard #writerTable tbody tr > td:nth-child(n+3)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    /* Leaderboard medal accent: keep border-left on top-3 cards */
    .am-dashboard.company-dashboard #writerTable tbody tr.leaderboard-gold,
    .am-dashboard.company-dashboard #writerTable tbody tr.leaderboard-silver,
    .am-dashboard.company-dashboard #writerTable tbody tr.leaderboard-bronze {
        border-left-width: 3px;
    }
    .am-dashboard.company-dashboard #writerTable tbody tr.leaderboard-gold   { border-left-color: var(--accent); }
    .am-dashboard.company-dashboard #writerTable tbody tr.leaderboard-silver { border-left-color: var(--ink-3); }
    .am-dashboard.company-dashboard #writerTable tbody tr.leaderboard-bronze { border-left-color: var(--ink-faint); }

    /* ── 10. CM TEAM PERFORMANCE (anonymous, sibling section.card.mt-3) ───────
       cols: 1 cm_name | 2 writers | 3 total | 4 pub | 5 rev | 6 eff | 7 cost
       Selector: tables in this page that are NOT one of the 3 id'd tables. */
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table:not(#myEntriesTable):not(#writerTable):not(#clientTable) tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table:not(#myEntriesTable):not(#writerTable):not(#clientTable) tbody tr > td:nth-child(2)::before { content: "Writers"; }
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table:not(#myEntriesTable):not(#writerTable):not(#clientTable) tbody tr > td:nth-child(3)::before { content: "Total Pages"; }
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table:not(#myEntriesTable):not(#writerTable):not(#clientTable) tbody tr > td:nth-child(4)::before { content: "Published"; }
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table:not(#myEntriesTable):not(#writerTable):not(#clientTable) tbody tr > td:nth-child(5)::before { content: "Revisions"; }
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table:not(#myEntriesTable):not(#writerTable):not(#clientTable) tbody tr > td:nth-child(6)::before { content: "Efficiency"; }
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table:not(#myEntriesTable):not(#writerTable):not(#clientTable) tbody tr > td:nth-child(7)::before { content: "Cost/Page"; }
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table:not(#myEntriesTable):not(#writerTable):not(#clientTable) tbody tr > td:nth-child(n+2) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard > section.card .opt-table.gmb-table:not(#myEntriesTable):not(#writerTable):not(#clientTable) tbody tr > td:nth-child(n+2)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }

    /* ── 11. CLIENT BREAKDOWN (#clientTable) — 8 cols → card layout ───────────
       cols: 1 client (name + AM) | 2 svc | 3 aux | 4 loc | 5 blog | 6 total |
             7 published | 8 progress (bar + %) */
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(1) {
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(1) .fw-semibold {
        font-family: var(--sans);
        font-weight: 600;
        font-size: 14px;
        color: var(--ink);
        display: block;
        line-height: 1.25;
    }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(1) small {
        font-size: 11px !important;
        color: var(--ink-3) !important;
        display: block;
        margin-top: 2px;
    }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(2)::before { content: "Service"; }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(3)::before { content: "Aux"; }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(4)::before { content: "Location"; }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(5)::before { content: "Blog"; }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(6)::before { content: "Total"; }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(7)::before { content: "Published"; }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(8)::before { content: "Progress"; }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(n+2) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(n+2)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    /* Progress bar cell — keep bar + % visible, expand bar to fill */
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(8) > div {
        flex: 1 1 0;
        min-width: 0;
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(8) .progress {
        flex: 1 1 0;
        min-width: 60px;
    }
    .am-dashboard.company-dashboard #clientTable tbody tr > td:nth-child(8) small {
        font-size: 11px !important;
        white-space: nowrap;
        flex: 0 0 auto;
    }

    /* ── 12. DAILY WORK (#dailyTable, JS-injected) — 11 cols → card layout ────
       JS builds this table inside #dailyWorkContent. Cols:
       1 writer (rowspan'd) | 2 client | 3 S | 4 A | 5 L | 6 B | 7 Total |
       8 Published | 9 Revisions | 10 Notes | 11 actions
       rowspan collapses naturally when each <tr> becomes its own block card;
       writer cell only renders on the 1st row of each writer-group, so 2nd+
       cards lack a writer header. Acceptable: client + metrics still present. */
    .am-dashboard.company-dashboard #dailyWorkContent .table-responsive {
        overflow-x: visible !important;
    }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 11px !important;
        font-weight: 600;
        color: var(--ink-3) !important;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding-bottom: 4px !important;
    }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(2) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(3)::before  { content: "Service"; }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(4)::before  { content: "Aux"; }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(5)::before  { content: "Location"; }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(6)::before  { content: "Blog"; }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(7)::before  { content: "Total"; }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(8)::before  { content: "Published"; }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(9)::before  { content: "Revisions"; }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(n+3):nth-child(-n+9) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(n+3):nth-child(-n+9)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    /* Notes (col 10) — full-width block */
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(10) {
        padding-top: 8px !important;
        border-top: 1px dotted var(--rule) !important;
        margin-top: 6px;
    }
    /* Action col (11) — full width below */
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(11) {
        display: flex !important;
        gap: 8px;
        padding-top: 8px !important;
    }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td:nth-child(11) .btn {
        flex: 1 1 0;
        min-height: 40px;
    }
    /* Edit-mode inputs (override JS-injected inline style="width:60px") */
    .am-dashboard.company-dashboard #dailyTable tbody tr > td input[type="number"] {
        width: 100px !important;
        margin: 0 !important;
        min-height: 40px;
    }
    .am-dashboard.company-dashboard #dailyTable tbody tr > td input[type="text"] {
        width: 100% !important;
        min-height: 40px;
    }
    /* Daily Work summary strip (entries / pages / revisions / writers) */
    .am-dashboard.company-dashboard #dailyWorkContent .bg-light.border-bottom {
        flex-wrap: wrap;
        row-gap: 4px;
        column-gap: 12px !important;
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    /* ── 13. TEAM EFFICIENCY (#efficiencyContent table, JS-injected) ──────────
       cols: 1 writer | 2 pages | 3 revisions | 4 clean | 5 eff % | 6 avg/day */
    .am-dashboard.company-dashboard #efficiencyContent .table-responsive {
        overflow-x: visible !important;
    }
    .am-dashboard.company-dashboard #efficiencyContent .opt-table.gmb-table tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard #efficiencyContent .opt-table.gmb-table tbody tr > td:nth-child(2)::before { content: "Pages Written"; }
    .am-dashboard.company-dashboard #efficiencyContent .opt-table.gmb-table tbody tr > td:nth-child(3)::before { content: "Revisions"; }
    .am-dashboard.company-dashboard #efficiencyContent .opt-table.gmb-table tbody tr > td:nth-child(4)::before { content: "Clean Pages"; }
    .am-dashboard.company-dashboard #efficiencyContent .opt-table.gmb-table tbody tr > td:nth-child(5)::before { content: "Efficiency"; }
    .am-dashboard.company-dashboard #efficiencyContent .opt-table.gmb-table tbody tr > td:nth-child(6)::before { content: "Avg/Day"; }
    .am-dashboard.company-dashboard #efficiencyContent .opt-table.gmb-table tbody tr > td:nth-child(n+2) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard #efficiencyContent .opt-table.gmb-table tbody tr > td:nth-child(n+2)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    /* Team Total summary row — distinguish with sunken background */
    .am-dashboard.company-dashboard #efficiencyContent .opt-table.gmb-table tbody tr.table-active {
        background: var(--paper-3) !important;
    }

    /* ── 14. MODALS — Bulk Add + Manage Teams ───────────────────────────────── */
    /* Bulk Add Phase 1: client checkbox list goes 1 column on phone, not 2.
       The template sets inline `grid-template-columns: 1fr 1fr`. */
    #bulkAddModal #bulkClientList {
        grid-template-columns: 1fr !important;
        max-height: 280px;
    }
    #bulkAddModal .bulk-client-item {
        min-height: 40px;
    }
    /* Filter row inside the modal — full width */
    #bulkAddModal .d-flex.gap-2.mb-2 {
        flex-direction: column;
        align-items: stretch;
    }
    #bulkAddModal #bulkClientSearch {
        width: 100% !important;
    }
    #bulkAddModal .d-flex.gap-2.mb-2 .btn {
        min-height: 40px;
    }
    /* Phase 2 entry table — let it horizontal-scroll inside the modal body
       (allowed by HANDOFF §11). Slim cell padding so more cols fit pre-scroll. */
    #bulkAddModal #bulkEntryTable {
        font-size: 12px;
        min-width: 520px;
    }
    #bulkAddModal #bulkEntryTable th,
    #bulkAddModal #bulkEntryTable td {
        padding: 4px 6px !important;
    }
    #bulkAddModal #bulkEntryTable input[type="number"] {
        width: 56px !important;
        min-height: 36px;
    }

    /* Manage Teams modal: writer rows — CM <select> full width */
    #manageTeamsModal .opt-table .team-cm-select {
        width: 100% !important;
        min-height: 40px;
    }
    #manageTeamsModal #teamWriterSearch {
        width: 100% !important;
    }
    #manageTeamsModal .opt-table th,
    #manageTeamsModal .opt-table td {
        padding: 6px 8px !important;
        font-size: 13px;
    }
    /* Modal footers — wrap buttons and give them tap targets */
    #bulkAddModal .modal-footer,
    #manageTeamsModal .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    #bulkAddModal .modal-footer .btn,
    #manageTeamsModal .modal-footer .btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 44px;
    }

    /* ── 15. Catch-all: cap any leftover inline `style="width:NNNpx"` ───────── */
    /* Scoped to .am-dashboard.company-dashboard so it doesn't leak. Prevents
       a horizontal scrollbar if a future template adds another fixed-width
       input without us updating this file. */
    .am-dashboard.company-dashboard input[type="date"][style*="width"],
    .am-dashboard.company-dashboard input[type="text"][style*="width"],
    .am-dashboard.company-dashboard input[type="number"][style*="width"],
    .am-dashboard.company-dashboard select[style*="width"] {
        max-width: 100% !important;
    }

    /* =============================================================================
       MOBILE: company/action_items  (PR: mobile/action-items)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §4.12 (Cards default) + §5 (per-page card-stack pattern) and
       §11 (no overflow-x: auto on page content). The team Action Items board has
       three wide tables (Needs Review, In Progress, Completed) plus a 4-up KPI
       hero strip and a 5-control filter bar that all blow out at 360px on the
       desktop layout.

       Conversions:
       1. .am-hero-grid 4-up → 2-up grid (matches §5.2 KPI pattern)
       2. Filter bar inputs wrap, become 40px tap targets, search goes full-width
       3. All three opt-tables: flatten thead, flip <tr> into editorial cards
          - .ai-row (Needs Review): grid with priority+title on row 1, the rest
            (category, client, date) stacked below; chevron column hidden
          - .ai-expand: full-width detail panel; selects become full-width, btns
            wrap into 2-per-row tap targets
          - In Progress / Completed rows: priority+title on row 1, remaining
            cells full-width with auto-tagged data-label as small-caps eyebrow
       4. Prompt Agent modal — input sizes bumped to 40px tap targets

       CRITICAL (lesson from PRs #15/#17/#19): every <tr> flipped to display:grid
       is paired with `width: auto !important; box-sizing: border-box` on the
       <td>s — otherwise inline `style="width: 70px / 100px / 140px"` on the
       <th>s leaks via table-layout and re-introduces horizontal scroll.
       ============================================================================= */

    /* ── Page padding ───────────────────────────────────────────────────── */
    .am-dashboard.company-dashboard {
        padding: 14px 12px !important; /* overrides style.css .am-dashboard padding */
    }

    /* ── Page header: title + tagline stack ─────────────────────────────── */
    .am-dashboard.company-dashboard > .am-header {
        margin-bottom: 12px;
    }
    .am-dashboard.company-dashboard > .am-header .am-name {
        font-family: var(--serif);
        font-size: 28px;
        font-weight: 500;
        line-height: 1.1;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard > .am-header .am-contact {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
        margin-top: 4px;
    }
    .am-dashboard.company-dashboard > .am-header .am-contact span {
        white-space: normal; /* allow the tagline to wrap */
    }

    /* Inline alert (Supabase warning) — keep tight */
    .am-dashboard.company-dashboard > .alert {
        font-size: 12px;
        padding: 10px 12px;
        margin: 8px 0 12px;
    }

    /* ── Hero KPI strip: 4-up → 2-up grid per HANDOFF.md §5.2 ───────────── */
    .am-dashboard.company-dashboard .am-hero-section {
        margin-bottom: 16px;
    }
    .am-dashboard.company-dashboard .am-hero-grid {
        grid-template-columns: 1fr 1fr !important; /* override style.css 576px → 1col */
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard .am-hero-card {
        padding: 10px 12px !important; /* overrides --space-6 (24px) */
        gap: 8px !important;
        border-radius: 10px;
        align-items: center;
    }
    .am-dashboard.company-dashboard .am-hero-icon {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }
    .am-dashboard.company-dashboard .am-hero-content {
        min-width: 0;
    }
    .am-dashboard.company-dashboard .am-hero-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .am-dashboard.company-dashboard .am-hero-value {
        font-family: var(--serif);
        font-size: 22px;
        font-weight: 500;
        line-height: 1.1;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard .am-hero-subtext {
        font-family: var(--sans);
        font-size: 10.5px;
        color: var(--ink-faint);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ── cc-panel + cc-panel-header tighten ─────────────────────────────── */
    .am-dashboard.company-dashboard .cc-section {
        margin-left: 0;
        margin-right: 0;
    }
    .am-dashboard.company-dashboard .cc-panel {
        border-radius: 10px;
    }
    .am-dashboard.company-dashboard .cc-panel-header {
        padding: 10px 12px !important;
        flex-wrap: wrap;
        gap: 6px;
    }
    .am-dashboard.company-dashboard .cc-panel-header h6 {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
    }
    .am-dashboard.company-dashboard .cc-panel-header .cc-badge {
        font-size: 10px;
    }

    /* ── Filter bar (inline-styled div above #reviewTable) ──────────────── */
    /* Target the immediate div under .cc-panel that has the filter inline
       styles. We can't rely on a class, so use the inline-style signature. */
    .am-dashboard.company-dashboard .cc-panel > div[style*="border-bottom"][style*="display: flex"] {
        padding: 10px 12px !important;
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard .cc-panel > div[style*="border-bottom"][style*="display: flex"] > div[style*="position: relative"] {
        flex: 1 1 100% !important;     /* search wrapper goes full-width */
        max-width: none !important;
        min-width: 0 !important;
    }
    .am-dashboard.company-dashboard .cc-panel > div[style*="border-bottom"][style*="display: flex"] input[type="text"] {
        width: 100% !important;
        min-height: 40px !important;   /* tap target */
        padding: 8px 10px 8px 30px !important; /* preserve search-icon offset */
        font-size: 13px !important;
        max-width: none !important;
    }
    .am-dashboard.company-dashboard .cc-panel > div[style*="border-bottom"][style*="display: flex"] select {
        width: 100% !important;
        min-height: 40px !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
        max-width: none !important;
        flex: 1 1 calc(50% - 4px);     /* two selects per row */
    }

    /* ── Table → card stack: shared rules for all three opt-tables ──────── */
    .am-dashboard.company-dashboard .table-responsive {
        max-height: none !important;   /* override inline max-height: 700px / 400px */
        overflow: visible !important;  /* no internal scroll on phone */
    }
    .am-dashboard.company-dashboard .opt-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    .am-dashboard.company-dashboard .opt-table thead { display: none !important; }
    .am-dashboard.company-dashboard .opt-table tbody {
        display: block !important;
        width: 100% !important;
    }

    /* ── Needs Review rows (.ai-row) — Priority + Title on row 1 ────────── */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row {
        display: grid !important;
        grid-template-columns: auto 1fr;
        column-gap: 10px;
        row-gap: 6px;
        padding: 12px;
        margin: 0 0 8px 0;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        cursor: pointer;
        width: auto;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td {
        display: block !important;
        width: auto !important;            /* override inline th widths leaking via table-layout */
        max-width: 100% !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-sizing: border-box;
        min-width: 0;
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-body);
    }
    /* Row 1: priority badge (col 1) + title (col 2) */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 1;
        align-self: start;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1;
        min-width: 0;
    }
    /* Title text — bump a touch for legibility, allow wrap */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(2) > div[style*="font-weight"] {
        font-size: 13px !important;
        line-height: 1.3;
        white-space: normal;
    }
    /* Hide the muted single-line description preview at 360px — full text
       is shown after expansion. */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(2) > div.text-muted {
        display: none;
    }
    /* Row 2-4: category / client / date — each full-width */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(3),
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(4),
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(5) {
        grid-column: 1 / -1;
        display: inline-flex !important;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(3) { grid-row: 2; }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(4) { grid-row: 3; }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(5) {
        grid-row: 4;
        font-size: 11px !important;
        color: var(--ink-faint) !important;
    }
    /* "Submitted" eyebrow on the date cell (it has no innate label) */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(5)::before {
        content: "Submitted";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-faint);
    }
    /* Hide the chevron column — whole card is tappable; chevron clutter at 360 */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-row > td:nth-child(6) {
        display: none !important;
    }

    /* ── Needs Review expand row (.ai-expand) — full-width detail panel ─── */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand {
        display: block;                    /* JS toggles inline style="display: none / ''" */
        width: 100%;
        margin: -6px 0 8px 0;              /* nestle under the row that opened it */
        background: transparent;
        border: 0;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand > td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }
    /* The inner expand wrapper (the div inside the colspan=6 td) */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand > td > div {
        padding: 12px !important;
        border-radius: 10px !important;
        border: 1px solid var(--rule) !important;
        background: var(--paper-3) !important;
    }
    /* Action button row inside the expand panel — wrap with grid-2 layout */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand > td > div > div[style*="display: flex"] {
        flex-wrap: wrap !important;
        gap: 6px !important;
        align-items: stretch !important;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand select {
        width: 100% !important;            /* override inline width: 140px / 180px / 100px */
        min-height: 40px !important;
        font-size: 13px !important;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand .btn {
        font-size: 12px !important;
        padding: 8px 12px !important;
        min-height: 40px;
        flex: 1 1 calc(50% - 3px);
    }
    /* The dismiss "ms-auto" button — allow it to wrap with the rest */
    .am-dashboard.company-dashboard .opt-table tbody tr.ai-expand .btn.ms-auto {
        margin-left: 0 !important;
    }

    /* ── In Progress + Completed rows (no .ai-row / .ai-expand class) ───── */
    /* mobile-tables.js auto-tags every <td> with data-label="<col header>",
       so we can drive the small-caps eyebrows from data-label. */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) {
        display: grid !important;
        grid-template-columns: auto 1fr;
        column-gap: 10px;
        row-gap: 6px;
        padding: 12px;
        margin: 0 0 8px 0;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        width: auto;
        align-items: start;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td {
        display: block !important;
        width: auto !important;
        max-width: 100% !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-sizing: border-box;
        min-width: 0;
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-body);
    }
    /* Row 1: col 1 (priority badge / ✓ icon) + col 2 (title) */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 1;
        align-self: center;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1;
        font-size: 13px !important;
        font-weight: 700;
        line-height: 1.3;
        white-space: normal !important;
        min-width: 0;
    }
    /* Subsequent cells: full-row label-above-value (label from data-label) */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(n+3) {
        grid-column: 1 / -1;
        display: flex !important;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(n+3)[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-faint);
        flex-shrink: 0;
    }
    /* Drop empty cells (e.g. blank chevron column on tables that have one) */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td:nth-child(n+3):empty,
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) > td[data-label=""]:empty {
        display: none !important;
    }
    /* In Progress "Done" button cell — make full-width tap target */
    .am-dashboard.company-dashboard .opt-table tbody tr:not(.ai-row):not(.ai-expand) .btn-outline-success {
        flex: 1 1 100%;
        min-height: 40px;
        font-size: 12px !important;
        padding: 8px 12px !important;
    }

    /* ── "No results" empty-state inside #noResults ─────────────────────── */
    .am-dashboard.company-dashboard #noResults {
        padding: 24px 16px !important;
    }
    .am-dashboard.company-dashboard #noResults p {
        font-size: 12px !important;
    }

    /* ── Prompt Agent modal — tighten paddings + bump inputs to 40px ────── */
    #promptModal .modal-body {
        padding: 12px;
    }
    #promptModal .form-label {
        font-size: 11px !important;
    }
    #promptModal #promptTaskTitle {
        font-size: 13px !important;
    }
    #promptModal .form-select,
    #promptModal .form-control {
        font-size: 13px !important;
        min-height: 40px;
    }
    #promptModal textarea.form-control {
        min-height: 96px;
    }

    /* =============================================================================
       MOBILE: company/link_orders  (PR: mobile/no-horizontal-scroll)
       -----------------------------------------------------------------------------
       Link order management page — 4 tables (Active / Purchased / Paid + the
       Bulk Import CSV reference table inside its modal). Pattern matches All
       Clients (clients/index.html) and Account Hub: tables flip to card-stack
       on mobile, no horizontal scroll on the page itself, all controls become
       full-width tap targets.

       PR #15/#17/#19 lesson: when flipping <tr> to grid/flex, ALWAYS pair with
       width: auto !important + box-sizing: border-box on the <td>s, otherwise
       inherited table widths can re-introduce overflow.

       Per HANDOFF.md §5 patterns + §11 allowed scroll regions:
       - Tabs row is an explicit horizontal-scroll region (allowed).
       - All other content reflows vertically only.
       ============================================================================= */

    /* Page wrapper — trim desktop's 1.5rem padding so cards run to safe edges. */
    .link-orders-management {
        padding: 12px 14px 24px !important; /* override desktop inline 1.5rem */
    }

    /* ── Header: title + actions row ──
       Desktop puts h1, filters, search, buttons on one wrap row.
       Mobile: title on its own, then each control full-width. */
    .link-orders-management .am-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .link-orders-management .am-profile {
        width: 100%;
    }
    .link-orders-management .am-name {
        font-size: 28px !important; /* override inline 1.5rem */
    }
    .link-orders-management .am-actions {
        flex-direction: column;
        align-items: stretch !important; /* override Bootstrap align-items-center */
        gap: 10px !important;
        width: 100%;
    }
    .link-orders-management .am-actions > * {
        width: 100%;
    }

    /* Date range picker — stretch full width inside the stacked column. */
    .link-orders-management .am-actions .date-range-picker,
    .link-orders-management .am-actions [id^="linkOrderDatePicker"] {
        width: 100%;
    }

    /* Search wrap — kill desktop's min-width:200px so it can shrink. */
    .link-orders-management .lo-search-wrap {
        min-width: 0;
        width: 100%;
    }
    .link-orders-management .lo-search-input {
        width: 100%;
        min-height: 44px;
    }

    /* Filter selects — kill desktop min-width:140px, full width + tap height. */
    .link-orders-management .lo-filter-select {
        width: 100%;
        min-width: 0;
        min-height: 44px;
    }

    /* Action buttons in the header — full-width 44px tap targets. */
    .link-orders-management .am-actions .btn-primary-opt,
    .link-orders-management .am-actions .btn-secondary-opt {
        min-height: 44px;
        width: 100%;
        justify-content: center;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    /* ── KPI row: 4 cards → 2×2 grid on phones ── */
    .link-orders-management .lo-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* override desktop 768px=1col rule */
        gap: 8px;
        margin-top: 12px;
    }
    .link-orders-management .lo-kpi-card {
        padding: 12px 12px;
        gap: 10px;
        border-radius: 10px; /* editorial card radius */
    }
    .link-orders-management .lo-kpi-icon {
        font-size: 1.1rem;
    }
    .link-orders-management .lo-kpi-label {
        font-size: 9.5px;
        letter-spacing: 0.14em;
    }
    .link-orders-management .lo-kpi-value {
        font-size: 22px; /* serif 22-24px per HANDOFF §2 */
        line-height: 1.1;
    }
    .link-orders-management .lo-kpi-sub {
        font-size: 10.5px;
    }

    /* ── Insights grid → single column ── */
    .link-orders-management .lo-insights-section {
        margin-top: 16px;
    }
    .link-orders-management .lo-insights-grid {
        grid-template-columns: 1fr !important; /* harmless override; matches existing 768 */
        gap: 10px;
    }
    .link-orders-management .lo-insight-card {
        border-radius: 10px;
    }
    .link-orders-management .lo-insight-header {
        padding: 10px 12px;
        font-size: 9.5px;
        letter-spacing: 0.14em;
    }
    .link-orders-management .lo-insight-link {
        padding: 10px 12px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    .link-orders-management .lo-insight-row {
        gap: 8px;
        width: 100%;
    }
    .link-orders-management .lo-insight-client {
        font-size: 13px;
    }
    .link-orders-management .lo-insight-am {
        font-size: 11px;
    }
    .link-orders-management .lo-insight-stats {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    /* ── Table section: outer container ── */
    .link-orders-management .lo-table-section {
        margin-top: 16px;
        border-radius: 10px;
        overflow: visible; /* allow content to size; we contain overflow per-pane */
    }

    /* ── Tab bar — horizontal scroll allowed per HANDOFF §11 (tabs region) ── */
    .link-orders-management .lo-tab-bar {
        padding: 8px 8px 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .link-orders-management .lo-tabs {
        flex-wrap: nowrap;
        gap: 4px;
        min-width: max-content;
    }
    .link-orders-management .lo-tab-btn {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
        min-height: 40px;
    }
    .link-orders-management .lo-tab-count {
        font-size: 9.5px;
    }

    /* ── Table toolbar (per-tab search + count) — stack ── */
    .link-orders-management .lo-table-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px 8px;
    }
    .link-orders-management .lo-inline-search {
        width: 100%;
        min-height: 40px;
    }
    .link-orders-management .lo-row-count {
        align-self: flex-start;
    }

    /* ── Bulk action bar above Purchased table — wrap on phones ── */
    .link-orders-management .lo-bulk-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
        margin: 8px 12px 0;
    }
    .link-orders-management .lo-bulk-bar .btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 40px;
        justify-content: center;
    }

    /* ─────────────────────────────────────────────────────────────────────────
       TABLES → CARD STACKS
       Three data tables (Active / Purchased / Paid) all share .status-table
       inside .lo-table-section. Mobile pattern: hide thead, each tr becomes
       a card. The .table-responsive wrapper's overflow-x is neutralised.
       ───────────────────────────────────────────────────────────────────────── */

    .link-orders-management .lo-table-section .table-responsive {
        overflow-x: hidden;
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
    }

    .link-orders-management .lo-table-section .status-table {
        display: block;
        width: 100%;
        min-width: 0;
        border: 0;
        margin: 0;
    }

    /* Hide thead — column headers don't make sense for stacked cards. */
    .link-orders-management .lo-table-section .status-table thead {
        position: absolute;
        left: -9999px;
        top: -9999px;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }

    .link-orders-management .lo-table-section .status-table tbody {
        display: block;
        width: 100%;
        padding: 0 12px 12px;
    }

    /* Each row becomes an editorial card.
       PR #15/#17/#19 lesson: grid <tr> + width:auto on <td> below. */
    .link-orders-management .lo-table-section .status-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 10px;
        row-gap: 6px;
        align-items: start;
        width: 100%;
        padding: 12px 14px !important; /* override desktop 6px 8px td padding */
        margin-bottom: 10px;
        border: 1px solid var(--rule) !important;
        border-radius: 10px;
        background: var(--paper-2);
        box-sizing: border-box;
        animation: none !important; /* skip per-row entrance animation on phones */
    }

    /* PR #15 lesson: cells need width:auto + box-sizing when parent is grid. */
    .link-orders-management .lo-table-section .status-table tbody tr > td {
        display: block;
        width: auto !important;
        max-width: 100%;
        min-width: 0;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-sizing: border-box;
        font-size: 13px;
        line-height: 1.35;
        color: var(--ink-body) !important;
        vertical-align: top;
        text-align: left !important;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide tbody row hover background on mobile — flat editorial. */
    .link-orders-management .lo-table-section .status-table tbody tr:hover td {
        background: transparent !important;
    }

    /* ──────── ACTIVE table card layout ──────── */
    /* DOM column order:
       1=Created, 2=Client, 3=AM, 4=Target URL, 5=Anchor,
       6=Supplier, 7=Est. cost, 8=Group badge, 9=Status, 10=Actions */
    .link-orders-management #loActiveTable tbody tr > td:nth-child(2) {  /* Client */
        grid-column: 1 / -1;
        font-size: 15px;
        font-weight: 600;
        color: var(--ink) !important;
    }
    .link-orders-management #loActiveTable tbody tr > td:nth-child(2) .lo-client-link {
        font-size: 15px;
        color: var(--ink) !important;
    }
    .link-orders-management #loActiveTable tbody tr > td:nth-child(4),  /* Target URL */
    .link-orders-management #loActiveTable tbody tr > td:nth-child(5) { /* Anchor */
        grid-column: 1 / -1;
    }
    .link-orders-management #loActiveTable tbody tr > td:nth-child(1),  /* Created */
    .link-orders-management #loActiveTable tbody tr > td:nth-child(3),  /* AM */
    .link-orders-management #loActiveTable tbody tr > td:nth-child(6),  /* Supplier */
    .link-orders-management #loActiveTable tbody tr > td:nth-child(7) { /* Est */
        font-size: 12px;
        color: var(--ink-3) !important;
    }
    .link-orders-management #loActiveTable tbody tr > td:nth-child(8) { /* Group badge */
        grid-column: 1 / 2;
    }
    .link-orders-management #loActiveTable tbody tr > td:nth-child(9) { /* Status */
        grid-column: 2 / 3;
        justify-self: end;
    }
    .link-orders-management #loActiveTable tbody tr > td:nth-child(10) { /* Actions */
        grid-column: 1 / -1;
        margin-top: 4px;
        padding-top: 8px !important;
        border-top: 1px solid var(--rule) !important;
    }

    /* ──────── PURCHASED table card layout ──────── */
    /* DOM order:
       1=checkbox, 2=Purchased date, 3=Client, 4=AM, 5=Target URL, 6=Anchor,
       7=Supplier, 8=Actual cost, 9=Group, 10=Status, 11=Invoice, 12=Delivered, 13=Actions */

    /* Hide the bulk-select checkbox column on mobile — admin feature, doesn't
       map to a card. Same approach as All Clients .col-bulk hide. */
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(1) {
        display: none !important;
    }
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(3) { /* Client */
        grid-column: 1 / -1;
        font-size: 15px;
        font-weight: 600;
        color: var(--ink) !important;
    }
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(3) .lo-client-link {
        font-size: 15px;
        color: var(--ink) !important;
    }
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(5),  /* Target URL */
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(6) { /* Anchor */
        grid-column: 1 / -1;
    }
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(2),  /* Date */
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(4),  /* AM */
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(7),  /* Supplier */
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(8) { /* Cost */
        font-size: 12px;
        color: var(--ink-3) !important;
    }
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(9) {  /* Group */
        grid-column: 1 / 2;
    }
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(10) { /* Status */
        grid-column: 2 / 3;
        justify-self: end;
    }
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(11), /* Invoice */
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(12) { /* Delivered */
        font-size: 12px;
    }
    .link-orders-management #loPurchasedTable tbody tr > td:nth-child(13) { /* Actions */
        grid-column: 1 / -1;
        margin-top: 4px;
        padding-top: 8px !important;
        border-top: 1px solid var(--rule) !important;
    }

    /* ──────── PAID table card layout ──────── */
    /* DOM order:
       1=Paid date, 2=Client, 3=AM, 4=Target URL, 5=Anchor,
       6=Supplier, 7=Actual, 8=Group, 9=Invoice, 10=Delivered, 11=Actions */
    .link-orders-management #loPaidTable tbody tr > td:nth-child(2) { /* Client */
        grid-column: 1 / -1;
        font-size: 15px;
        font-weight: 600;
        color: var(--ink) !important;
    }
    .link-orders-management #loPaidTable tbody tr > td:nth-child(2) .lo-client-link {
        font-size: 15px;
        color: var(--ink) !important;
    }
    .link-orders-management #loPaidTable tbody tr > td:nth-child(4),  /* Target URL */
    .link-orders-management #loPaidTable tbody tr > td:nth-child(5) { /* Anchor */
        grid-column: 1 / -1;
    }
    .link-orders-management #loPaidTable tbody tr > td:nth-child(1),  /* Paid date */
    .link-orders-management #loPaidTable tbody tr > td:nth-child(3),  /* AM */
    .link-orders-management #loPaidTable tbody tr > td:nth-child(6),  /* Supplier */
    .link-orders-management #loPaidTable tbody tr > td:nth-child(7) { /* Actual cost */
        font-size: 12px;
        color: var(--ink-3) !important;
    }
    .link-orders-management #loPaidTable tbody tr > td:nth-child(8) {  /* Group */
        grid-column: 1 / 2;
    }
    .link-orders-management #loPaidTable tbody tr > td:nth-child(9),  /* Invoice */
    .link-orders-management #loPaidTable tbody tr > td:nth-child(10) { /* Delivered */
        font-size: 12px;
    }
    .link-orders-management #loPaidTable tbody tr > td:nth-child(11) { /* Actions */
        grid-column: 1 / -1;
        margin-top: 4px;
        padding-top: 8px !important;
        border-top: 1px solid var(--rule) !important;
    }

    /* ──────── Group-child rows (expanded sub-orders) ──────── */
    /* Style as nested sub-cards: slimmer, indented, paper-3 background.
       They share the same grid layout as parent rows. */
    .link-orders-management .lo-table-section .status-table tbody tr.group-child-row {
        background: var(--paper-3) !important;
        border-color: var(--rule) !important;
        margin-left: 12px;
        margin-top: -6px;   /* pull up under parent for visual grouping */
        padding: 10px 12px !important;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    /* URL / anchor links inside cards — make tappable & truncate gracefully. */
    .link-orders-management .lo-table-section .lo-url-link {
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: middle;
        color: var(--ink-body);
    }
    .link-orders-management .lo-table-section .lo-client-link {
        word-break: break-word;
    }

    /* Actions cell — let buttons wrap horizontally inside the card footer. */
    .link-orders-management .lo-table-section .actions-col {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }
    .link-orders-management .lo-table-section .actions-col > * {
        flex: 0 1 auto;
    }
    /* Render macro buttons at a touch-friendly size when stacked. */
    .link-orders-management .lo-table-section .actions-col .btn {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Status badge in its own cell — keep compact. */
    .link-orders-management .lo-table-section .lo-badge {
        font-size: 9.5px;
        padding: 3px 8px;
        letter-spacing: 0.14em;
    }

    /* ─────────────────────────────────────────────────────────────────────────
       BULK IMPORT MODAL — reference table inside <details>
       Convert .lo-ref-table to a card-stack too. The modal scrolls vertically;
       no horizontal scroll inside.
       ───────────────────────────────────────────────────────────────────────── */

    #bulkImportModal .table-responsive {
        overflow-x: hidden !important; /* override Bootstrap .table-responsive overflow-x:auto */
        max-height: 50vh;
        overflow-y: auto;
    }
    #bulkImportModal .lo-ref-table {
        display: block;
        width: 100%;
        font-size: 12px;
    }
    #bulkImportModal .lo-ref-table thead {
        position: absolute;
        left: -9999px;
        top: -9999px;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }
    #bulkImportModal .lo-ref-table tbody,
    #bulkImportModal .lo-ref-table tr {
        display: block;
        width: 100%;
    }
    #bulkImportModal .lo-ref-table tr {
        padding: 10px 12px;
        margin-bottom: 8px;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper-2);
        box-sizing: border-box;
    }
    #bulkImportModal .lo-ref-table td {
        display: block;
        width: auto !important;
        padding: 2px 0 !important;
        border: 0 !important;
        font-size: 12px;
        color: var(--ink-body);
        background: transparent !important;
        box-sizing: border-box;
        white-space: normal;
        word-break: break-word;
    }
    #bulkImportModal .lo-ref-table td:nth-child(1) { /* field name */
        font-family: var(--mono, ui-monospace, monospace);
        font-weight: 600;
        font-size: 13px;
        color: var(--ink);
        margin-bottom: 4px;
    }
    #bulkImportModal .lo-ref-table td:nth-child(3),
    #bulkImportModal .lo-ref-table td:nth-child(4) {
        font-size: 11.5px;
        color: var(--ink-3);
    }
    #bulkImportModal .lo-ref-table td:nth-child(3)::before {
        content: "Format: ";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }
    #bulkImportModal .lo-ref-table td:nth-child(4)::before {
        content: "Example: ";
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }

    /* ─────────────────────────────────────────────────────────────────────────
       GROUP / MERGE MODAL — the add-client rows use flex with inline
       flex:1 1 0 on each child, which squeezes the select past usable width
       at 360px. Stack them on phones.
       ───────────────────────────────────────────────────────────────────────── */
    #groupModal .add-client-row {
        flex-direction: column;
        gap: 8px;
    }
    #groupModal .add-client-row > .form-select,
    #groupModal .add-client-row > .form-control {
        width: 100% !important; /* override inline flex:1 1 0 width auto */
        flex: 1 1 100% !important;
    }

    /* Merge orders list inside group modal — already scrolls vertically; just
       make sure it doesn't introduce horizontal overflow. */
    #mergeOrdersList {
        overflow-x: hidden;
    }

    /* Group member rows (injected from JS in editLinkOrder) — stack on phones */
    #companyEditGroupMembersList .group-member-row {
        flex-wrap: wrap;
    }
    #companyEditGroupMembersList .group-member-row .group-member-anchor {
        flex: 1 1 100% !important; /* override JS-inlined flex:1 1 0 */
        width: 100%;
    }

    /* Empty-state padding on small screens */
    .link-orders-management .lo-empty-state {
        padding: 32px 16px;
    }

    /* =============================================================================
       MOBILE: company/problem_clients  (PR: mobile/no-horizontal-scroll)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §4.12 (Tables → Cards) + §5 patterns (mirror All Clients /
       Account Hub Ledger). The page has 2 sources of horizontal scroll:

         1. .pc-table-wrap with `overflow-x: auto` → the 7-column status table
            cannot fit ≤414px. We flip the table to a vertical card-stack so
            the wrapper no longer needs to scroll, then override the wrapper to
            overflow-x: visible.
         2. 7 inline widths in the template (search input min-width:160px /
            max-width:220px, manager select min-width:140px, reason cell
            min-width:180px, inline padding-right on days + action cells,
            inline margin-left:auto on the flag-button wrapper) that fight the
            card layout. We override each with auto / 100% / margin-left:0.

       The secondary table (#logHistoryBody) is already handled above as an
       allowed scroll region per HANDOFF §11 (modal bodies are explicit scroll
       containers).

       HANDOFF mapping → template classes:
         - card: padding 14px, 1px var(--rule), 10px radius, var(--paper-2)
         - card title: sans 14px semibold (.client-name)
         - sub-meta: 11px var(--ink-3) (.client-meta)
         - eyebrow labels: sans 9.5px / 500 / 0.14em / uppercase / var(--ink-3)
           injected via ::before per cell since the template has no data-label
           attrs on these <td>s.
         - pills: 9.5px uppercase letter-spacing 0.14em (.stage-pill)
         - score chips: 6px radius, ≥32px wide (.score-select)
         - buttons: ≥36px tap target, sans 11.5px

       Data hidden on mobile: none. All 7 columns surface as labeled rows in
       the card. The "View N log(s)" toggle and Add Note / Resolve buttons all
       continue to work via the existing JS handlers.
       ============================================================================= */

    /* Kill the .pc-table-wrap overflow-x scroll — convert to card stack. */
    .company-dashboard .status-table-wrapper.pc-table-wrap {
        overflow-x: visible;
        -webkit-overflow-scrolling: auto;
        border: 0;
        background: transparent;
        border-radius: 0;
        margin: 0;
    }

    /* Flatten the main table. Scope via `> .status-table-wrapper` so we don't
       touch the embedded log-history modal table (#logHistoryBody .status-table)
       which is intentionally an allowed scroll region (HANDOFF §11). */
    .company-dashboard > .status-table-wrapper .status-table {
        display: block;
        width: 100%;
        min-width: 0;
        border-collapse: separate;
        font-family: var(--sans);
    }

    /* Hide the table head — eyebrow labels go inline via ::before per cell. */
    .company-dashboard > .status-table-wrapper .status-table > thead {
        display: none;
    }

    .company-dashboard > .status-table-wrapper .status-table > tbody {
        display: block;
        width: 100%;
    }

    /* Each problem-client row becomes a card.
       Grid layout:
         row 1: client name + AM meta            (col-client, full width)
         row 2: stage pill (left)  | days (right)
         row 3: health (left)      | results (right)
         row 4: reason + view-logs toggle        (full width)
         row 5: actions (Add Note + Resolve)     (right-aligned)                 */
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr {
        display: grid;
        grid-template-columns: 1fr auto;
        column-gap: 10px;
        row-gap: 8px;
        align-items: center;
        padding: 12px 14px;
        margin: 0 0 10px 0;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        animation: none;          /* desktop has fade-in keyframes; drop on mobile */
    }

    /* All <td>s lose their table widths so the grid wins.
       CRITICAL (PR #15/#17/#19 lesson): when flipping <tr> to display:grid,
       always pair with `width: auto !important; box-sizing: border-box` on <td>s. */
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td {
        display: block;
        width: auto !important; /* !important: defeats inline min-width:180px on reason cell */
        min-width: 0 !important; /* !important: defeats inline min-width on reason cell */
        max-width: 100%;
        box-sizing: border-box;
        padding: 0;
        border: 0;
        background: transparent;
        white-space: normal;
        text-align: left;        /* defeats inline text-align:center/right on days + actions */
        vertical-align: top;
    }

    /* ── Row 1: client name + AM (full width) ─────────────────────────────── */
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td.col-client {
        grid-column: 1 / -1;
        grid-row: 1;
    }
    .company-dashboard > .status-table-wrapper .status-table .client-cell {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }
    .company-dashboard > .status-table-wrapper .status-table .client-cell .client-name {
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 600;
        line-height: 1.25;
        text-decoration: none;
        word-break: break-word;
    }
    .company-dashboard > .status-table-wrapper .status-table .client-cell .client-meta {
        font-size: 11px;
        line-height: 1.3;
        color: var(--ink-3) !important; /* !important: page CSS sets var(--ink-faint) with !important */
    }

    /* ── Row 2: stage pill (left) + days-open (right) ─────────────────────── */
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td.col-stage {
        grid-column: 1 / 2;
        grid-row: 2;
        justify-self: start;
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td.col-stage .stage-pill {
        font-size: 9.5px;
        letter-spacing: 0.14em;
        padding: 3px 8px;
    }

    /* The 6th cell (Days) has no class — it's the only un-classed <td> with
       text-align:center inline. Target by position: 6th-of-type (after col-client,
       col-stage, col-health, col-results, reason). */
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td:nth-of-type(6) {
        grid-column: 2 / 3;
        grid-row: 2;
        justify-self: end;
        align-self: center;
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td:nth-of-type(6)::before {
        content: "Days open";
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
        text-align: right;
    }

    /* ── Row 3: Health + Results (eyebrow-labeled score chips) ────────────── */
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td.col-health {
        grid-column: 1 / 2;
        grid-row: 3;
        justify-self: start;
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td.col-results {
        grid-column: 2 / 3;
        grid-row: 3;
        justify-self: end;
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td.col-health::before,
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td.col-results::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td.col-health::before {
        content: "Health";
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td.col-results::before {
        content: "Results";
        text-align: right;
    }
    /* Score select chips: compact, 6px radius per HANDOFF §3.4 / §4.7 */
    .company-dashboard > .status-table-wrapper .status-table .score-select {
        font-size: 12px;
        padding: 3px 8px;
        border-radius: 6px;
        min-width: 32px;
    }

    /* ── Row 4: Reason text + view-logs toggle (full width) ───────────────── */
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td:nth-of-type(5) {
        grid-column: 1 / -1;
        grid-row: 4;
        font-size: 13px;
        color: var(--ink-body);
        line-height: 1.4;
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td:nth-of-type(5)::before {
        content: "Reason";
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td:nth-of-type(5) > div {
        font-size: 13px;
        line-height: 1.4;
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td:nth-of-type(5) > button {
        font-size: 11px;
        margin-top: 4px;
        min-height: 32px;
        padding: 4px 0;
    }

    /* ── Row 5: Actions (Add Note + Resolve OR "Resolved" label) ──────────── */
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td:nth-of-type(7) {
        grid-column: 1 / -1;
        grid-row: 5;
        display: flex !important; /* !important: overrides display:block default applied above */
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
        padding-right: 0 !important; /* !important: defeats inline padding-right:1rem */
        white-space: normal !important; /* !important: defeats inline white-space:nowrap */
    }
    .company-dashboard > .status-table-wrapper .status-table > tbody > tr > td:nth-of-type(7) > button {
        min-height: 36px;
        padding: 8px 14px;
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.04em;
        border-radius: 6px;
        margin: 0;          /* gap handles spacing */
    }

    /* ── pc-header: tighten on phones ─────────────────────────────────────── */
    .company-dashboard .pc-header {
        margin-bottom: 16px;
        padding-bottom: 14px;
    }
    .company-dashboard .pc-header h1 {
        font-family: var(--serif);
        font-size: 28px;
        line-height: 1.1;
    }
    .company-dashboard .pc-header p {
        font-size: 13px;
        color: var(--ink-3);
    }

    /* ── pc-stat-grid: 2×2 on phones (template @media already triggers but
          reinforce with editorial tokens — drop the radial-gradient + inset
          shadow per HANDOFF §4.5 flat-cards rule). ──────────────────────── */
    .company-dashboard .pc-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 14px;
    }
    .company-dashboard .pc-stat-card {
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        padding: 12px;
        box-shadow: none;          /* drop inset gold glow on mobile */
        animation: none;           /* drop scaleIn keyframes on mobile */
    }
    .company-dashboard .pc-stat-card.pc-danger {
        border-left: 3px solid var(--accent);
    }
    .company-dashboard .pc-stat-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    .company-dashboard .pc-stat-value {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.1;
        color: var(--ink);
    }

    /* ── pc-toolbar: stack the controls; defeat the inline widths ─────────── */
    .company-dashboard .pc-toolbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
        border-radius: 10px;
        margin-bottom: 12px;
        animation: none;
    }
    /* Search input: full-width on phones (defeats inline min-width:160px /
       max-width:220px). */
    .company-dashboard .pc-toolbar #searchInput {
        flex: 1 1 100% !important; /* !important: defeats inline min-width/max-width on the element */
        min-width: 0 !important;
        max-width: 100% !important;
        min-height: 40px;
    }
    /* Manager select: half-width (defeats inline width:auto;min-width:140px). */
    .company-dashboard .pc-toolbar #filterManager {
        flex: 1 1 140px !important;
        width: auto !important;
        min-height: 40px;
    }
    /* Show-resolved switch keeps its natural width */
    .company-dashboard .pc-toolbar .form-check.form-switch {
        flex: 1 1 auto;
    }
    /* Flag-client button wrapper: defeat inline margin-left:auto so it wraps
       to its own line cleanly */
    .company-dashboard .pc-toolbar > div[style*="margin-left"] {
        margin-left: 0 !important; /* !important: defeats inline margin-left:auto */
        flex: 1 1 100%;
    }
    .company-dashboard .pc-toolbar > div[style*="margin-left"] .btn {
        width: 100%;
        min-height: 44px;
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        border-radius: 6px !important; /* !important: page CSS sets 16px with !important */
    }

    /* ── Empty state: tighter padding on phones ───────────────────────────── */
    .company-dashboard .pc-empty {
        padding: 40px 16px;
    }
    .company-dashboard .pc-empty h5 {
        font-size: 20px;
    }

    /* =============================================================================
       MOBILE: company/activities  (PR: mobile/no-horizontal-scroll)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5 (per-page card-stack pattern) and §11 (no overflow-x:auto
       on page content). Activity Hub is the dashboard's worst inline-width offender
       (~57 fixed widths across 3 action-item tables + the comm-item rows + a 3-pane
       layout). Prior work already:
         · flattened .ah-layout to single-column
         · hid .ah-sidebar at ≤767
         · converted .comm-item rows to card-stack grids
         · card-stacked the 3 #actionItemsPanel tables
         · made the channel-tabs strip horizontally scrollable (§11 exception)

       This round mops up the remaining 360px overflow sources that those rules
       didn't catch: the Activity-Hub page header (justify-content:space-between
       with no wrap), the toolbar's margin-left:auto right cluster, the bulk-bar
       right cluster, the assign-detail select (width:200px), the recording audio
       (min-width:200px), and the two detail-panel info columns (min-width:180px).

       CRITICAL: any selector that touches a row flipped to display:grid (or its
       td/div children) re-asserts width:auto !important; min-width:0; max-width:
       100% to defeat the inline width declarations on the template. (See PR #15/
       #17/#19 lesson — display:grid alone does not neutralise inline widths.)
       ============================================================================= */

    /* ── Page header strip (line 151 of template) — desktop sets
       display:flex; align-items:center; justify-content:space-between with no
       wrap, so on a 360px viewport the Gmail-sync chip + button get pushed off
       the right edge. Allow wrap and set gap. Selector targets the first child
       div under the page wrapper that carries the bottom border + space-between. */
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] {
        flex-wrap: wrap;
        gap: 10px;
        padding-bottom: 12px !important;     /* override inline 1rem (16px) */
        margin-bottom: 12px !important;
    }
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] > div {
        min-width: 0;
        max-width: 100%;
    }
    /* Title within that header — keep readable at narrow widths, drop the
       desktop letter-spacing -0.02em crunch. */
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] h1.nx-section-heading {
        font-size: 24px !important;          /* desktop is 2rem (32px) */
        line-height: 1.15 !important;
        letter-spacing: -0.01em !important;
    }
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] p {
        font-size: 13px !important;
    }
    /* Gmail sync cluster — let it flow under the title block, full width */
    .am-dashboard.company-dashboard > div[style*="border-bottom"][style*="space-between"] > div[style*="gap:0.75rem"] {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px !important;
    }
    #gmail-sync-btn {
        min-height: 36px;
        font-size: 12px !important;
    }

    /* ── Toolbar (line 242) — right-cluster with margin-left:auto can stay
       inline on tablet widths but at ≤480 should flow to its own row, full
       width. The existing rule (.ah-main > div[style*="padding: 8px 20px"])
       already pads + gaps the parent; this rule targets the inner cluster. */
    .ah-main > div[style*="padding: 8px 20px"] > div[style*="margin-left: auto"] {
        margin-left: 0 !important;            /* desktop margin-left: auto */
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .ah-main > div[style*="padding: 8px 20px"] > div[style*="margin-left: auto"] > button {
        min-height: 36px;
        min-width: 36px;
    }
    /* The client-filter chip — ensure long client names ellipsis */
    #ahClientLabel {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* ── Bulk-bar inner right cluster (line 268) — parent already wraps via
       earlier rule, but the margin-left:auto on this child sticks. Reset. */
    .bulk-bar > div[style*="margin-left: auto"] {
        margin-left: 0 !important;
        width: 100%;
        justify-content: flex-end;
    }
    .bulk-bar button {
        min-height: 36px;
    }

    /* ── Detail panel: "Assign to client" row (line 458–467) appears for any
       comm whose thread.client_id is null. The select has inline width:200px
       which collides with the visible button on a 360px viewport. Stack to
       a full-width column. */
    .comm-detail > div[style*="padding-top: 1.5rem"] > div[style*="align-items: center"] {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .comm-detail select[id^="assign-detail-"] {
        width: 100% !important;               /* override inline width: 200px */
        min-height: 40px;
        font-size: 13px !important;
    }
    .comm-detail > div[style*="padding-top: 1.5rem"] button {
        min-height: 40px;
        width: 100%;                          /* button below the select */
    }

    /* ── Detail panel: single-comm details (line 400) — two columns each with
       inline flex:1; min-width:180px; on a 360px viewport (≈332px usable
       inside the detail) two 180px cols don't fit so flex-wrap kicks in, but
       the inner grid (line 405) `auto 1fr` can still blow out with long phone
       numbers. Stack to one column + force word-break. */
    .comm-detail > div[style*="gap: 20px"] {
        gap: 12px !important;
        flex-direction: column;
    }
    .comm-detail > div[style*="gap: 20px"] > div[style*="min-width: 180px"] {
        min-width: 0 !important;              /* override inline min-width: 180px */
        max-width: 100% !important;
        width: 100%;
    }
    .comm-detail > div[style*="gap: 20px"] > div[style*="min-width: 180px"] > div[style*="grid-template-columns"] {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* ── Detail panel: recording row (line 429) — audio has inline
       min-width:200px which pushes the "Open" button off-screen at 360px when
       combined with internal audio controls. Allow audio full width + button
       wraps below. */
    .comm-detail > div[style*="margin-bottom: 14px"] > div[style*="flex-wrap: wrap"] {
        gap: 8px !important;
    }
    .comm-detail audio[controls] {
        min-width: 0 !important;              /* override inline min-width: 200px */
        max-width: 100% !important;
        width: 100% !important;
        flex: 1 1 100% !important;
    }
    .comm-detail audio[controls] + a.btn {
        width: 100%;
        min-height: 40px;
    }

    /* ── Thread message detail (line 374) — tighten padding so each bordered
       sub-card fits at 360px. */
    .comm-detail > div[style*="padding-top: 14px"] > div[style*="border-left"] {
        padding: 10px 12px !important;
    }

    /* ── Text-bubble MMS images (line 354) — never overflow the bubble */
    .text-bubble img {
        max-width: 100% !important;           /* override inline max-width: 200px */
        height: auto !important;
    }
    .text-bubble a[href][target="_blank"] {
        max-width: 100%;
    }

    /* ── Comm action-item card inside detail (line 444) — wrap so the priority
       pill on the right never gets pushed beyond viewport. */
    .comm-action-item {
        flex-wrap: wrap;
        padding: 10px 12px !important;
        gap: 6px !important;
    }
    .comm-action-item > div[style*="flex: 1"] {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* ── Action-Items panel (#actionItemsPanel) — existing rules already
       card-stack the 3 tables. Add belt-and-suspenders so any tr/td that still
       carries inline width or long client names doesn't reintroduce overflow. */
    #actionItemsPanel .opt-table tbody tr,
    #actionItemsPanel .opt-table tbody tr > td {
        max-width: 100%;
        box-sizing: border-box;
    }
    #actionItemsPanel .opt-table tbody tr > td > div,
    #actionItemsPanel .opt-table tbody tr > td > span {
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    /* In-Progress + Completed tables don't have an action-buttons cell; the
       "Done" button (line 597) still needs a tap target. */
    #actionItemsPanel .opt-table tbody tr > td .btn-primary-opt,
    #actionItemsPanel .opt-table tbody tr > td .btn-secondary-opt,
    #actionItemsPanel .opt-table tbody tr > td .btn-danger-opt {
        min-height: 36px;
        padding: 6px 10px !important;         /* override inline padding: 4px 8px */
    }

    /* ── cc-panel headers within the action-items panel — at narrow widths
       the title + badge + chevron crowd. Allow wrap. */
    #actionItemsPanel .cc-panel-header {
        flex-wrap: wrap;
        gap: 6px;
    }
    #actionItemsPanel .cc-panel-header h3 {
        font-size: 14px;
        margin: 0;
    }

    /* ── Global safety net: the .am-dashboard.company-dashboard wrapper should
       never produce horizontal scroll. Anything that slips past the rules
       above gets clipped at the page wrapper. */
    .am-dashboard.company-dashboard {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* =============================================================================
       MOBILE: account_managers/detail  (PR: mobile/no-horizontal-scroll)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5.7 — Manager detail: breadcrumb, header (avatar lg + serif
       name + email/location), date-range + Edit, 4 hero stats (2×2), secondary
       stats grid, filter row, client list as cards.

       The detail page's <table.status-table> is wrapped by .am-clients-section, so
       the existing card-stack rules (lines ~2892–3120) already convert rows to
       cards on mobile. BUT the AM-detail template's <td>s have no `data-label`
       attribute, so those rules' `td[data-label]::before` labels don't render.
       This section adds explicit labels via :nth-child + ::before so the
       compact 3-col grid (Stage / Health / Results, then Tenure / MRR) reads
       correctly for AMs reviewing portfolios on the go.

       Also kills horizontal scroll sources unique to this page:
       - breadcrumb (3 items) wraps
       - .am-profile h1 has inline font-size:2rem — shrink to serif 28px
       - .am-hero-grid + .am-secondary-grid: tighten the 2-col fallback
       - .clients-filter-bar: chip-row look
       - All inline font-size 0.7rem / 0.78rem on <td>s + flex/grid contents
         get overridden with strict spacing-scale values.

       Per CRITICAL LESSON (PRs #15/#17/#19): when flipping <tr> to display:grid,
       pair with `width: auto !important` + `box-sizing: border-box` on the <td>s.
       ============================================================================= */

    /* ── Breadcrumb: wrap, uppercase small-caps per HANDOFF §2 labels ─────── */
    .am-dashboard > nav[aria-label="breadcrumb"] {
        margin-bottom: 12px;
    }
    .am-dashboard .breadcrumb {
        flex-wrap: wrap;
        gap: 4px 6px;
        margin: 0;
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }
    .am-dashboard .breadcrumb-item,
    .am-dashboard .breadcrumb-item a {
        font-size: 10.5px;
        color: var(--ink-3);
    }
    .am-dashboard .breadcrumb-item.active {
        color: var(--ink);
    }

    /* ── Header: stacked profile, name shrinks to fit, contact wraps ──────── */
    /* The base .am-dashboard > .am-header rule (line ~1133) already sets
       flex-direction: column; this just refines the inner profile + name. */
    .am-dashboard .am-header .am-profile {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        min-width: 0;
    }
    .am-dashboard .am-header .am-avatar,
    .am-dashboard .am-header .am-avatar-placeholder {
        width: 56px;
        height: 56px;
        flex-shrink: 0;
        border-radius: 999px;
        object-fit: cover;
    }
    .am-dashboard .am-header .am-info {
        flex: 1 1 auto;
        min-width: 0;
    }
    /* Override the inline font-size:2rem on the manager name — serif 28px per
       HANDOFF §2 (h-page acceptable mobile scale). Inline style needs
       !important to win specificity vs inline `style=""`. */
    .am-dashboard .am-header .am-info h1 {
        font-family: var(--serif) !important;
        font-size: 28px !important;
        font-weight: 500 !important;
        line-height: 1.1 !important;
        letter-spacing: -0.01em !important;
        color: var(--ink) !important;
        word-break: break-word;
    }
    .am-dashboard .am-header .am-contact {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 12px;
        margin-top: 6px;
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
    }
    .am-dashboard .am-header .am-contact a,
    .am-dashboard .am-header .am-contact span {
        font-size: 12px;
        word-break: break-word;
    }

    /* ── Actions row (date picker + Edit + dashboard links): full-width column,
       date-picker must shrink. The base .am-actions rule already makes buttons
       full-width; this just makes sure the date-range-picker wrapper does too. */
    .am-dashboard .am-header .am-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .am-dashboard .am-header .am-actions > * {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .am-dashboard .am-header .am-actions .date-range-picker,
    .am-dashboard .am-header .am-actions .date-range-picker > * {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* ── Hero KPI grid: force 2×2 on phones per HANDOFF §5.7 ──────────────── */
    /* The template's inline @media (max-width:768px) sets 2 cols; the inline
       @media (max-width:576px) collapses to 1 col. Force 2-col across the
       whole mobile breakpoint so the 4 hero stats read as a 2×2 block, even
       on 360px phones. !important needed to beat the inline-style block's
       grid-template-columns !important on .am-hero-grid. */
    .am-dashboard .am-hero-section {
        margin-bottom: 16px;
    }
    .am-dashboard .am-hero-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .am-dashboard .am-hero-card {
        padding: 12px !important;
        min-width: 0;
        border-radius: 10px !important;
        gap: 8px;
        box-sizing: border-box;
    }
    .am-dashboard .am-hero-card .am-hero-icon {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
        font-size: 14px;
    }
    .am-dashboard .am-hero-card .am-hero-content {
        min-width: 0;
        flex: 1 1 auto;
    }
    .am-dashboard .am-hero-card .am-hero-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .am-dashboard .am-hero-card .am-hero-value {
        font-family: var(--serif) !important;
        font-size: 24px !important;
        font-weight: 500 !important;
        line-height: 1.1 !important;
        color: var(--ink) !important;
        word-break: break-word;
    }
    .am-dashboard .am-hero-card .am-hero-max {
        font-size: 13px;
        color: var(--ink-3);
    }
    /* Inline style="font-size:0.7rem" on .am-hero-subtext (Active Clients card
       breakdown line) needs override to land on spacing scale. */
    .am-dashboard .am-hero-card .am-hero-subtext {
        font-family: var(--sans);
        font-size: 11px !important; /* override inline font-size:0.7rem */
        color: var(--ink-3) !important;
        margin-top: 4px !important;
        white-space: normal;
        word-break: break-word;
    }
    .am-dashboard .am-hero-card .health-mini-dist {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin-top: 4px;
    }
    .am-dashboard .am-hero-card .health-mini,
    .am-dashboard .am-hero-card .results-mini {
        font-size: 9.5px;
        padding: 1px 6px;
        letter-spacing: 0.06em;
    }

    /* ── Secondary KPI grid: 2-col on phones, override template's 1-col
       fallback at 576px so 7 cards stay as a 2-col block (last card spans 1
       track and leaves one empty cell at the end — acceptable). */
    .am-dashboard .am-secondary-section {
        margin-bottom: 16px;
    }
    .am-dashboard .am-secondary-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .am-dashboard .am-secondary-card {
        padding: 10px 12px !important;
        min-width: 0;
        border-radius: 10px !important;
        box-sizing: border-box;
    }
    .am-dashboard .am-secondary-card .am-secondary-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        margin-bottom: 6px;
        min-width: 0;
    }
    .am-dashboard .am-secondary-card .am-secondary-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }
    .am-dashboard .am-secondary-card .am-secondary-value {
        font-family: var(--serif) !important;
        font-size: 20px !important;
        font-weight: 500 !important;
        line-height: 1.15 !important;
        color: var(--ink) !important;
        word-break: break-word;
    }
    .am-dashboard .am-secondary-card .am-secondary-detail {
        font-family: var(--sans);
        font-size: 11px !important; /* override inline font-size:0.7rem */
        color: var(--ink-3) !important;
        margin-top: 2px;
        line-height: 1.3;
        word-break: break-word;
    }
    .am-dashboard .am-secondary-card .stage-bar {
        height: 4px;
        border-radius: 999px;
        background: var(--paper-3);
        overflow: hidden;
    }
    .am-dashboard .am-secondary-card .stage-bar .stage-fill {
        height: 100%;
    }
    .am-dashboard .am-secondary-card .stage-badge {
        font-size: 9.5px;
        padding: 1px 6px;
        letter-spacing: 0.06em;
        flex-shrink: 0;
    }
    /* Hover arrow on clickable cards — hide on touch so it doesn't take space */
    .am-dashboard .am-secondary-card .am-card-arrow {
        display: none;
    }
    /* Inline-styled <i class="text-muted" style="font-size:0.7rem"> next to
       "Time To Results" label — keep it inline-block and tiny. */
    .am-dashboard .am-secondary-card .am-secondary-label .bi-info-circle {
        font-size: 10px !important;
    }

    /* ── Filter bar: stack label+select pairs in a 2-col wrap, count chip at end ─ */
    .am-dashboard .clients-filter-bar {
        margin-bottom: 12px;
        padding: 10px 12px !important;
        border-radius: 10px !important;
    }
    .am-dashboard .clients-filter-form {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-end;
    }
    .am-dashboard .clients-filter-group {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .am-dashboard .clients-filter-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }
    .am-dashboard .clients-filter-select {
        width: 100%;
        min-height: 36px;
        padding: 6px 10px !important;
        font-family: var(--sans);
        font-size: 13px !important;
        border-radius: 6px !important;
        box-sizing: border-box;
    }
    .am-dashboard .clients-filter-count {
        flex: 1 1 100%;
        font-family: var(--sans);
        font-size: 11px;
        color: var(--ink-3);
        text-align: right;
        margin-top: 2px;
    }

    /* ── Clients section: tighten section margin + kill stray overflow ───── */
    .am-dashboard .am-clients-section {
        margin-bottom: 16px;
        max-width: 100%;
        min-width: 0;
    }
    .am-dashboard .am-clients-section .status-table-wrapper {
        border-radius: 10px !important;
        background: transparent !important; /* desktop tints wrapper, mobile uses per-card surface */
        border: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    /* ── Inject data-labels onto AM-detail <td>s via :nth-child ──────────────
       The shared .am-clients-section card-stack rules at lines ~2892–3120 use
       td[data-label]::before. AM-detail's template doesn't set data-label, so
       we synthesise per-cell labels by column position.

       Column order in AM-detail table (matches <thead> order):
         1. Client     (.col-client — full row, no label needed)
         2. Stage      (.col-stage)
         3. Health     (.col-health)
         4. Results    (.col-results)
         5. Tenure     (no class, inline text-align:center)
         6. MRR        (admin only, no class)

       Use class selectors for cols 1–4 and :nth-child(N) for cols 5–6 since
       Tenure/MRR have no class. .col-client is always nth-child(1). */
    .am-dashboard .am-clients-section .status-table tr.client-row > td.col-stage::before {
        content: "Stage";
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
        line-height: 1.2;
    }
    .am-dashboard .am-clients-section .status-table tr.client-row > td.col-health::before {
        content: "Health";
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
        line-height: 1.2;
    }
    .am-dashboard .am-clients-section .status-table tr.client-row > td.col-results::before {
        content: "Results";
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
        line-height: 1.2;
    }
    /* Tenure = 5th child (1=client, 2=stage, 3=health, 4=results, 5=tenure) */
    .am-dashboard .am-clients-section .status-table tr.client-row > td:nth-child(5)::before {
        content: "Tenure";
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
        line-height: 1.2;
    }
    /* MRR = 6th child (admin only) */
    .am-dashboard .am-clients-section .status-table tr.client-row > td:nth-child(6)::before {
        content: "MRR";
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
        line-height: 1.2;
    }

    /* Card layout: 3-col grid identical to All Clients pattern (lines ~2999+).
       The shared rule already does this BUT was scoped via [data-label]
       checks in places. Re-assert grid + cell width:auto here as defensive
       belt-and-braces per the CRITICAL LESSON from PRs #15/#17/#19:
       when flipping <tr> to display:grid, ALWAYS pair with
       `width: auto !important; box-sizing: border-box` on the <td>s. */
    .am-dashboard .am-clients-section .status-table tr.client-row {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        column-gap: 8px !important;
        row-gap: 8px !important;
        padding: 10px 12px !important;
        align-items: start;
        background: var(--paper-2) !important;
        border: 1px solid var(--rule) !important;
        border-radius: 10px !important;
        margin-bottom: 8px !important;
        box-sizing: border-box;
        min-width: 0;
        max-width: 100%;
    }
    .am-dashboard .am-clients-section .status-table tr.client-row > td {
        width: auto !important;            /* CRITICAL: pair grid with width:auto */
        box-sizing: border-box !important;
        padding: 0 !important;
        min-width: 0 !important;
        max-width: 100% !important;
        text-align: left !important;       /* override inline style="text-align:center" on Health/Results/Tenure */
        overflow: hidden;
    }
    /* Client cell = full-width header */
    .am-dashboard .am-clients-section .status-table tr.client-row > td.col-client {
        grid-column: 1 / -1;
        margin-bottom: 2px;
        font-size: inherit !important;
    }
    .am-dashboard .am-clients-section .status-table tr.client-row > td.col-client::before {
        display: none !important;
    }
    .am-dashboard .am-clients-section .status-table tr.client-row .client-cell {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }
    .am-dashboard .am-clients-section .status-table tr.client-row .client-name {
        font-family: var(--sans) !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        color: var(--ink) !important;
        line-height: 1.25;
        word-break: break-word;
    }
    .am-dashboard .am-clients-section .status-table tr.client-row .client-meta {
        font-family: var(--sans);
        font-size: 11px;
        color: var(--ink-3);
        line-height: 1.3;
        word-break: break-word;
    }

    /* Value text on the 5 metric cells. Templates inline style="font-size:0.78rem"
       on Tenure + MRR — override to land on spacing scale (13px). */
    .am-dashboard .am-clients-section .status-table tr.client-row > td.col-stage,
    .am-dashboard .am-clients-section .status-table tr.client-row > td.col-health,
    .am-dashboard .am-clients-section .status-table tr.client-row > td.col-results,
    .am-dashboard .am-clients-section .status-table tr.client-row > td:nth-child(5),
    .am-dashboard .am-clients-section .status-table tr.client-row > td:nth-child(6) {
        font-family: var(--sans) !important;
        font-size: 13px !important;       /* override inline style="font-size:0.78rem" */
        font-weight: 500 !important;
        color: var(--ink-body) !important; /* override inline color: var(--ink-muted) */
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Score dots — keep compact pill height. The base .score-dot rules at
       lines ~168+ already set the colour palette; just constrain size here. */
    .am-dashboard .am-clients-section .status-table tr.client-row .score-dot {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 24px;
        height: 22px;
        padding: 0 6px;
        font-size: 12px;
        font-weight: 600;
    }

    /* Stage pill — compact, no wrap */
    .am-dashboard .am-clients-section .status-table tr.client-row .stage-pill {
        display: inline-block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
        font-size: 9.5px;
        padding: 2px 8px;
    }

    /* Empty state: keep editorial. */
    .am-dashboard .empty-state {
        text-align: center;
        padding: 32px 16px;
    }
    .am-dashboard .empty-state .display-1 {
        font-size: 48px;
        color: var(--ink-3);
    }
    .am-dashboard .empty-state h4 {
        font-family: var(--serif);
        font-size: 22px;
        font-weight: 500;
        margin: 12px 0 6px;
        color: var(--ink);
    }
    .am-dashboard .empty-state p {
        font-family: var(--sans);
        font-size: 14px;
        color: var(--ink-3);
        margin: 0;
    }

    /* Global page wrapper guard — the .am-dashboard root has no inline padding,
       so make sure nothing inside it can push the viewport wider. */
    .am-dashboard {
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }


    /* =============================================================================
       MOBILE: clients/gsc_report  (PR: mobile/gsc-report)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §5 (per-page card-stack pattern) + §11 (no horizontal scroll
       on body content). Google Search Console report has 5 data tables + 4 chart
       widgets + 4 KPI tiles + a 6-control filter bar. Desktop ships
       `.gsc-table { min-width: 600px }` inside `.gsc-table-wrapper { overflow-x: auto }`
       which forces sideways scrolling at 360px on every row. Pattern matches the
       All Clients (`clients/index.html`) + GA4 report passes:
         - filter bar -> single-column stack, 44px tap targets
         - KPI grid   -> 2x2 (desktop forces 1 col which makes tall stacks)
         - widget rows -> single column stack, charts capped at 260px
         - donut sub-tables (Ranking, Device) -> compact in-flow tables
         - big tables (Country, Keywords, Pages) -> card-stack:
             row 1 = full-width query/page/country title
             row 2 = 2x2 grid of Impressions/Clicks/CTR/Position with ::before labels

       Template does NOT extend `.results-page`, so the earlier
       `.results-page .gsc-*` rules above don't apply — these target `.gsc-report`.

       PR #15/#17/#19 lesson applied: every tr-as-grid pairs with
       `td { width: auto !important; box-sizing: border-box }` so cells don't
       inherit the desktop min-width: 600px from .gsc-table.

       No data hidden on mobile — all 5 tables, all 4 charts, all 4 KPIs render.
       Heatmap rgba backgrounds on metric tds (set inline by JS) are preserved.
       ============================================================================= */

    /* -- Page wrapper: belt-and-braces no horizontal overflow ---------------- */
    .gsc-report {
        max-width: 100%;
        overflow-x: hidden;
        padding: 12px 14px;
    }

    /* -- Header: title + back button stack column --------------------------- */
    .gsc-report .gsc-report-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 12px;
    }
    .gsc-report .gsc-report-header .breadcrumb {
        font-size: 12px;
        margin-bottom: 6px !important;     /* override Bootstrap's mb-2 inline class */
    }
    .gsc-report .gsc-title {
        font-family: var(--serif);
        font-weight: 500;
        font-size: 24px;
        line-height: 1.15;
        letter-spacing: -0.01em;
        margin: 0;
    }
    .gsc-report .gsc-subtitle {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
        margin: 4px 0 0;
        overflow-wrap: anywhere;           /* GSC property URLs are long */
    }
    .gsc-report .gsc-header-right .btn {
        width: 100%;
        min-height: 44px;
    }

    /* -- Filter bar: column-stack, full-width 44px tap targets -------------- */
    .gsc-report .gsc-filter-bar {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 12px;
    }
    .gsc-report .gsc-filters-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .gsc-report .gsc-filter-group {
        width: 100%;
        min-width: 0;
    }
    .gsc-report .gsc-filter-group > label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    .gsc-report .gsc-filter-group .form-select,
    .gsc-report .gsc-filter-group .form-control,
    .gsc-report .gsc-filter-group select,
    .gsc-report .gsc-filter-group input,
    .gsc-report .gsc-filter-group .btn {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }
    /* Apply Filters group: the "&nbsp;" spacer label is noise once stacked */
    .gsc-report .gsc-apply-group > label {
        display: none;
    }
    .gsc-report .gsc-apply-group .btn {
        font-family: var(--sans);
        font-weight: 600;
        font-size: 11.5px;
        letter-spacing: 0.16em;
        text-transform: uppercase;
    }

    /* -- KPI grid: 2x2 (desktop's <768 rule sets 1 col -> 4 tall tiles) ----- */
    .gsc-report .gsc-kpi-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .gsc-report .gsc-kpi-tile,
    .gsc-report .gsc-kpi-tile.gsc-kpi-large,
    .gsc-report .gsc-kpi-tile.gsc-kpi-dark {
        padding: 12px;
        border-radius: 10px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        box-shadow: none;
        min-width: 0;
    }
    /* The dark variant preserves its desktop background via .gsc-kpi-dark::before
       overlay; we just match radius/padding above. */
    .gsc-report .gsc-kpi-value,
    .gsc-report .gsc-kpi-tile.gsc-kpi-large .gsc-kpi-value {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.1;
    }
    .gsc-report .gsc-kpi-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        margin-top: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .gsc-report .gsc-kpi-delta {
        font-family: var(--sans);
        font-size: 10px;
        margin-top: 2px;
    }

    /* -- Rows: single-column stack, kill any leftover grid columns --------- */
    .gsc-report .gsc-row,
    .gsc-report .gsc-row-hero,
    .gsc-report .gsc-row-full {
        display: block;
        grid-template-columns: none;
        margin-bottom: 12px;
    }

    /* -- Widget container --------------------------------------------------- */
    .gsc-report .gsc-widget {
        border-radius: 10px;
        margin-bottom: 12px;
        box-shadow: none;
        min-width: 0;
    }
    .gsc-report .gsc-widget-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .gsc-report .gsc-widget-title {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
        line-height: 1.2;
    }
    /* Per-widget search box (Keyword Performance, Landing Page Performance) --
       drops below the title to its own line at 44px tap height. */
    .gsc-report .gsc-widget-search {
        width: 100%;
    }
    .gsc-report .gsc-widget-search input {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }
    .gsc-report .gsc-widget-body {
        padding: 12px 14px;
    }

    /* -- Chart canvases: cap height, force responsive width ---------------- */
    .gsc-report .gsc-widget-body canvas {
        max-width: 100% !important;        /* override Chart.js inline width attr */
        height: auto !important;            /* let Chart.js maintain aspect ratio */
        max-height: 260px;
    }
    /* Donut charts (Ranking, Device) -- fixed square, smaller on mobile */
    .gsc-report .gsc-ranking-chart,
    .gsc-report .gsc-device-chart {
        width: 140px;
        height: 140px;
        margin: 0 auto;
    }
    .gsc-report .gsc-ranking-chart canvas,
    .gsc-report .gsc-device-chart canvas {
        max-height: 140px;
    }

    /* -- Ranking / Device content: stack donut over mini-table ------------- */
    .gsc-report .gsc-ranking-content,
    .gsc-report .gsc-device-content {
        display: flex !important;          /* override desktop grid-template at <768 */
        flex-direction: column;
        gap: 12px;
    }
    .gsc-report .gsc-ranking-table,
    .gsc-report .gsc-device-table {
        width: 100%;
        overflow-x: hidden;
    }

    /* -- Mini tables (Ranking, Device): keep tabular, just tighten --------- */
    .gsc-report .gsc-table-mini {
        width: 100%;
        min-width: 0;
        font-size: 12px;
        table-layout: fixed;
    }
    .gsc-report .gsc-table-mini th,
    .gsc-report .gsc-table-mini td {
        padding: 8px 6px;
        word-break: break-word;
    }
    .gsc-report .gsc-table-mini th {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }

    /* -- Big tables (Country, Keywords, Pages): card-stack mode ------------ */

    /* 1. Cancel desktop's scroll wrapper / height cap. */
    .gsc-report .gsc-table-wrapper,
    .gsc-report .gsc-country-content {
        max-height: none;
        overflow-x: hidden;
        overflow-y: visible;
        border: 0;
    }

    /* 2. Table itself becomes a block; kill min-width: 600px. */
    .gsc-report .gsc-country-content > .gsc-table,
    .gsc-report .gsc-table-wrapper > .gsc-table {
        display: block;
        width: 100%;
        min-width: 0;
        font-size: 13px;
        border-collapse: separate;
    }

    /* 3. Hide thead (labels move to ::before on each metric cell). */
    .gsc-report .gsc-country-content > .gsc-table > thead,
    .gsc-report .gsc-table-wrapper > .gsc-table > thead {
        display: none;
    }
    .gsc-report .gsc-country-content > .gsc-table > tbody,
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody {
        display: block;
        width: 100%;
    }

    /* 4. Each row -> card. Title cell spans both columns; 4 metric cells form
          a 2x2 grid beneath it. */
    .gsc-report .gsc-country-content > .gsc-table > tbody > tr,
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody > tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 8px;
        row-gap: 8px;
        padding: 12px;
        margin: 0 0 8px 0;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
    }
    /* Cancel zebra striping so even rows don't override the card background. */
    .gsc-report .gsc-table-striped > tbody > tr:nth-child(even) {
        background: var(--paper-2);
    }

    /* 5. CRITICAL (PR #15/#17/#19 lesson): td must reset width + box-sizing or
          grid items inherit the desktop min-width: 600px from .gsc-table and
          re-trigger horizontal scroll. */
    .gsc-report .gsc-country-content > .gsc-table > tbody > tr > td,
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody > tr > td {
        display: block;
        width: auto !important;            /* break inherited min-width: 600px */
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        padding: 0 !important;             /* grid gap handles spacing */
        border: 0;
        text-align: left !important;       /* override .text-end so labels align with values */
        font-family: var(--sans);
        font-size: 12px;
        line-height: 1.3;
        color: var(--ink-body);
        overflow: hidden;
    }

    /* 6. First cell = card title (Query / Page / Country). Spans both cols. */
    .gsc-report .gsc-country-content > .gsc-table > tbody > tr > td:first-child,
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody > tr > td:first-child {
        grid-column: 1 / -1;
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
        color: var(--ink);
        white-space: normal;
        overflow: visible;
        overflow-wrap: anywhere;           /* break long URLs / queries */
        text-overflow: clip;
        padding-bottom: 4px !important;
        border-bottom: 1px dotted var(--rule);
    }

    /* 7. Metric cells (cols 2-5): label-above-value via ::before */
    /* Keywords + Pages tables (in .gsc-table-wrapper): cols = Query|Imp|Clk|CTR|Pos */
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody > tr > td:nth-child(2)::before {
        content: "Impressions";
    }
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody > tr > td:nth-child(3)::before {
        content: "Clicks";
    }
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody > tr > td:nth-child(4)::before {
        content: "CTR";
    }
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody > tr > td:nth-child(5)::before {
        content: "Position";
    }
    /* Country table (in .gsc-country-content): cols = Country|Imp|Clk|CTR|Pos */
    .gsc-report .gsc-country-content > .gsc-table > tbody > tr > td:nth-child(2)::before {
        content: "Impressions";
    }
    .gsc-report .gsc-country-content > .gsc-table > tbody > tr > td:nth-child(3)::before {
        content: "Clicks";
    }
    .gsc-report .gsc-country-content > .gsc-table > tbody > tr > td:nth-child(4)::before {
        content: "CTR";
    }
    .gsc-report .gsc-country-content > .gsc-table > tbody > tr > td:nth-child(5)::before {
        content: "Position";
    }
    /* Shared label styling */
    .gsc-report .gsc-country-content > .gsc-table > tbody > tr > td:nth-child(n+2)::before,
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody > tr > td:nth-child(n+2)::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
        line-height: 1.2;
    }
    /* Metric value styling -- sans 14px, padded so heatmap rgba bg has breathing room */
    .gsc-report .gsc-country-content > .gsc-table > tbody > tr > td:nth-child(n+2),
    .gsc-report .gsc-table-wrapper > .gsc-table > tbody > tr > td:nth-child(n+2) {
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 500;
        color: var(--ink);
        padding: 6px 8px !important;       /* breathing room around inline rgba heatmap bg */
        border-radius: 6px;
    }

    /* 8. Unbind the desktop ellipsis caps on .gsc-cell-query / .gsc-cell-url
          (max-width: 280px; white-space: nowrap) so query/URL text wraps. */
    .gsc-report .gsc-cell-query,
    .gsc-report .gsc-cell-url,
    .gsc-report .gsc-cell-page {
        max-width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .gsc-report .gsc-cell-url,
    .gsc-report .gsc-cell-page {
        font-size: 12px;
    }

    /* 9. Color dot + country flag inline markers -- preserve. */
    .gsc-report .gsc-color-dot {
        flex-shrink: 0;
        margin-right: 6px;
        vertical-align: middle;
    }
    .gsc-report .gsc-country-flag {
        flex-shrink: 0;
        margin-right: 6px;
        vertical-align: middle;
    }

    /* -- Misc states -------------------------------------------------------- */
    .gsc-report .gsc-global-error {
        font-size: 12px;
        padding: 10px 12px;
        border-radius: 10px;
        margin-bottom: 12px;
        flex-wrap: wrap;
    }
    .gsc-report .gsc-widget-loading,
    .gsc-report .gsc-widget-empty,
    .gsc-report .gsc-widget-error {
        font-size: 13px;
        padding: 20px 12px;
    }

    /* =============================================================================
       MOBILE: /company/subscriptions
       -----------------------------------------------------------------------------
       Per HANDOFF.md §4.10 (cards) / §4.12 (tables → card stacks) / §5 (no horiz
       scroll on page content). Template uses .am-dashboard.company-dashboard wrap,
       which already inherits a generic card-stack pattern intended for the page's
       sister templates (account_hub, content/performance). Those generic rules
       inject WRONG labels onto #subTable cells (Writers / Total Pages / etc. from
       L6506 "anonymous" CM Team Performance rule, and zero-content data-label
       eyebrows from L5312 because mobile-tables.js never tags #subTable — it has
       no data-mobile="cards" attribute).

       This block:
         · Re-scopes the card-stack layout to #subTable with ID-specificity so the
           bleeding cell-label content from L5312 / L6506 is overridden.
         · Provides correct positional labels for cols 2-9 (Type / Amount / Billing
           / Monthly / Start / End / Status / Notes).
         · Promotes col 1 (Name) to card title; col 10 (Actions) to a full-width
           button row.
         · Hides the tfoot totals row — value already in the Monthly Cost hero KPI.
         · Keeps the bulk-import modal Field Reference inner table scrollable
           (modal scroll is preserved by the existing L6324 rule — §11 exception).
         · Stacks the collapsible Add form's col-md-* row gracefully + bumps inputs
           to 40px tap targets.

       CRITICAL (PR #15/#17/#19 lesson): every <tr> flipped to display:grid is
       paired with `width: auto !important; box-sizing: border-box` on its <td>
       children — otherwise the desktop's th-driven table-layout widths leak back
       in and re-introduce horizontal scroll.
       ============================================================================= */

    /* /company/subscriptions — page-level alert (Supabase warning) inherits from
       .am-dashboard.company-dashboard rules at L5062 — nothing to add. */

    /* /company/subscriptions — hero KPI strip is 3-up on desktop; let inherited
       L5072 (1fr 1fr) collapse it to 2-up. The 3rd card (Annual Cost) flows to
       row 2 on its own — that's intentional, the two monetary cards anchor row 1
       together so the eye reads Active → Monthly → Annual top-to-bottom-left. */

    /* /company/subscriptions — card header (filter + actions cluster). Inherits
       wrap + 100%-width form-control from L6273; we only need to keep the H6
       readable + ensure inline buttons (Add, Bulk Import) sit on their own row. */
    .am-dashboard.company-dashboard section.card > .card-header h6 {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
        color: var(--ink);
        flex: 1 1 100%;
        margin-bottom: 4px;
    }
    .am-dashboard.company-dashboard section.card > .card-header .table-row-count {
        font-size: 11px;
        order: 99; /* push count to the end of the wrapped flex row */
    }
    .am-dashboard.company-dashboard section.card > .card-header .btn {
        min-height: 40px;
        padding: 8px 12px;
        font-size: 12px;
    }

    /* /company/subscriptions — collapsible Add subscription form */
    .am-dashboard.company-dashboard #addSubscriptionForm .card-body {
        padding: 12px;
    }
    .am-dashboard.company-dashboard #addSubscriptionForm .row {
        row-gap: 8px;
    }
    .am-dashboard.company-dashboard #addSubscriptionForm .form-label.small {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    .am-dashboard.company-dashboard #addSubscriptionForm .form-control,
    .am-dashboard.company-dashboard #addSubscriptionForm .form-select,
    .am-dashboard.company-dashboard #addSubscriptionForm .input-group > .form-control {
        min-height: 40px;
        font-size: 13px;
    }
    .am-dashboard.company-dashboard #addSubscriptionForm .input-group-text {
        min-height: 40px;
        font-size: 13px;
    }
    /* "Save" button — full width tap target on its own row */
    .am-dashboard.company-dashboard #addSubscriptionForm button[type="submit"] {
        width: 100%;
        min-height: 44px;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.04em;
    }

    /* /company/subscriptions — #subTable: override the inherited (wrong) cell
       labels and grid layout from L5312 + L6506, install the correct 10-col
       card-stack pattern. */
    .am-dashboard.company-dashboard #subTable {
        display: block;
        width: 100%;
        min-width: 0;
    }
    .am-dashboard.company-dashboard #subTable thead {
        /* visually hide but keep accessible */
        position: absolute !important; /* required to defeat the inherited L5177 display:none, since some AT helpers ignore display:none */
        left: -9999px !important;
        top: -9999px !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
    }
    .am-dashboard.company-dashboard #subTable tbody {
        display: block;
        width: 100%;
    }

    /* Each row → editorial card (block layout, NOT grid — sidesteps the L5312
       2-col grid that would put Type in the title slot). */
    .am-dashboard.company-dashboard #subTable tbody tr {
        display: block !important;
        width: 100% !important;            /* paired with td width:auto below */
        box-sizing: border-box;
        padding: 12px 14px;
        margin: 0 0 10px 0;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper-2);
        /* neutralise the inherited L5312 grid + L5184 ai-row card grid */
        grid-template-columns: none;
        column-gap: 0;
        row-gap: 0;
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td {
        display: block !important;
        width: auto !important;            /* paired with tr width:100% — PR #15/#17/#19 lesson */
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 3px 0 !important;
        border: 0 !important;
        background: transparent !important;
        text-align: left !important;       /* override the desktop .text-end on Amount + Monthly Equiv. */
        font-family: var(--sans);
        font-size: 13px;
        line-height: 1.35;
        color: var(--ink-body);
        /* defeat the inherited L5339-L5360 grid-column / grid-row placements */
        grid-column: auto;
        grid-row: auto;
    }

    /* Col 1 (Name) — card title */
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
        white-space: normal;
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(1) a {
        color: var(--ink);
        text-decoration: none;
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(1) a:hover,
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(1) a:focus {
        color: var(--accent);
    }

    /* Cols 2-8: label-above-value pattern (positional labels — template has no
       data-label attrs because #subTable is not tagged with data-mobile="cards"). */
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(2),
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(3),
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(4),
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(5),
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(6),
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(7),
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(8) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 5px 0 !important;
        gap: 10px;
        font-size: 13px;
    }
    /* Override label content from the inherited L6515-L6520 "CM Team Performance"
       bleed (Writers / Total Pages / Published / Revisions / Efficiency /
       Cost/Page). Specificity here is (1,2,3) vs (0,4,3) — IDs trump. */
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(2)::before { content: "Type"; }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(3)::before { content: "Amount"; }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(4)::before { content: "Billing"; }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(5)::before { content: "Monthly"; }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(6)::before { content: "Start"; }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(7)::before { content: "End"; }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(8)::before { content: "Status"; }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(n+2):nth-child(-n+8)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
        /* defeat the inherited L5361-L5370 attr(data-label) eyebrow (would be
           empty since no JS tagged this table). Our static content above wins. */
    }
    /* Value side of cols 2-8: align right + allow numeric values to be mono */
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(2) {
        /* Type cell — capitalised replacement text already provided by template */
        color: var(--ink) !important;
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(3),
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(5) {
        font-variant-numeric: tabular-nums;
        color: var(--ink) !important;
        font-weight: 500;
    }

    /* Status badge — keep pill shape from the page's existing
       .badge.bg-success / .badge.bg-secondary; just ensure it stays compact */
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(8) .badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    /* Col 9 (Notes) — full-width muted block under the divider, only render if
       non-empty (template prints "—" for empty notes, which we hide). */
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(9) {
        display: block !important;
        width: 100% !important;
        padding: 8px 0 0 0 !important;
        margin-top: 6px;
        border-top: 1px dotted var(--rule) !important;
        font-size: 12px !important;
        color: var(--ink-3) !important;
        font-style: italic;
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(9):empty {
        display: none !important;
    }
    /* (We can't CSS-hide a cell that contains only the literal "—" placeholder
       without :has — which is not relied on here. The em-dash is visually subtle
       at 12px italic and acceptable as a "no notes" indicator.) */

    /* Col 10 (Actions) — full-width row of pill buttons. Cell contains a
       div.d-flex.gap-1 with [edit-button] + [delete-form]. */
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(10) {
        display: block !important;
        width: 100% !important;
        padding: 8px 0 0 0 !important;
        margin-top: 6px;
        border-top: 1px dotted var(--rule) !important;
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(10) > div.d-flex {
        display: flex !important;
        gap: 8px !important;
        width: 100%;
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(10) .btn {
        flex: 1 1 0;
        min-height: 40px;
        font-size: 13px;
        padding: 8px 10px;
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(10) form.d-inline {
        flex: 1 1 0;
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(10) form.d-inline .btn {
        width: 100%;
    }
    /* No ::before on the Actions cell — clear any inherited eyebrow */
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(10)::before {
        content: none !important; /* override generic L5361 / L6529 ::before injection */
    }
    .am-dashboard.company-dashboard #subTable tbody tr > td:nth-child(9)::before {
        content: none !important; /* notes block doesn't need a small-caps eyebrow */
    }

    /* Ended (text-muted) rows — keep them readable on mobile (the desktop
       opacity: 0.35 from this page's <style> makes them nearly invisible
       against the dark paper-2 background of our cards). */
    .am-dashboard.company-dashboard #subTable tbody tr.text-muted {
        opacity: 0.6;
    }
    .am-dashboard.company-dashboard #subTable tbody tr.text-muted td {
        opacity: 1; /* don't double-fade — opacity is on the row */
    }

    /* tfoot totals row — hide on mobile. Monthly Cost is already in the hero
       KPI strip at the top of the page, and the colspan/rowspan layout would
       fight the card-stack pattern. */
    .am-dashboard.company-dashboard #subTable tfoot {
        display: none !important;
    }

    /* /company/subscriptions — Edit Subscription modal: inherits modal sizing
       from base mobile rules. Just ensure the col-md-4 / col-md-6 split rows
       inside stack to full-width (Bootstrap handles this below md, but we tap-
       target the inputs). */
    #editSubscriptionModal .modal-body {
        padding: 14px;
    }
    #editSubscriptionModal .form-label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    #editSubscriptionModal .form-control,
    #editSubscriptionModal .form-select {
        min-height: 44px;
        font-size: 14px;
    }
    #editSubscriptionModal .input-group-text {
        min-height: 44px;
        font-size: 14px;
    }
    #editSubscriptionModal textarea.form-control {
        min-height: 80px;
    }
    #editSubscriptionModal .modal-footer .btn {
        min-height: 44px;
        flex: 1 1 0;
        font-size: 13px;
    }

    /* /company/subscriptions — Bulk Import modal */
    #bulkImportSubModal .modal-body {
        padding: 14px;
    }
    #bulkImportSubModal .alert {
        font-size: 12px;
        padding: 10px 12px;
    }
    #bulkImportSubModal .form-control[type="file"] {
        min-height: 44px;
        font-size: 13px;
        padding: 10px;
    }
    #bulkImportSubModal details summary {
        min-height: 32px;
        padding: 4px 0;
    }
    /* Field Reference inner table inside <details> — the existing L6324 rule
       restores horizontal scroll inside .modal .table-responsive (§11 exception
       for modals with their own scroll containers). The 4-col reference table
       is small + read-only + scrollable inside its 320px container — leave it
       alone. */
    #bulkImportSubModal .modal-footer .btn {
        min-height: 44px;
        flex: 1 1 0;
        font-size: 13px;
    }

    /* /company/subscriptions — empty-state body (when there are no subs) */
    .am-dashboard.company-dashboard section.card > .card-body > p.text-muted {
        font-size: 13px;
        padding: 14px 0;
        margin: 0;
    }

    /* =============================================================================
       MOBILE: company/payments_schedule  (PR: mobile/payments-schedule)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing) + §4 (cards/pills/stats) + §5 (per-page card-stack).

       Desktop layout inventory (all sources of horizontal pressure at <=767.98px):
         1. .am-header: row of [title] + [.am-actions: 2 .form-select + switch + badge]
            — 4 controls on one line, overflows.
         2. .payments-summary-grid: 3-col grid of .am-hero-card (page CSS forces
            grid-template-columns: 1fr at <=576px already, but the cards still need
            mobile padding/typography normalization).
         3. .payables-reconcile .pr-row: 3-col grid (label | value | pct). Page CSS
            already stacks to 1 col at <=640px, but we still want the container
            to fit our spacing scale.
         4. #weekTabs: horizontal nav — page CSS already enables overflow-x: auto
            at <=768px (allowed per spec: tab strips MAY scroll horizontally).
         5. .payments-table (8 cols inside .cc-table-scroll): scrolls horizontally
            on desktop. Mobile MUST flip to card-stack with one card per <tr>.
            Spec lesson PR #15/#17/#19: width: auto !important on <td> AND
            box-sizing: border-box, else cells inherit table-layout: fixed widths
            (this page's CSS sets `.payments-table { table-layout: fixed; width: 100% }`
            and column <th> widths up to 180px — cells must be freed).
         6. .payments-total-row in <tfoot>: also flips to a single full-width
            summary card.
         7. Missing-info table (4 cols): same card-stack treatment.
         8. .payments-legend: already flex-wraps; just normalize padding/font.

       All rules anchored on `.am-dashboard.company-dashboard.payments-schedule` to
       win specificity against the page's inline <style> block AND avoid bleed into
       the other /company/payments (tracker) page which uses .am-dashboard
       .company-dashboard with a `data-mobile="cards"` table attribute.
       ============================================================================= */

    /* /company/payments_schedule — page wrapper / no horizontal overflow */
    .am-dashboard.company-dashboard.payments-schedule {
        padding: 12px 14px;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* /company/payments_schedule — page header: stack title above filters */
    .am-dashboard.company-dashboard.payments-schedule > .am-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--rule);
    }
    .am-dashboard.company-dashboard.payments-schedule > .am-header .am-profile {
        gap: 8px;
    }
    .am-dashboard.company-dashboard.payments-schedule .am-name {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.15;
        margin: 0;
    }
    .am-dashboard.company-dashboard.payments-schedule .am-contact {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
        flex-wrap: wrap;
        gap: 6px 12px;
    }

    /* /company/payments_schedule — filter cluster: stack full-width 44px controls */
    .am-dashboard.company-dashboard.payments-schedule > .am-header .am-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .am-dashboard.company-dashboard.payments-schedule > .am-header .am-actions .form-select {
        width: 100% !important;       /* override inline style="width:auto" */
        min-width: 0 !important;       /* override inline min-width:120px */
        min-height: 44px;
        font-size: 14px;
        border-radius: 10px !important;
    }
    .am-dashboard.company-dashboard.payments-schedule > .am-header .am-actions .form-check.form-switch {
        margin-left: 0 !important;     /* defeat .ms-2 utility */
        padding-left: 2.4em;           /* room for switch UI */
        min-height: 32px;
        display: flex;
        align-items: center;
    }
    .am-dashboard.company-dashboard.payments-schedule > .am-header .am-actions .form-check-label {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-body);
        display: inline-flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }

    /* /company/payments_schedule — summary hero grid: stack 1-up at phone width */
    .am-dashboard.company-dashboard.payments-schedule .payments-summary-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;   /* defeat desktop 3-col */
        gap: 10px;
    }
    .am-dashboard.company-dashboard.payments-schedule .am-hero-card {
        padding: 14px;
        border-radius: 10px !important;          /* tame desktop 20px */
        box-shadow: none !important;
        animation: none !important;              /* drop entrance animation on mobile */
        display: flex;
        align-items: flex-start;
        gap: 10px;
        min-width: 0;
    }
    .am-dashboard.company-dashboard.payments-schedule .am-hero-card:hover {
        transform: none !important;              /* kill desktop lift hover */
    }
    .am-dashboard.company-dashboard.payments-schedule .am-hero-icon {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
    }
    .am-dashboard.company-dashboard.payments-schedule .am-hero-content {
        min-width: 0;
        flex: 1;
    }
    .am-dashboard.company-dashboard.payments-schedule .am-hero-label {
        font-family: var(--sans);
        font-size: 10.5px !important;
        font-weight: 500 !important;
        letter-spacing: 0.14em !important;
        text-transform: uppercase;
        color: var(--ink-3) !important;
    }
    .am-dashboard.company-dashboard.payments-schedule .am-hero-value {
        font-family: var(--serif) !important;
        font-size: 24px !important;
        font-weight: 500 !important;
        line-height: 1.1;
        margin-top: 2px;
        overflow-wrap: anywhere;                 /* very large totals don't break layout */
    }
    .am-dashboard.company-dashboard.payments-schedule .am-hero-subtext {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
        margin-top: 4px;
        overflow-wrap: anywhere;
    }
    /* "Becoming MRR" tag + nested list inside Ascended card */
    .am-dashboard.company-dashboard.payments-schedule .becoming-mrr-tag {
        font-size: 10.5px;
        padding: 3px 8px;
        margin-top: 8px;
        white-space: normal;
    }
    .am-dashboard.company-dashboard.payments-schedule .becoming-mrr-list {
        margin-top: 8px !important;
    }
    .am-dashboard.company-dashboard.payments-schedule .becoming-mrr-client {
        flex-wrap: wrap;
        gap: 2px 8px;
        padding: 6px 0;
        font-size: 12px;
    }
    .am-dashboard.company-dashboard.payments-schedule .becoming-mrr-name,
    .am-dashboard.company-dashboard.payments-schedule .becoming-mrr-detail {
        font-size: 12px;
        word-break: break-word;
    }

    /* /company/payments_schedule — reconciliation block (the .pr-row grids
       already stack via the page's own <=640px rule; just normalize padding) */
    .am-dashboard.company-dashboard.payments-schedule .payables-reconcile {
        margin: 14px 0 0;
        padding: 12px;
        border-radius: 10px;
    }
    .am-dashboard.company-dashboard.payments-schedule .payables-reconcile__title {
        flex-wrap: wrap;
        font-size: 10.5px;
        letter-spacing: 0.14em;
        gap: 6px;
    }
    .am-dashboard.company-dashboard.payments-schedule .payables-reconcile__ok,
    .am-dashboard.company-dashboard.payments-schedule .payables-reconcile__warn {
        margin-left: 0;                          /* let it wrap naturally under title */
    }
    .am-dashboard.company-dashboard.payments-schedule .pr-label {
        font-size: 13px;
    }
    .am-dashboard.company-dashboard.payments-schedule .pr-val {
        font-size: 16px;
    }
    .am-dashboard.company-dashboard.payments-schedule .pr-pct {
        font-size: 12px;
    }

    /* /company/payments_schedule — week tabs strip: keep horizontal scroll
       (allowed per spec) but tighten padding + tap target */
    .am-dashboard.company-dashboard.payments-schedule #weekTabs {
        padding: 0 4px;
        margin-bottom: 0;
    }
    .am-dashboard.company-dashboard.payments-schedule #weekTabs .nav-link {
        min-height: 56px;                        /* keeps total + breakdown legible */
        padding: 8px 12px;
        border-radius: 10px 10px 0 0;
        font-size: 12px;
    }
    .am-dashboard.company-dashboard.payments-schedule .week-tab-total {
        font-size: 16px;
        margin-top: 2px;
    }
    .am-dashboard.company-dashboard.payments-schedule .week-tab-breakdown {
        gap: 6px;
        margin-top: 4px;
        flex-wrap: wrap;
    }
    .am-dashboard.company-dashboard.payments-schedule .week-tag-mrr,
    .am-dashboard.company-dashboard.payments-schedule .week-tag-ascended {
        font-size: 9.5px;
        letter-spacing: 0.14em;
        padding: 2px 6px;
    }

    /* /company/payments_schedule — week panel + tab content container */
    .am-dashboard.company-dashboard.payments-schedule .card.cc-panel,
    .am-dashboard.company-dashboard.payments-schedule section.card {
        border-radius: 10px !important;
        animation: none !important;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-week-header {
        padding: 12px !important;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-week-header h5 {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
        line-height: 1.2;
        margin: 0 0 4px;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-week-header p {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
    }

    /* /company/payments_schedule — payments table -> card-stack
       Defeat .cc-table-scroll's overflow-x:auto AND the page's own
       .table-responsive { overflow-x: auto } so we go vertical. */
    .am-dashboard.company-dashboard.payments-schedule .table-responsive,
    .am-dashboard.company-dashboard.payments-schedule .cc-table-scroll {
        overflow-x: visible !important;
        overflow-y: visible !important;
        border: 0 !important;
        background: transparent !important;
    }

    .am-dashboard.company-dashboard.payments-schedule .payments-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        table-layout: auto !important;           /* defeat page CSS table-layout:fixed */
        border-collapse: separate;
    }
    /* Hide the column headers (sortable th's stay focusable via DOM but visually
       hidden — sort controls aren't useful on a card stack). */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > thead {
        display: none !important;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody,
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tfoot {
        display: block !important;
        width: 100% !important;
    }

    /* Each <tr.payments-row> becomes a card. 2-col grid so the date sits next
       to the client name; remaining metadata cells fall to the 2nd row. */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row {
        display: grid !important;
        grid-template-columns: auto 1fr;
        column-gap: 12px;
        row-gap: 8px;
        align-items: start;
        padding: 12px !important;
        margin: 0 0 8px !important;
        background: var(--paper-2) !important;
        border: 1px solid var(--rule) !important;
        border-radius: 10px !important;
        animation: none !important;              /* drop fade-up keyframes on mobile */
    }

    /* PR #15/#17/#19 lesson: every td must reset width + box-sizing or it
       inherits the desktop fixed column widths (80–180px) and re-creates
       overflow. Also kill ellipsis caps and right-alignment from desktop. */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td {
        display: block !important;
        width: auto !important;                  /* break inherited fixed-column widths */
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 0 !important;                   /* grid gap handles spacing */
        border: 0 !important;
        text-align: left !important;             /* override .text-end on amount cell */
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: normal !important;
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-body);
        vertical-align: top !important;
    }

    /* Cell 1: date — sits on the left of row 1, compact */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
        min-width: 56px;
    }
    .am-dashboard.company-dashboard.payments-schedule .payment-date {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0;
        line-height: 1.1;
    }
    .am-dashboard.company-dashboard.payments-schedule .payment-date-day {
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard.payments-schedule .payment-date-num {
        font-family: var(--serif);
        font-size: 20px;
        font-weight: 500;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard.payments-schedule .payment-date-month {
        font-size: 11px;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard.payments-schedule .payment-day-edit-btn {
        opacity: 1 !important;                   /* desktop hides edit btn until hover; show always on touch */
        min-width: 32px;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .am-dashboard.company-dashboard.payments-schedule .payment-day-form {
        flex-wrap: wrap;
        gap: 4px;
    }
    .am-dashboard.company-dashboard.payments-schedule .payment-day-form .btn {
        min-width: 36px;
        min-height: 36px;
    }

    /* Cell 2: client name — row 1 right, the visual title of the card */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
        align-self: center;
        min-width: 0;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(2) .client-link {
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 600;
        color: var(--ink);
        line-height: 1.25;
        word-break: break-word;
    }

    /* Cells 3-8: metadata strip spanning both grid columns; let them flow
       inline as a small wrap-row using the natural flex of badges. We wrap
       them in a flex via the row's grid:auto-flow on the remaining cells. */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(n+3) {
        grid-column: 1 / -1;
        display: flex !important;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
        padding: 4px 0 !important;
        border-top: 1px dotted var(--rule) !important;
    }
    /* Drop the top border on the first of the metadata cells (3) so we get
       a single divider between "title row" and "meta block". */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(3) {
        border-top: 1px dotted var(--rule) !important;
        padding-top: 8px !important;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(n+4) {
        border-top: 0 !important;
        padding-top: 0 !important;
    }

    /* Eyebrow labels on metadata cells (since thead is hidden). Cells without
       content (e.g. empty status cell) won't render the ::before since the
       cell itself collapses to no height — fine. */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(3)::before {
        content: "Type";
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(4)::before {
        content: "Manager";
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(5)::before {
        content: "Country";
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(6)::before {
        content: "Frequency";
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(7)::before {
        content: "Amount";
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(n+3)::before {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-right: 6px;
        flex-shrink: 0;
        min-width: 64px;
    }
    /* Amount cell — bump weight + show in serif for emphasis (it's the most
       important data point in the card). */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tbody > tr.payments-row > td:nth-child(7) .payment-amount {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
        color: var(--ink);
    }

    /* tfoot total row -> single full-width summary card */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tfoot > tr.payments-total-row {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 12px !important;
        margin-top: 4px;
        background: var(--paper-2) !important;
        border: 1px solid var(--rule) !important;
        border-radius: 10px !important;
        gap: 12px;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tfoot > tr.payments-total-row > td {
        display: block !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 !important;
        border: 0 !important;
        text-align: left !important;
        font-family: var(--sans);
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }
    /* Hide the "colspan=6" left-label cell's redundant width + the trailing
       empty status cell. Just show "Week Total: $X.XX". */
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tfoot > tr.payments-total-row > td:nth-child(1) {
        flex: 1;
        min-width: 0;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tfoot > tr.payments-total-row > td:nth-child(3) {
        display: none !important;                /* trailing empty cell, no value */
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-table > tfoot > tr.payments-total-row .payment-amount-total {
        font-family: var(--serif);
        font-size: 20px;
        font-weight: 500;
        letter-spacing: 0;
        color: var(--ink);
        text-transform: none;
    }

    /* /company/payments_schedule — missing info section (4-col table) -> card-stack */
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .card-header {
        padding: 12px !important;
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .card-header .d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .card-body {
        padding: 0 !important;
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .payments-table {
        margin: 12px !important;
        width: calc(100% - 24px) !important;
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .payments-table > tbody > tr.payments-row {
        display: block !important;               /* simpler block card (4 cells, not 8) */
        grid-template-columns: none !important;
        padding: 12px !important;
        margin: 0 0 8px !important;
        background: var(--paper-2) !important;
        border: 1px solid var(--rule) !important;
        border-radius: 10px !important;
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .payments-table > tbody > tr.payments-row > td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 6px 0 !important;
        border: 0 !important;
        text-align: left !important;
    }
    /* Eyebrow labels for the 4 cells (Client / Manager / Issues / Action) */
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .payments-table > tbody > tr.payments-row > td:nth-child(1) .client-link {
        font-family: var(--sans);
        font-size: 15px;
        font-weight: 600;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .payments-table > tbody > tr.payments-row > td:nth-child(2)::before {
        content: "Manager";
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .payments-table > tbody > tr.payments-row > td:nth-child(3)::before {
        content: "Issues";
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .payments-table > tbody > tr.payments-row > td:nth-child(n+2):not(:last-child)::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .payments-table > tbody > tr.payments-row > td:last-child {
        margin-top: 4px;
    }
    .am-dashboard.company-dashboard.payments-schedule #missingInfoSection .payments-table > tbody > tr.payments-row > td:last-child .btn {
        width: 100%;
        min-height: 44px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        justify-content: center;
        display: inline-flex;
        align-items: center;
    }

    /* /company/payments_schedule — empty state inside week panel */
    .am-dashboard.company-dashboard.payments-schedule .payments-empty-state {
        padding: 32px 16px !important;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-empty-state .empty-icon {
        font-size: 2rem;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-empty-state h5 {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
    }

    /* /company/payments_schedule — legend strip at page bottom */
    .am-dashboard.company-dashboard.payments-schedule .payments-legend {
        gap: 8px 12px;
        padding: 12px;
        border-radius: 10px;
        font-size: 11px;
    }
    .am-dashboard.company-dashboard.payments-schedule .payments-legend .legend-item {
        gap: 6px;
        min-width: 0;
        flex-basis: 100%;                        /* one legend item per row at phone width */
    }


    /* =============================================================================
       MOBILE: company/content_output_detail  (PR: mobile/content-output-detail)
       -----------------------------------------------------------------------------
       Per-client monthly content production detail. Pattern matches the parent
       content_output page (block 6167+), plus the Activity Log row-as-card pattern.

       Page anatomy at desktop:
         1. .am-header — back arrow + client name + month meta + nav arrows + Targets btn
         2. .am-hero-section.am-hero-grid — 4 KPI tiles (Total / Published / Breakdown / Cost)
         3. section.card — Employee Breakdown (7-col table, clickable rows)
         4. section.card — Activity Log (10-col table #activityTable, inline-edit)
         5. section.card — Monthly Trend (7-col table)
         6. .offcanvas — Targets editor (5 number inputs)

       This template lives under .am-dashboard.company-dashboard so it INHERITS:
         - Lines 5172-5180: .opt-table {display: block}, thead {display: none}, tbody {display: block}
         - Lines 7105-7163 (action_items): .opt-table tbody tr:not(.ai-row):not(.ai-expand)
           gets display:grid + grid-template-columns: auto 1fr  — this would mis-layout
           our Activity Log + Employee Breakdown + Monthly Trend rows because their
           cells aren't priority+title. We DEFEAT that with ID-level specificity
           (#activityTable) and structural (section.card:has(...)) overrides.
         - Lines 6354-6377 (content_output parent): block-stack opt-table tr→card.
           This is the closer match. Our rules complement it with page-specific
           column labels per HANDOFF §5 card-stack pattern.

       PR #15/#17/#19 lesson: every tr-as-grid/flex flip pairs with
       `td { width: auto !important; box-sizing: border-box }` so cells don't
       inherit any width: 120px / 70px from desktop <th> width attributes.
       ============================================================================= */

    /* /company/content_output_detail — page wrapper safety net */
    .am-dashboard.company-dashboard {
        /* belt-and-braces: no horizontal scroll on the detail page either */
        overflow-x: hidden;
    }

    /* /company/content_output_detail — header (back arrow + name + nav + Targets) */
    /* The parent content_output block at line 6193 already stacks .am-header. We
       just need to make sure the right-hand button cluster (prev/next/Targets)
       wraps cleanly and each btn is a 44px tap target. */
    .am-dashboard.company-dashboard .am-header .am-profile {
        align-items: flex-start;
        gap: 10px;
    }
    .am-dashboard.company-dashboard .am-header .am-profile > a.btn {
        margin-right: 0 !important;            /* override Bootstrap me-3 */
        min-width: 44px;
        min-height: 44px;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .am-dashboard.company-dashboard .am-header .am-profile .am-name {
        font-family: var(--serif);
        font-size: 22px;
        font-weight: 500;
        line-height: 1.15;
        margin: 0;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .am-dashboard.company-dashboard .am-header .am-profile .am-contact {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
        margin-top: 4px;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 12px;
    }
    .am-dashboard.company-dashboard .am-header .am-profile .am-contact .ms-3 {
        margin-left: 0 !important;             /* let gap on parent handle spacing */
    }
    /* Right-hand button cluster: prev/next/Targets — wrap + 44px tap targets */
    .am-dashboard.company-dashboard .am-header > .d-flex.gap-2.align-items-center {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard .am-header > .d-flex.gap-2.align-items-center .btn {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* Targets button: let it grow to fill remaining row width once arrows are placed */
    .am-dashboard.company-dashboard .am-header > .d-flex.gap-2.align-items-center .btn-outline-primary {
        flex: 1 1 auto;
        padding: 8px 14px;
        font-family: var(--sans);
        font-weight: 600;
        font-size: 11.5px;
        letter-spacing: 0.16em;
        text-transform: uppercase;
    }

    /* /company/content_output_detail — KPI hero grid (4 tiles) */
    /* Parent block at 6226 already sets the grid to 2-col + 10.5px labels +
       serif 24px values. We refine: kill the inline `font-size: 1.2rem` on the
       Page Breakdown value so all 4 tiles share the same typographic rhythm,
       and tighten the breakdown text to fit four metrics on one line at 360px. */
    .am-dashboard.company-dashboard .am-hero-section {
        margin-top: 14px;
        margin-bottom: 16px;
    }
    .am-dashboard.company-dashboard .am-hero-grid .am-hero-card .am-hero-value[style*="font-size"] {
        font-size: 14px !important;            /* override inline 1.2rem on breakdown tile */
        font-family: var(--sans);
        font-weight: 600;
        letter-spacing: 0.02em;
        line-height: 1.25;
        word-spacing: 4px;
    }
    .am-dashboard.company-dashboard .am-hero-grid .am-hero-icon {
        font-size: 18px;
        margin-bottom: 4px;
    }
    .am-dashboard.company-dashboard .am-hero-grid .am-hero-subtext {
        margin-top: 2px;
    }
    .am-dashboard.company-dashboard .am-hero-grid .am-hero-subtext .text-success,
    .am-dashboard.company-dashboard .am-hero-grid .am-hero-subtext .text-warning,
    .am-dashboard.company-dashboard .am-hero-grid .am-hero-subtext .text-danger {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: 0.06em;
    }

    /* /company/content_output_detail — card section headers */
    /* Each section.card has .card-header with h6 + meta/button. Parent block 6273
       already handles wrapping. We tighten typography to match editorial scale. */
    .am-dashboard.company-dashboard section.card {
        margin-bottom: 12px !important;
        border-radius: 10px;
    }
    .am-dashboard.company-dashboard section.card > .card-header h6 {
        font-family: var(--serif);
        font-size: 16px;
        font-weight: 500;
        margin: 0;
    }
    .am-dashboard.company-dashboard section.card > .card-header h6 .bi {
        color: var(--ink-3);
        margin-right: 6px;
    }
    .am-dashboard.company-dashboard section.card > .card-header small.text-muted {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3) !important;
    }
    /* Add Row button in Activity Log header — tap target + uppercase label */
    .am-dashboard.company-dashboard section.card > .card-header .btn-opt-save {
        min-height: 40px;
        padding: 8px 12px;
        font-family: var(--sans);
        font-weight: 600;
        font-size: 11.5px;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        flex-shrink: 0;
    }

    /* =========================================================================
       /company/content_output_detail — TABLES → CARD STACKS
       The parent content_output block (line 6332-6377) already flattens
       `.am-dashboard.company-dashboard > section .opt-table.gmb-table` to
       display:block cards. BUT the later action_items block at line 7105
       converts all `.opt-table tbody tr:not(.ai-row):not(.ai-expand)` to
       display:grid auto 1fr — which would break our rows.

       We use ID-level (#activityTable) + parent-section structural specificity
       to win. Each tr becomes a stacked card with ::before labels per HANDOFF §5.
       ========================================================================= */

    /* /company/content_output_detail — defeat inherited grid layout on ALL three tables */
    /* Action_items rule at 7105 uses display:grid + grid-template-columns: auto 1fr.
       We need to FORCE display:block on this page's tables. Selector specificity:
       (0,5,4) ID + 4 classes + 4 elements beats (0,5,3) on 7105. */
    .am-dashboard.company-dashboard section.card #activityTable tbody tr,
    .am-dashboard.company-dashboard section.card .opt-table.gmb-table tbody tr {
        display: block !important;
        grid-template-columns: none !important; /* nuke action_items grid */
        column-gap: 0 !important;
        width: auto !important;
        box-sizing: border-box;
        padding: 12px 14px !important;
        margin: 0 0 8px 0 !important;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper-2);
    }
    /* Active month highlight in Monthly Trend */
    .am-dashboard.company-dashboard section.card .opt-table.gmb-table tbody tr.table-active {
        background: var(--paper-3) !important;
        border-left: 3px solid var(--accent);
    }
    /* Reset all td cells (PR #15/#17/#19 lesson) — defeat both the inline
       `style="width: 120px"` on the Activity Log thead AND any inherited grid
       positioning from action_items rule. */
    .am-dashboard.company-dashboard section.card #activityTable tbody tr > td,
    .am-dashboard.company-dashboard section.card .opt-table.gmb-table tbody tr > td {
        display: block !important;
        width: auto !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 3px 0 !important;
        border: 0 !important;
        background: transparent !important;
        grid-column: auto !important;          /* defeat action_items grid-column */
        grid-row: auto !important;
        text-align: left !important;
        white-space: normal;
        font-family: var(--sans);
        font-size: 13px;
        line-height: 1.35;
        color: var(--ink-body);
    }
    /* Defeat the action_items ::before injection on td:nth-child(n+3)
       (which uses data-label attr — not present on this page's tables). */
    .am-dashboard.company-dashboard section.card #activityTable tbody tr > td:nth-child(n+3)[data-label]:not([data-label=""])::before,
    .am-dashboard.company-dashboard section.card .opt-table.gmb-table tbody tr > td:nth-child(n+3)[data-label]:not([data-label=""])::before {
        content: none;                          /* page-specific ::before below */
    }
    /* Defeat ":empty {display: none}" from action_items on cells that have
       numeric "0" content but no data-label — our cells aren't truly empty. */

    /* /company/content_output_detail — Employee Breakdown table
       cols: 1 employee | 2 svc | 3 aux | 4 loc | 5 blog | 6 total | 7 published
       Rows have onclick=… so keep tap-friendly. First card with employee_breakdown
       wins this selector (it has no id; #activityTable and Monthly Trend's table
       are matched separately). */
    /* Tables on this page have no IDs except #activityTable — use sibling
       structure: 1st .opt-table.gmb-table that is NOT #activityTable. The
       Employee Breakdown <section> comes FIRST in DOM order. To target by
       position we anchor on the parent section's order. */
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr {
        cursor: pointer;                        /* preserve clickability */
    }
    /* Employee name (col 1) → card title */
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    /* Numeric cols 2-7 → flex row "Label · Value" */
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(2)::before { content: "Service"; }
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(3)::before { content: "Aux"; }
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(4)::before { content: "Location"; }
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(5)::before { content: "Blog"; }
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(6)::before { content: "Total"; }
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(7)::before { content: "Published"; }
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(n+2) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(n+2)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    /* Total (col 6) value emphasis to match desktop fw-bold */
    .am-dashboard.company-dashboard section.card:not(.mt-3) .opt-table.gmb-table tbody tr > td:nth-child(6) {
        font-weight: 600;
        color: var(--ink) !important;
    }

    /* /company/content_output_detail — Monthly Trend table (section.card.mt-3
       that contains .opt-table.gmb-table — last card on the page).
       cols: 1 month | 2 svc | 3 aux | 4 loc | 5 blog | 6 total | 7 published */
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(2)::before { content: "Service"; }
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(3)::before { content: "Aux"; }
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(4)::before { content: "Location"; }
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(5)::before { content: "Blog"; }
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(6)::before { content: "Total"; }
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(7)::before { content: "Published"; }
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(n+2) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(n+2)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    .am-dashboard.company-dashboard section.card.mt-3 .opt-table.gmb-table:not(#activityTable) tbody tr > td:nth-child(6) {
        font-weight: 600;
        color: var(--ink) !important;
    }

    /* /company/content_output_detail — Activity Log (#activityTable)
       cols: 1 date | 2 employee | 3 svc | 4 aux | 5 loc | 6 blog | 7 published |
             8 revisions | 9 notes | 10 actions
       This is the heaviest table — read & inline-edit modes share row markup,
       so we style for both via cell:has(input) overrides. */

    /* Date (col 1) → small meta line */
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 11px !important;
        font-weight: 500;
        color: var(--ink-3) !important;
        text-transform: uppercase;
        letter-spacing: 0.10em;
        padding-bottom: 4px !important;
    }
    /* Employee (col 2) → card title */
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(2) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    /* Numeric cells (cols 3-8): inline label · value */
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(3)::before { content: "Service"; }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(4)::before { content: "Aux"; }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(5)::before { content: "Location"; }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(6)::before { content: "Blog"; }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(7)::before { content: "Published"; }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(8)::before { content: "Revisions"; }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(n+3):nth-child(-n+8) {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(n+3):nth-child(-n+8)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    /* Notes (col 9) → full-width muted block under metrics */
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(9) {
        padding-top: 8px !important;
        margin-top: 4px;
        border-top: 1px dotted var(--rule) !important;
    }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(9) small {
        font-size: 12px !important;
        color: var(--ink-3) !important;
    }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(9):empty,
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(9) small:empty {
        display: none !important;
    }
    /* Actions (col 10) → full-width 2-button row, 40px tap targets */
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(10) {
        display: flex !important;
        justify-content: stretch;
        align-items: stretch;
        gap: 8px;
        padding-top: 8px !important;
        margin-top: 4px;
        text-align: left !important;            /* override .text-end */
    }
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(10) .btn {
        flex: 1 1 0;
        min-height: 40px;
        padding: 8px 10px !important;          /* override py-0 px-1 */
        font-size: 13px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* /company/content_output_detail — Activity Log inline-edit + new-entry rows
       JS rewrites tr.innerHTML on edit/add with form inputs. Inputs are
       form-control-sm; we make them 40px tap targets and full-width. */
    .am-dashboard.company-dashboard #activityTable tbody tr.new-entry-row,
    .am-dashboard.company-dashboard #activityTable tbody tr[data-entry-id] {
        /* New rows inherit the block-card styling from the global rule above. */
    }
    /* In edit/add mode, td col 1 holds <input type="date">, col 2 holds <select>,
       cols 3-8 hold <input type="number">, col 9 holds <input type="text">.
       Make each input expand to fill its cell, 40px tall. */
    .am-dashboard.company-dashboard #activityTable tbody tr > td input[type="date"],
    .am-dashboard.company-dashboard #activityTable tbody tr > td input[type="text"],
    .am-dashboard.company-dashboard #activityTable tbody tr > td input[type="number"],
    .am-dashboard.company-dashboard #activityTable tbody tr > td select {
        width: 100% !important;
        min-height: 40px;
        font-size: 14px;
        padding: 6px 10px;
        box-sizing: border-box;
    }
    /* When col 3-8 contain an input, the cell needs to widen its value slot —
       label stays a fixed-width eyebrow, input takes the rest. */
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(n+3):nth-child(-n+8) input[type="number"] {
        max-width: 110px;
        flex: 0 0 110px;
    }
    /* Notes input in edit mode → full-width */
    .am-dashboard.company-dashboard #activityTable tbody tr > td:nth-child(9) input[type="text"] {
        width: 100% !important;
    }

    /* /company/content_output_detail — empty state */
    .am-dashboard.company-dashboard #emptyState {
        padding: 24px 16px !important;
    }
    .am-dashboard.company-dashboard #emptyState .bi {
        color: var(--ink-faint);
    }
    .am-dashboard.company-dashboard #emptyState p {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-3);
        margin-top: 8px;
    }

    /* /company/content_output_detail — Targets offcanvas panel */
    /* Template sets inline style="width: 320px" — that's fine on phones since
       320px ≤ 360px viewport. We just tighten internals. */
    #targetsPanel {
        width: min(320px, 90vw) !important;     /* never exceed 90% viewport */
        max-width: 90vw;
    }
    #targetsPanel .offcanvas-header {
        padding: 14px 16px;
        border-bottom: 1px solid var(--rule);
    }
    #targetsPanel .offcanvas-title {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
    }
    #targetsPanel .offcanvas-body {
        padding: 16px;
    }
    #targetsPanel .offcanvas-body > p.text-muted.small {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3) !important;
        margin-bottom: 12px !important;
    }
    #targetsPanel .form-label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    #targetsPanel .form-control {
        min-height: 44px;
        font-size: 16px;                        /* iOS: ≥16px to prevent zoom-on-focus */
        padding: 8px 12px;
    }
    #targetsPanel #saveTargetsBtn {
        min-height: 48px;
        font-family: var(--sans);
        font-weight: 600;
        font-size: 12px;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        margin-top: 8px;
    }
    #targetsPanel #targetsSavedMsg {
        font-family: var(--sans);
        font-size: 12px;
    }


    /* =========================================================================
       MOBILE: /company/content_output_writer  (PR: mobile/content-output-writer)
       -------------------------------------------------------------------------
       Per HANDOFF.md §3–§5 — Writer detail page (3 tables, hero KPI strip,
       editable activity log). Hero grid + page padding are already handled by
       the .am-dashboard.company-dashboard rules above (PR mobile/content-output).
       This block ONLY adds: (a) header form wrap, (b) card-header tighten,
       (c) flatten the 3 .table.gmb-table tables to card stacks. The existing
       opt-table.gmb-table rules do NOT apply here (different class set).
       ========================================================================= */

    /* /company/content_output_writer — header filter form (back arrow + month/
       year selects + prev/next chevrons). Stack into a wrap-row under the title. */
    .am-dashboard.company-dashboard > .am-header > form.d-flex {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .am-dashboard.company-dashboard > .am-header > form.d-flex > select.form-select {
        flex: 1 1 calc(50% - 4px);
        min-width: 0 !important;       /* override inline min-width:120px / 90px */
        width: auto !important;        /* override inline width:auto already, but force vs Bootstrap */
        min-height: 44px;              /* tap target */
        font-size: 13px;
    }
    .am-dashboard.company-dashboard > .am-header > form.d-flex > a.btn,
    .am-dashboard.company-dashboard > .am-header .am-profile > a.btn {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* Back arrow (inside .am-profile) — keep it as a compact square, don't
       let it stretch. Profile row stays as flex-row title-aligned. */
    .am-dashboard.company-dashboard > .am-header .am-profile {
        flex-direction: row;
        align-items: flex-start;
        flex-wrap: nowrap;
    }
    .am-dashboard.company-dashboard > .am-header .am-profile > a.btn {
        flex: 0 0 auto;
    }
    .am-dashboard.company-dashboard > .am-header .am-profile > div {
        min-width: 0;                  /* allow the title block to shrink */
        flex: 1 1 auto;
    }

    /* /company/content_output_writer — hero section: leaderboard-gold variant
       keeps its accent border but tighten padding to match the 2-up grid. */
    .am-dashboard.company-dashboard > .am-hero-section.leaderboard-gold {
        padding: 12px;
    }
    /* The page uses two .am-hero-grid rows (3-up + 4-up). Both inherit the
       existing 1fr 1fr override from line ~5072. The mt-2 between them shrinks. */
    .am-dashboard.company-dashboard > .am-hero-section > .am-hero-grid.mt-2 {
        margin-top: 8px !important;
    }

    /* /company/content_output_writer — section.card headers (Client Breakdown,
       Monthly Trend, Activity Log). Bootstrap .card-header is flex on the first
       and third; ensure title + meta wrap and the Add Row button is full-width
       under the title on small screens. */
    .am-dashboard.company-dashboard > .row .col-lg-7 > section.card > .card-header,
    .am-dashboard.company-dashboard > .row .col-lg-5 > section.card > .card-header,
    .am-dashboard.company-dashboard > section.card.mt-3 > .card-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }
    .am-dashboard.company-dashboard > .row .col-lg-7 > section.card > .card-header h6,
    .am-dashboard.company-dashboard > .row .col-lg-5 > section.card > .card-header h6,
    .am-dashboard.company-dashboard > section.card.mt-3 > .card-header h6 {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
        color: var(--ink);
        letter-spacing: 0.01em;
    }
    /* Activity Log: "Add Row" button — full-width, 44px tap target */
    .am-dashboard.company-dashboard > section.card.mt-3 > .card-header > .btn {
        flex: 1 1 100%;
        min-height: 44px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        justify-content: center;
    }

    /* /company/content_output_writer — row stack spacing (Bootstrap already
       collapses .col-lg-7/.col-lg-5 to full-width below 992px). Just tighten
       the gap between the two stacked sections and the activity log. */
    .am-dashboard.company-dashboard > .row.g-3 {
        margin: 0 0 12px 0;
    }
    .am-dashboard.company-dashboard > .row.g-3 > [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
    }
    .am-dashboard.company-dashboard > section.card.mt-3 {
        margin-top: 12px !important;
    }

    /* =========================================================================
       /company/content_output_writer — 3 tables (.table.gmb-table) → card stacks
       The existing .opt-table.gmb-table flatten rules above DO NOT match here
       (these tables don't carry the .opt-table class). We rewrite the same
       pattern scoped to (a) the two card-row tables and (b) #activityTable.
       ========================================================================= */

    /* Disable .table-responsive horizontal scroll for THIS page's tables.
       (Some inherited rule already does this for .am-dashboard.company-dashboard
       at line ~6318; restated here for clarity / specificity safety.) */
    .am-dashboard.company-dashboard > .row.g-3 .table-responsive,
    .am-dashboard.company-dashboard > section.card.mt-3 > .table-responsive {
        overflow-x: visible !important;
        overflow-y: visible !important;
        max-height: none !important;
    }

    /* Flatten ALL three writer-page tables: table → block. */
    .am-dashboard.company-dashboard > .row.g-3 .table.gmb-table,
    .am-dashboard.company-dashboard > section.card.mt-3 > .table-responsive > #activityTable.table.gmb-table {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border: 0;
        font-family: var(--sans);
        table-layout: auto;
    }
    /* Visually hide thead (labels move to ::before on each <td>). */
    .am-dashboard.company-dashboard > .row.g-3 .table.gmb-table > thead,
    .am-dashboard.company-dashboard > section.card.mt-3 > .table-responsive > #activityTable > thead {
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
    }
    .am-dashboard.company-dashboard > .row.g-3 .table.gmb-table > tbody,
    .am-dashboard.company-dashboard > section.card.mt-3 > .table-responsive > #activityTable > tbody {
        display: block;
        width: 100%;
    }
    /* Each row becomes a card. width:100% on tr is paired with width:auto on td
       — PR #15/#17/#19 lesson: without td reset, inline <th style="width: 70px">
       leaks via table-layout and re-introduces horizontal scroll. */
    .am-dashboard.company-dashboard > .row.g-3 .table.gmb-table > tbody > tr,
    .am-dashboard.company-dashboard > section.card.mt-3 > .table-responsive > #activityTable > tbody > tr {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        padding: 12px 14px;
        margin: 0 0 8px 0;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper-2);
        cursor: pointer;
    }
    /* Active month highlight (Monthly Trend table) — accent border-left */
    .am-dashboard.company-dashboard > .row.g-3 .table.gmb-table > tbody > tr.table-active {
        border-left: 3px solid var(--accent);
        background: var(--paper-3);
    }
    /* td reset — critical for no horizontal scroll. */
    .am-dashboard.company-dashboard > .row.g-3 .table.gmb-table > tbody > tr > td,
    .am-dashboard.company-dashboard > section.card.mt-3 > .table-responsive > #activityTable > tbody > tr > td {
        display: block;
        width: auto !important;        /* break inline <th style="width: 70px"> leak */
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 3px 0 !important;
        border: 0 !important;
        text-align: left !important;   /* override .text-center / .text-end */
        white-space: normal;
        font-size: 13px;
        line-height: 1.35;
        color: var(--ink-body);
    }

    /* -------------------------------------------------------------------------
       Client Breakdown table (col-lg-7) — 7 cols
       1 Client | 2 Service | 3 Aux | 4 Location | 5 Blog | 6 Total | 7 Published
       Row is a clickable card (onclick navigates to client detail).
       ------------------------------------------------------------------------- */
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-7 .table.gmb-table > tbody > tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-7 .table.gmb-table > tbody > tr > td:nth-child(2)::before { content: "Service"; }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-7 .table.gmb-table > tbody > tr > td:nth-child(3)::before { content: "Aux"; }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-7 .table.gmb-table > tbody > tr > td:nth-child(4)::before { content: "Location"; }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-7 .table.gmb-table > tbody > tr > td:nth-child(5)::before { content: "Blog"; }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-7 .table.gmb-table > tbody > tr > td:nth-child(6)::before { content: "Total"; }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-7 .table.gmb-table > tbody > tr > td:nth-child(7)::before { content: "Published"; }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-7 .table.gmb-table > tbody > tr > td:nth-child(n+2) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
        font-size: 14px;
        font-weight: 500;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-7 .table.gmb-table > tbody > tr > td:nth-child(n+2)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }

    /* -------------------------------------------------------------------------
       Monthly Trend table (col-lg-5) — 4 cols
       1 Month | 2 Total | 3 Pub | 4 Rev
       ------------------------------------------------------------------------- */
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-5 .table.gmb-table > tbody > tr {
        cursor: default;               /* no onclick on this table */
    }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-5 .table.gmb-table > tbody > tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-5 .table.gmb-table > tbody > tr > td:nth-child(2)::before { content: "Total"; }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-5 .table.gmb-table > tbody > tr > td:nth-child(3)::before { content: "Published"; }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-5 .table.gmb-table > tbody > tr > td:nth-child(4)::before { content: "Revisions"; }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-5 .table.gmb-table > tbody > tr > td:nth-child(n+2) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
        font-size: 14px;
        font-weight: 500;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard > .row.g-3 > .col-lg-5 .table.gmb-table > tbody > tr > td:nth-child(n+2)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }

    /* -------------------------------------------------------------------------
       Activity Log table (#activityTable) — 10 cols
       1 Date | 2 Client | 3 Service | 4 Aux | 5 Location | 6 Blog | 7 Published
       | 8 Revisions | 9 Notes | 10 Actions
       Editable: edit/save replaces cell innerHTML with <input>/<select>.
       Mirrors the existing #myEntriesTable pattern (line ~6379) but anchored
       here because the table sits in a different section structure.
       ------------------------------------------------------------------------- */
    .am-dashboard.company-dashboard #activityTable > tbody > tr {
        cursor: default;               /* no row-level onclick */
    }
    /* Client (col 2) acts as card title */
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(2) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600;
        color: var(--ink) !important;
        padding-bottom: 4px !important;
        order: 1;
    }
    /* Date (col 1) — small meta line */
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(1) {
        font-size: 11px !important;
        color: var(--ink-3) !important;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 8px;
        order: 2;
    }
    /* Allow per-cell ordering: tr becomes flex column */
    .am-dashboard.company-dashboard #activityTable > tbody > tr {
        display: flex !important;
        flex-direction: column;
    }
    /* Page-count cells (cols 3–8) — inline label + value */
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(3)::before { content: "Service"; }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(4)::before { content: "Aux"; }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(5)::before { content: "Location"; }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(6)::before { content: "Blog"; }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(7)::before { content: "Published"; }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(8)::before { content: "Revisions"; }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(n+3):nth-child(-n+8) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
        order: 3;
    }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(n+3):nth-child(-n+8)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    /* Notes (col 9) — full-width muted block under counts */
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(9) {
        padding-top: 8px !important;
        border-top: 1px dotted var(--rule) !important;
        margin-top: 6px;
        order: 4;
    }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(9) small {
        font-size: 12px !important;
    }
    /* Notes label only shown when cell has content (avoid empty "NOTES" line) */
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(9):not(:empty)::before {
        content: "Notes";
        display: block;
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    /* Actions (col 10) — full-width row of pill buttons */
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(10) {
        display: flex !important;
        gap: 8px;
        padding-top: 10px !important;
        text-align: left !important;
        order: 5;
    }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(10) .btn {
        flex: 1 1 0;
        min-height: 44px;              /* tap target */
        font-family: var(--sans);
        font-size: 12px;
        padding: 6px 10px !important;
    }
    /* Edit-mode: inputs/selects inside any cell are full-width with tap target */
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td input,
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td select {
        width: 100% !important;
        min-height: 44px;
        font-size: 14px;               /* prevent iOS Safari zoom on focus */
        padding: 6px 10px;
    }
    /* When a row is in edit mode (.new-entry-row OR after editRow swap), the
       count cells contain <input> — let them grow full-width, not the
       space-between label/value layout. */
    .am-dashboard.company-dashboard #activityTable > tbody > tr.new-entry-row > td:nth-child(n+3):nth-child(-n+8),
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(n+3):nth-child(-n+8):has(input) {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(n+3):nth-child(-n+8) input {
        max-width: 100%;               /* override desktop max-width: 100px equivalents */
    }
    /* In edit mode the date+client cells also contain inputs/selects */
    .am-dashboard.company-dashboard #activityTable > tbody > tr.new-entry-row > td:nth-child(1),
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(1):has(input),
    .am-dashboard.company-dashboard #activityTable > tbody > tr.new-entry-row > td:nth-child(2),
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(2):has(select),
    .am-dashboard.company-dashboard #activityTable > tbody > tr > td:nth-child(2):has(input) {
        font-size: 11px !important;
        color: var(--ink-3) !important;
        border-bottom: 0 !important;
        margin-bottom: 0;
        padding-bottom: 6px !important;
    }
    /* Empty-state inside activity log section */
    .am-dashboard.company-dashboard > section.card.mt-3 > #emptyState {
        padding: 24px 12px;
    }
    .am-dashboard.company-dashboard > section.card.mt-3 > #emptyState p {
        font-size: 13px;
    }


    /* =============================================================================
       MOBILE: /company/content_manager_dashboard  (PR: mobile/content-manager-dashboard)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing scale), §4 (cards/pills/stat-tile patterns),
       §5 (per-page card-stack pattern).

       This page shares the .am-dashboard.company-dashboard wrapper with other CM
       pages (content_output.html, account_managers/*) so several existing rules
       already partly cover it:
         · .am-header column flex + 44px button targets (line ~6193)
         · .am-hero-grid → 2×N grid + .am-hero-card token-styled (lines ~5072 / ~6226 / ~8478)
         · .table-responsive overflow-x off on the page (line ~6318)
         · #writerTable cell labels (Service / Aux / Location / Blog / Total /
           Published / Revisions / Efficiency / Cost/Page) at lines ~6450–6491

       But this template ships `.table.gmb-table` WITHOUT `.opt-table`, so the
       shared flatten at line ~6332 (.opt-table.gmb-table) does NOT fire here —
       cards never form, table-layout breaks 360px. Also column 11 in THIS
       template is "Goal" (progress bar), not "Cost/Page", and columns 1–2 are
       "#/rank emoji" + "writer name", not "writer name" + "team".

       Strategy:
         1. Page-header controls form: full-width selects + 44×44 prev/next.
         2. Flatten every `.table.gmb-table:not(.opt-table)` inside this page
            wrapper (mirrors the shared .opt-table.gmb-table rule at ~6332).
         3. Pair each grid/flex flip on <tr> with `width: auto !important;
            box-sizing: border-box` on the <td>s — PR #15/#17/#19 lesson.
         4. Re-scope existing #writerTable rules with `.gmb-table:not(.opt-table)`
            to defeat the content_output.html-targeted #writerTable rules at
            lines ~6453–6491 (which mislabel cols 1, 2, 11 for this page).
         5. Add #projectTable cell labels (Service / Aux / Location / Blog /
            Total / Published).
         6. Render <tfoot> as a final card (totals row) so team totals stay
            visible on phone.
       ============================================================================= */

    /* /company/content_manager_dashboard — header controls (prev/select/select/next) */
    /* The form lives inside .am-header > .d-flex.gap-2 (not a direct child of
       the page wrapper), so the existing form rules at ~6206 don't reach it.
       Wrap the cluster, give selects full-row width + 40px tap targets, and
       size the prev/next chevrons as 44×44 tap targets. */
    .am-dashboard.company-dashboard > .am-header > .d-flex.gap-2.align-items-center {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard > .am-header > .d-flex.gap-2.align-items-center > form.d-flex {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .am-dashboard.company-dashboard > .am-header > .d-flex.gap-2.align-items-center > form.d-flex select.form-select-sm {
        flex: 1 1 calc(50% - 4px);
        width: auto !important;            /* override inline style="width: auto; min-width: 120px|90px" */
        min-width: 0 !important;
        min-height: 40px;
        font-size: 13px;
    }
    .am-dashboard.company-dashboard > .am-header > .d-flex.gap-2.align-items-center > a.btn.btn-outline-secondary {
        flex: 0 0 44px;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    /* /company/content_manager_dashboard — hero second-row inline grid override
       The template has TWO .am-hero-grid blocks; the 2nd has inline
       style="grid-template-columns: repeat(4, 1fr)". The existing
       grid-template-columns: repeat(2, minmax(0, 1fr)) !important at ~6226
       already defeats both. Just tighten the .mt-2 spacing between rows so the
       8-tile stat block reads as one cohesive unit per §3 spacing scale. */
    .am-dashboard.company-dashboard .am-hero-section .am-hero-grid.mt-2 {
        margin-top: 8px !important;        /* desktop default is 8px (.mt-2) — restate so it sticks */
    }

    /* /company/content_manager_dashboard — card section spacing */
    .am-dashboard.company-dashboard > section.card {
        border-radius: 10px;
        margin-bottom: 12px;
    }
    .am-dashboard.company-dashboard > section.card > .card-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        row-gap: 6px;
    }
    .am-dashboard.company-dashboard > section.card > .card-header h6 {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard > section.card > .card-header small.text-muted {
        font-family: var(--sans);
        font-size: 11px;
        color: var(--ink-3) !important;
    }
    .am-dashboard.company-dashboard > section.card > .card-header .btn {
        min-height: 36px;
        font-size: 12px;
    }

    /* /company/content_manager_dashboard — flatten .table.gmb-table:not(.opt-table)
       into card-stack. Mirrors the shared rule at ~6332 but excludes content_output.html's
       .opt-table.gmb-table tables which already have their own flatten path. */
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border: 0;
        font-family: var(--sans);
    }
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) thead {
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
    }
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) tbody,
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) tfoot {
        display: block;
        width: 100%;
    }
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) tbody tr,
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) tfoot tr {
        display: block;
        width: 100% !important;            /* paired with td width:auto below — PR #15/#17/#19 lesson */
        box-sizing: border-box;
        padding: 12px 14px;
        margin: 0 12px 10px 12px;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper-2);
        cursor: pointer;
    }
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) tbody tr > td,
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) tfoot tr > td {
        display: block;
        width: auto !important;            /* never inherit width:100% — PR #15/#17/#19 lesson */
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 3px 0 !important;
        border: 0 !important;
        text-align: left !important;       /* override .text-center desktop alignment */
        white-space: normal;
        font-size: 13px;
        line-height: 1.35;
        color: var(--ink-body);
    }
    /* tfoot card: distinct background + non-clickable (no row onclick) */
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) tfoot tr.table-active {
        background: var(--paper-3);
        cursor: default;
    }

    /* /company/content_manager_dashboard — #writerTable (11 cols, distinct from
       content_output.html's #writerTable):
         1 rank emoji/#  | 2 writer name | 3 svc | 4 aux | 5 loc | 6 blog |
         7 total | 8 published | 9 revisions | 10 efficiency | 11 goal (bar + %)
       Selector adds .gmb-table:not(.opt-table) to lift specificity above the
       existing #writerTable rules at ~6453–6491 which assume content_output's
       column meanings. */

    /* Col 1 — rank (medal emoji or number). Small uppercase eyebrow. */
    .am-dashboard.company-dashboard #writerTable.gmb-table:not(.opt-table) tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 11px !important;
        font-weight: 600 !important;
        color: var(--ink-3) !important;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding-bottom: 4px !important;
        border-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    /* Col 2 — writer name (card title). Serif feels heavy in card stacks;
       use sans 14px semibold to match §4.5 list-card title style. */
    .am-dashboard.company-dashboard #writerTable.gmb-table:not(.opt-table) tbody tr > td:nth-child(2) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600 !important;
        color: var(--ink) !important;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    /* Cols 3–11 inherit the existing label rules at ~6467–6491 (Service / Aux /
       Location / Blog / Total / Published / Revisions / Efficiency) — only the
       last column label differs from content_output.html. Override col 11. */
    .am-dashboard.company-dashboard #writerTable.gmb-table:not(.opt-table) tbody tr > td:nth-child(11)::before {
        content: "Goal";
    }
    /* Goal progress bar (col 11 inner .progress + small) — keep both visible,
       expand bar to fill, value on the right. */
    .am-dashboard.company-dashboard #writerTable.gmb-table:not(.opt-table) tbody tr > td:nth-child(11) > div.d-flex {
        flex: 1 1 0;
        min-width: 0;
        gap: 8px !important;
        justify-content: flex-end;
    }
    .am-dashboard.company-dashboard #writerTable.gmb-table:not(.opt-table) tbody tr > td:nth-child(11) .progress {
        flex: 1 1 0;
        min-width: 60px;
        width: auto !important;            /* override inline style="width: 60px" */
        height: 6px;
    }
    .am-dashboard.company-dashboard #writerTable.gmb-table:not(.opt-table) tbody tr > td:nth-child(11) small {
        font-size: 11px !important;
        white-space: nowrap;
        flex: 0 0 auto;
        color: var(--ink-3);
    }
    /* tfoot row in #writerTable: 11 tds, col 1 empty, col 2 "Team Total" label,
       cols 3–10 numeric, col 11 empty. Treat col 2 as card title. */
    .am-dashboard.company-dashboard #writerTable.gmb-table:not(.opt-table) tfoot tr > td:nth-child(1) {
        display: none !important;          /* empty rank cell */
    }
    .am-dashboard.company-dashboard #writerTable.gmb-table:not(.opt-table) tfoot tr > td:nth-child(2) {
        font-family: var(--sans);
        font-size: 13px !important;
        font-weight: 700 !important;
        color: var(--ink) !important;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard #writerTable.gmb-table:not(.opt-table) tfoot tr > td:nth-child(11) {
        display: none !important;          /* empty goal cell on totals row */
    }

    /* /company/content_manager_dashboard — #projectTable (7 cols):
         1 client | 2 svc | 3 aux | 4 loc | 5 blog | 6 total | 7 published */
    .am-dashboard.company-dashboard #projectTable tbody tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 14px !important;
        font-weight: 600 !important;
        color: var(--ink) !important;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard #projectTable tbody tr > td:nth-child(2)::before { content: "Service"; }
    .am-dashboard.company-dashboard #projectTable tbody tr > td:nth-child(3)::before { content: "Aux"; }
    .am-dashboard.company-dashboard #projectTable tbody tr > td:nth-child(4)::before { content: "Location"; }
    .am-dashboard.company-dashboard #projectTable tbody tr > td:nth-child(5)::before { content: "Blog"; }
    .am-dashboard.company-dashboard #projectTable tbody tr > td:nth-child(6)::before { content: "Total"; }
    .am-dashboard.company-dashboard #projectTable tbody tr > td:nth-child(7)::before { content: "Published"; }
    .am-dashboard.company-dashboard #projectTable tbody tr > td:nth-child(n+2) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard #projectTable tbody tr > td:nth-child(n+2)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }
    /* tfoot in #projectTable: col 1 = "Total" label, cols 2–7 numeric. */
    .am-dashboard.company-dashboard #projectTable tfoot tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 13px !important;
        font-weight: 700 !important;
        color: var(--ink) !important;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding-bottom: 8px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard #projectTable tfoot tr > td:nth-child(2)::before { content: "Service"; }
    .am-dashboard.company-dashboard #projectTable tfoot tr > td:nth-child(3)::before { content: "Aux"; }
    .am-dashboard.company-dashboard #projectTable tfoot tr > td:nth-child(4)::before { content: "Location"; }
    .am-dashboard.company-dashboard #projectTable tfoot tr > td:nth-child(5)::before { content: "Blog"; }
    .am-dashboard.company-dashboard #projectTable tfoot tr > td:nth-child(6)::before { content: "Total"; }
    .am-dashboard.company-dashboard #projectTable tfoot tr > td:nth-child(7)::before { content: "Published"; }
    .am-dashboard.company-dashboard #projectTable tfoot tr > td:nth-child(n+2) {
        display: flex !important;
        justify-content: space-between;
        align-items: baseline;
        width: 100% !important;
        padding: 4px 0 !important;
        gap: 8px;
    }
    .am-dashboard.company-dashboard #projectTable tfoot tr > td:nth-child(n+2)::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        flex: 0 0 auto;
    }

    /* /company/content_manager_dashboard — empty-state padding tightening */
    .am-dashboard.company-dashboard > section.card .text-center.text-muted.py-4 {
        padding: 20px 16px !important;
    }
    .am-dashboard.company-dashboard > section.card .text-center.text-muted.py-4 p {
        font-size: 12px;
        line-height: 1.4;
    }


    /* =============================================================================
       MOBILE: company/semrush_projects_diagnostics  (PR: mobile/semrush-projects-diagnostics)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing), §4 (cards/pills/buttons), §5 (no horizontal
       scroll; tables -> card-stack). The template has no unique wrapper class —
       it uses generic `.dashboard-container`. We anchor every selector to the
       page via `.dashboard-container:has(option[value="list_projects"])` —
       that <option> is unique to this template (verified via grep).

       Wide elements handled:
         1. Config bar form: Bootstrap's col-6/col-4 row at 360px crams Limit +
            Fresh + Run on one line; we stack to 1-col with 44px controls.
         2. 4x Summary metric cards: 2x2 grid; serif value, uppercase label.
         3. nav-tabs (All / Winners / Losers): horizontal-scrollable strip
            (per "tab/chip strips can scroll" allowance), 44px tap targets.
         4. 3x keyword tables + Projects table: card-stack (each <tr> -> grid,
            each <td> -> labelled cell via ::before).
         5. PR #15/#17/#19 lesson: every grid-flipped <tr> pairs with
            `width: auto !important; box-sizing: border-box` on <td>.
       ============================================================================= */

    /* /company/semrush_projects_diagnostics — page wrapper */
    .dashboard-container:has(option[value="list_projects"]) {
        max-width: 100%;
        overflow-x: hidden;
        padding-left: 14px;
        padding-right: 14px;
    }

    /* /company/semrush_projects_diagnostics — page header */
    .dashboard-container:has(option[value="list_projects"]) .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        margin-bottom: 16px !important;
    }
    .dashboard-container:has(option[value="list_projects"]) .page-title {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.15;
        letter-spacing: -0.01em;
        color: var(--ink);
        margin: 0;
    }
    .dashboard-container:has(option[value="list_projects"]) .page-header p {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-3);
        margin: 0;
    }

    /* /company/semrush_projects_diagnostics — config bar form */
    .dashboard-container:has(option[value="list_projects"]) > .card {
        border-radius: 10px;
        border: 1px solid var(--rule);
        background: var(--paper-2);
        box-shadow: none;          /* §4.5 flat cards on mobile */
    }
    .dashboard-container:has(option[value="list_projects"]) > .card .card-body {
        padding: 12px !important;  /* override py-3 utility for tighter mobile fit */
    }
    /* Force every form column to full width; the Bootstrap col-6 + col-4 row
       at 360px squeezes Limit/Fresh/Run unreadably. Stack everything. */
    .dashboard-container:has(option[value="list_projects"]) > .card form .row {
        row-gap: 10px !important;
    }
    .dashboard-container:has(option[value="list_projects"]) > .card form .row > [class*="col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    /* Labels — uppercase tiny per HANDOFF.md §2 */
    .dashboard-container:has(option[value="list_projects"]) > .card form .form-label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px !important;
    }
    /* Inputs / selects — 44px tap target */
    .dashboard-container:has(option[value="list_projects"]) > .card form .form-select,
    .dashboard-container:has(option[value="list_projects"]) > .card form .form-control {
        min-height: 44px;
        font-size: 14px;
        border-radius: 6px;
    }
    /* "Fresh" checkbox row — give it normal label sizing, drop the mt-3 hack
       (only valid when the column had a hidden label above it). */
    .dashboard-container:has(option[value="list_projects"]) > .card form .form-check {
        margin-top: 0 !important;
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 8px;
        padding-left: 0;
    }
    .dashboard-container:has(option[value="list_projects"]) > .card form .form-check-input {
        width: 20px;
        height: 20px;
        margin: 0;
        flex-shrink: 0;
    }
    .dashboard-container:has(option[value="list_projects"]) > .card form .form-check-label {
        font-family: var(--sans);
        font-size: 14px;
        color: var(--ink-body);
        margin: 0;
    }
    /* Submit button — full width 44px tap target */
    .dashboard-container:has(option[value="list_projects"]) > .card form .btn-primary {
        min-height: 44px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        border-radius: 6px;
    }

    /* /company/semrush_projects_diagnostics — status banner alert */
    .dashboard-container:has(option[value="list_projects"]) .alert {
        font-size: 13px;
        border-radius: 10px;
        padding: 10px 12px;
        overflow-wrap: anywhere;
    }

    /* /company/semrush_projects_diagnostics — summary metric cards (2x2) */
    .dashboard-container:has(option[value="list_projects"]) .metric-card {
        padding: 12px 8px;
        border-radius: 10px;
        border: 1px solid var(--rule);
        background: var(--paper-2);
        box-shadow: none;          /* §4.5 flat */
    }
    .dashboard-container:has(option[value="list_projects"]) .metric-card:hover {
        transform: none;           /* kill desktop hover lift on touch */
        box-shadow: none;
    }
    .dashboard-container:has(option[value="list_projects"]) .metric-value {
        font-family: var(--serif) !important;  /* override desktop sans default */
        font-size: 24px !important;            /* override global 1.5rem rule above */
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: -0.01em;
    }
    .dashboard-container:has(option[value="list_projects"]) .metric-label {
        font-family: var(--sans);
        font-size: 10.5px !important;          /* override global 0.65rem rule above */
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-top: 4px;
        line-height: 1.2;
    }
    .dashboard-container:has(option[value="list_projects"]) .metric-label .bi {
        margin-right: 2px;
    }

    /* /company/semrush_projects_diagnostics — nav-tabs (horizontal scrollable strip) */
    .dashboard-container:has(option[value="list_projects"]) .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-bottom: 1px solid var(--rule);
        margin-bottom: 12px !important;
    }
    .dashboard-container:has(option[value="list_projects"]) .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    .dashboard-container:has(option[value="list_projects"]) .nav-tabs .nav-item {
        flex-shrink: 0;
    }
    .dashboard-container:has(option[value="list_projects"]) .nav-tabs .nav-link {
        min-height: 44px;
        padding: 10px 12px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        white-space: nowrap;
        border: 0;
        border-bottom: 2px solid transparent;
        border-radius: 0;
        color: var(--ink-3);
    }
    .dashboard-container:has(option[value="list_projects"]) .nav-tabs .nav-link.active {
        color: var(--ink);
        border-bottom-color: var(--accent);
        background: transparent;
    }
    .dashboard-container:has(option[value="list_projects"]) .nav-tabs .nav-link .badge {
        font-size: 9.5px;
        letter-spacing: 0.14em;
        padding: 2px 6px;
        border-radius: 999px;
        vertical-align: middle;
    }

    /* /company/semrush_projects_diagnostics — tables -> card-stack
       Targets the 3 keyword tables in .tab-pane AND the Projects table in
       the post-list .card-body. We cancel desktop's .table-responsive scroll,
       then flip every <tr> to a 2-column grid. Hides thead so labels move
       to ::before on each cell. */
    .dashboard-container:has(option[value="list_projects"]) .table-responsive {
        overflow: visible !important;       /* no horizontal scroll body */
        max-width: 100%;
    }
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table {
        display: block;
        width: 100%;
        min-width: 0 !important;
        margin: 0;
        background: transparent;
    }
    /* Hide column headers — labels come from ::before */
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table > thead {
        display: none;
    }
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table > tbody {
        display: block;
        width: 100%;
    }
    /* Each row becomes a 2-col grid card */
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table > tbody > tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 10px;
        row-gap: 6px;
        width: 100% !important;             /* paired with td width:auto below — PR #15/#17 lesson */
        padding: 12px;
        margin-bottom: 8px;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper-2);
        box-shadow: none;
    }
    /* Cancel zebra-striping / table-hover background bleed */
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table > tbody > tr:hover,
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table-hover > tbody > tr:hover > * {
        background: var(--paper-2) !important;  /* override Bootstrap --bs-table-hover-bg */
        --bs-table-accent-bg: transparent;
    }
    /* CRITICAL (PR #15/#17/#19 lesson): td must reset width + box-sizing or
       cells inherit inline widths (e.g. style="width: 90px") from the template
       and force horizontal scroll. */
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table > tbody > tr > td {
        display: block;
        width: auto !important;             /* break inline style="width: 90px" etc. */
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        padding: 0 !important;
        border: 0;
        text-align: left !important;        /* override .text-center / .text-end */
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-body);
        overflow: hidden;
    }
    /* First cell = card title (Keyword / Project name). Spans both columns. */
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table > tbody > tr > td:first-child {
        grid-column: 1 / -1;
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 600;
        color: var(--ink);
        white-space: normal;
        overflow-wrap: anywhere;            /* break long keywords */
        padding-bottom: 4px !important;
        border-bottom: 1px dotted var(--rule);
    }
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table > tbody > tr > td:first-child .fw-medium {
        font-weight: 600;
    }
    /* Generic ::before label scaffold for cells 2+ */
    .dashboard-container:has(option[value="list_projects"]) .table-responsive > .table > tbody > tr > td:nth-child(n+2)::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
        line-height: 1.2;
    }
    /* Keyword tables (All / Winners / Losers) — 4 cols: Keyword | Position | Change/Gained/Lost | Volume.
       The "All" tab is the only one whose tbody has .kw-row, but Winners/Losers share the same
       4-column layout. We use the tab-pane id to pick the right label for col 3. */
    .dashboard-container:has(option[value="list_projects"]) #all-tab .table > tbody > tr > td:nth-child(2)::before,
    .dashboard-container:has(option[value="list_projects"]) #winners-tab .table > tbody > tr > td:nth-child(2)::before,
    .dashboard-container:has(option[value="list_projects"]) #losers-tab .table > tbody > tr > td:nth-child(2)::before {
        content: "Position";
    }
    .dashboard-container:has(option[value="list_projects"]) #all-tab .table > tbody > tr > td:nth-child(3)::before {
        content: "Change";
    }
    .dashboard-container:has(option[value="list_projects"]) #winners-tab .table > tbody > tr > td:nth-child(3)::before {
        content: "Gained";
    }
    .dashboard-container:has(option[value="list_projects"]) #losers-tab .table > tbody > tr > td:nth-child(3)::before {
        content: "Lost";
    }
    .dashboard-container:has(option[value="list_projects"]) #all-tab .table > tbody > tr > td:nth-child(4)::before,
    .dashboard-container:has(option[value="list_projects"]) #winners-tab .table > tbody > tr > td:nth-child(4)::before,
    .dashboard-container:has(option[value="list_projects"]) #losers-tab .table > tbody > tr > td:nth-child(4)::before {
        content: "Volume";
    }
    /* Projects table (list_projects result) — 3 cols: Project | Domain | ID.
       This table sits inside `> .card > .card-body > .table-responsive` whereas
       the keyword tables sit in `> .tab-content > .tab-pane > .table-responsive`.
       We target the deeper card path to avoid colliding with the keyword labels. */
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-body > .table-responsive .table > tbody > tr > td:nth-child(2)::before {
        content: "Domain";
    }
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-body > .table-responsive .table > tbody > tr > td:nth-child(3)::before {
        content: "ID";
    }
    /* Inline code chip in Projects ID cell — keep mono, fit width */
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-body > .table-responsive .table > tbody > tr > td code {
        font-family: var(--mono);
        font-size: 11px;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-all;
        display: inline-block;
        max-width: 100%;
    }
    /* Position badge — keep desktop pill look, just guarantee it doesn't stretch */
    .dashboard-container:has(option[value="list_projects"]) .table-responsive .position-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 32px;
        padding: 2px 8px;
        border-radius: 999px;
        font-size: 12px;
        font-weight: 600;
    }

    /* /company/semrush_projects_diagnostics — Projects card header (only present
       in the list_projects branch) */
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-header {
        padding: 10px 12px;
        background: var(--paper-3);
        border-bottom: 1px solid var(--rule);
    }
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-header .fw-semibold {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink);
    }
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-header small {
        display: block;
        margin-left: 0 !important;          /* override Bootstrap ms-2 inline class */
        margin-top: 2px;
        font-size: 11.5px;
    }

    /* /company/semrush_projects_diagnostics — "Get Started" empty state */
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-body.text-center {
        padding: 32px 16px !important;      /* override py-5 */
    }
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-body.text-center h4 {
        font-family: var(--serif);
        font-size: 20px;
        font-weight: 500;
        color: var(--ink);
    }
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-body.text-center p {
        font-size: 13px;
    }
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-body.text-center .bg-light {
        max-width: 100% !important;         /* override inline max-width: 400px */
        padding: 12px !important;
        border-radius: 10px;
        background: var(--paper-3) !important;
    }
    .dashboard-container:has(option[value="list_projects"]) > .card > .card-body.text-center code {
        font-family: var(--mono);
        font-size: 11px;
        overflow-wrap: anywhere;
    }


    /* =============================================================================
       MOBILE: /company/development_dashboard  (My Dev Dashboard)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing), §4 (cards, pills, KPI), §5 (page layouts).

       NOTE: outer wrapper is `.am-dashboard.company-dashboard`, so many existing
       rules already apply (page padding, header, .am-hero-grid → 2-up, .alert,
       section.card > .card-header tightening, .table-responsive overflow reset).
       Those upstream rules are NOT duplicated here.

       What this section adds:
        1. Second .am-hero-grid (My Stats Row) has INLINE `grid-template-columns:
           repeat(3, 1fr)` which beats the global 2-up rule. Defeat with
           attribute selector + !important.
        2. Focus Project card — Bootstrap `.col-md-*` already stacks below 768
           (no `.col-*` mobile classes), but the card padding/label/value
           typography needs editorial polish per §4.5.
        3. Pipeline pills strip — tighten padding so 5+ pills don't overflow.
        4. Three `.table.gmb-table` tables (Active Items, Design Requests,
           Recently Launched) need flatten-to-card-stack. Existing PR #29 rules
           are scoped to `.opt-table.gmb-table`; this template uses
           `.table.gmb-table` (no `.opt-table`), so add new scoped rules.
        5. Per PR #15/#17/#19 lesson: every flipped <tr> uses display:grid (or
           block) and EACH <td> gets `width: auto !important; box-sizing:
           border-box` to defeat inline `style="width:50px"` on the <th>.
       ============================================================================= */

    /* /company/development_dashboard — second am-hero-grid (My Stats Row) overrides
       its inline `grid-template-columns: repeat(3, 1fr)` to use the same 2-up
       grid as the rest of the page. */
    .am-dashboard.company-dashboard .am-hero-grid[style*="repeat(3"] {
        grid-template-columns: 1fr 1fr !important; /* defeat inline 3-col grid */
        gap: 8px !important;
    }

    /* /company/development_dashboard — Focus Project card (section.card.border-primary) */
    .am-dashboard.company-dashboard > section.card.border-primary > .card-header {
        padding: 10px 12px;
    }
    .am-dashboard.company-dashboard > section.card.border-primary > .card-header h6 {
        font-family: var(--sans);
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.04em;
        color: var(--ink);
        margin: 0;
    }
    .am-dashboard.company-dashboard > section.card.border-primary > .card-body {
        padding: 12px;
    }
    /* Bootstrap .row inside focus-project card: stack on mobile (default behavior
       since cols are .col-md-*); just tighten gutters and add gap. */
    .am-dashboard.company-dashboard > section.card.border-primary > .card-body > .row {
        --bs-gutter-y: 10px;
        --bs-gutter-x: 0;
        margin: 0;
    }
    .am-dashboard.company-dashboard > section.card.border-primary > .card-body > .row > [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
    }
    /* Project name (col-md-4) — serif heading */
    .am-dashboard.company-dashboard > section.card.border-primary > .card-body > .row > .col-md-4 .fw-bold {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
        line-height: 1.2;
        color: var(--ink);
    }
    /* Meta cells (Stage / Due Date / Days / Priority) — label above value */
    .am-dashboard.company-dashboard > section.card.border-primary > .card-body > .row > .col-md-2 {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .am-dashboard.company-dashboard > section.card.border-primary > .card-body > .row > .col-md-2 .small.text-muted {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard > section.card.border-primary > .card-body > .row > .col-md-2 .badge {
        align-self: flex-start;
        font-size: 10px;
    }

    /* /company/development_dashboard — empty "no assignments" card */
    .am-dashboard.company-dashboard > section.card > .card-body.text-center.text-muted {
        padding: 20px 12px !important;
        font-family: var(--sans);
        font-size: 13px;
    }

    /* /company/development_dashboard — Pipeline stage-count pills strip
       Selector: a flex row of pills with inline `background: var(--bs-tertiary-bg)`.
       This is unique to dev dashboard; scope by parent + the inline-style signature. */
    .am-dashboard.company-dashboard > .d-flex.flex-wrap.gap-2 > div[style*="--bs-tertiary-bg"] {
        padding: 6px 10px !important;          /* tighter than desktop 12px 16px */
        border-radius: 999px !important;       /* §4 pill shape */
        background: var(--paper-3) !important; /* editorial token, not bootstrap var */
        gap: 6px !important;
    }
    .am-dashboard.company-dashboard > .d-flex.flex-wrap.gap-2 > div[style*="--bs-tertiary-bg"] .badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    .am-dashboard.company-dashboard > .d-flex.flex-wrap.gap-2 > div[style*="--bs-tertiary-bg"] .small {
        font-family: var(--sans);
        font-size: 11px;
        font-weight: 500;
        color: var(--ink-body);
    }

    /* /company/development_dashboard — overdue alert: allow comma list to wrap */
    .am-dashboard.company-dashboard > .alert.alert-danger {
        font-size: 12px;
        padding: 10px 12px;
        margin: 8px 0 12px;
        border-radius: 10px;
    }
    .am-dashboard.company-dashboard > .alert.alert-danger .small {
        font-size: 11px;
        line-height: 1.4;
        overflow-wrap: anywhere;            /* long client names with no spaces */
        word-break: break-word;
    }

    /* /company/development_dashboard — three .table.gmb-table tables → card stack
       (Existing PR #29 rules target .opt-table.gmb-table; this template uses
       .table.gmb-table without the .opt-table modifier, so these rules apply
       only here without touching the content_manager_dashboard flatten.) */

    /* 1. Disable horizontal scroll on the .table-responsive wrappers for these
          tables (.am-dashboard upstream rule already handles overflow:visible,
          but re-assert here for any height-capped wrappers). */
    .am-dashboard.company-dashboard > section.card > .table-responsive {
        max-height: none !important;
        overflow: visible !important;
    }

    /* 2. Flatten the table itself. Scope: section.card descendants of the page
          wrapper, AND the table must be `.table.gmb-table` WITHOUT `.opt-table`.
          We use `:not(.opt-table)` to be explicit and never collide with PR #29. */
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border: 0;
        font-family: var(--sans);
        margin: 0;
    }
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) > thead {
        /* visually-hidden thead — labels move to ::before on each td */
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
    }
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) > tbody {
        display: block;
        width: 100%;
    }

    /* 3. Each <tr> → card. PR #15/#17/#19 lesson: pair tr block-flip with td
          width:auto+box-sizing reset to defeat inline `style="width:50px"` on
          the <th>s that would otherwise leak through table-layout. */
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) > tbody > tr {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        padding: 12px 14px;
        margin: 0 12px 10px 12px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
    }
    /* Override Bootstrap .table-danger row bg with a left-border accent so the
       editorial card surface stays consistent. */
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) > tbody > tr.table-danger {
        background: var(--paper-2) !important;   /* override .table-danger bg */
        border-left: 3px solid var(--accent);
    }
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) > tbody > tr > td {
        display: block;
        width: auto !important;                  /* PR #15/#17/#19 — defeat inline th width */
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 3px 0 !important;
        border: 0 !important;
        text-align: left !important;             /* override .text-center desktop */
        white-space: normal;
        font-size: 13px;
        line-height: 1.35;
        color: var(--ink-body);
        overflow-wrap: anywhere;
    }

    /* 4. Per-table column labels via ::before on each td. We can't add IDs
          (CSS-only), so target each table-card via :has() on its header icon.

          Table A — "My Active Items" (.bi-globe in header):
            cols: 1 priority | 2 client | 3 domain | 4 stage | 5 due | 6 days
          Table B — "My Design Requests" (.bi-palette):
            cols: 1 client | 2 stage | 3 due
          Table C — "Recently Launched" (.bi-rocket-takeoff in header):
            cols: 1 client | 2 domain | 3 launched | 4 days-to-launch
       */

    /* ---- Table A: My Active Items (header has .bi-globe) ------------------ */
    /* Priority cell (col 1) — small eyebrow */
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-globe) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(1) {
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        padding-bottom: 4px !important;
    }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-globe) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(1)::before {
        content: "Priority #";
        margin-right: 4px;
    }
    /* Client cell (col 2) — card title */
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-globe) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(2) {
        font-family: var(--serif);
        font-size: 17px;
        font-weight: 500;
        color: var(--ink);
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-globe) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(2) a {
        color: var(--ink) !important;
    }
    /* Label-above-value pattern for cols 3-6 */
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-globe) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(3)::before { content: "Domain"; }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-globe) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(4)::before { content: "Stage"; }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-globe) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(5)::before { content: "Due"; }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-globe) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(6)::before { content: "Days in Stage"; }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-globe) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(n+3)::before {
        display: inline-block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-right: 6px;
        min-width: 90px;
    }

    /* ---- Table B: My Design Requests (header has .bi-palette) ------------- */
    /* Client cell (col 1) — card title */
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-palette) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(1) {
        font-family: var(--serif);
        font-size: 17px;
        font-weight: 500;
        color: var(--ink);
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-palette) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(1) a {
        color: var(--ink) !important;
    }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-palette) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(2)::before { content: "Stage"; }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-palette) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(3)::before { content: "Due"; }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-palette) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(n+2)::before {
        display: inline-block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-right: 6px;
        min-width: 60px;
    }

    /* ---- Table C: Recently Launched (header has .bi-rocket-takeoff) ------- */
    /* The Focus Project card ALSO uses .bi-rocket-takeoff inside its hero icons
       but that's inside the page hero, not inside a section.card > .card-header.
       The "My Launches" hero icon and the hero stats row also use this icon, but
       they're inside .am-hero-card, not section.card.
       Restrict by also requiring text-success class on the icon (the Recently
       Launched header's icon has `class="bi bi-rocket-takeoff me-1 text-success"`). */
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-rocket-takeoff.text-success) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(1) {
        font-family: var(--serif);
        font-size: 17px;
        font-weight: 500;
        color: var(--ink);
        padding-bottom: 6px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-rocket-takeoff.text-success) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(1) a {
        color: var(--ink) !important;
    }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-rocket-takeoff.text-success) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(2)::before { content: "Domain"; }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-rocket-takeoff.text-success) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(3)::before { content: "Launched"; }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-rocket-takeoff.text-success) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(4)::before { content: "Days to Launch"; }
    .am-dashboard.company-dashboard > section.card:has(> .card-header .bi-rocket-takeoff.text-success) .table.gmb-table:not(.opt-table) > tbody > tr > td:nth-child(n+2)::before {
        display: inline-block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-right: 6px;
        min-width: 90px;
    }

    /* Badges inside the tables — tighten so they don't overflow */
    .am-dashboard.company-dashboard > section.card .table.gmb-table:not(.opt-table) > tbody > tr > td .badge {
        font-size: 10px;
        padding: 3px 7px;
        vertical-align: baseline;
    }


    /* =============================================================================
       MOBILE: company/hosted_sites  (PR: mobile/hosted-sites)
       -----------------------------------------------------------------------------
       Web & Hosting page — per-site hosting margin table with 12 columns,
       6-card KPI strip, long pill filter bar with provider/status/category
       segments, search input, and Import/Add buttons. All credentials live
       behind an Edit modal (modal-lg).

       Mobile approach per HANDOFF.md §3-§5 + dashboard conventions:
       - .hs-kpi-grid → 2-col grid (desktop already drops to 2 at 600px; we
         tighten spacing + sizing for phones).
       - Header actions stack full-width 44px tap targets.
       - Filter pill bar becomes a single horizontal-scroll strip (allowed
         scroll region per HANDOFF §11). Search drops below full-width.
       - Main .hs-table flips to card stack: hide thead, each <tr> becomes
         a 2-col grid card. Site URL / client name span full width as title.
       - PR #15/#17/#19 lesson: grid <tr> paired with width:auto + box-sizing
         on every <td>, otherwise inherited table widths re-introduce overflow.
       - Totals tfoot row reformats as a small summary card.
       - Modals (lg) full-width; credentials grid stacks single-column.
       ============================================================================= */

    /* /company/hosted_sites — page wrapper */
    .hosted-sites-management {
        padding: 12px 14px 24px !important; /* override inline 1.5rem padding */
    }

    /* /company/hosted_sites — header (title + subtitle) */
    .hosted-sites-management .am-header {
        margin-bottom: 8px;
    }
    .hosted-sites-management .am-name {
        font-family: var(--serif);
        font-size: 28px !important; /* override inline 1.5rem */
        line-height: 1.1;
    }
    .hosted-sites-management .hs-subtitle {
        font-size: 12px;
        color: var(--ink-3);
        margin-top: 4px;
    }

    /* /company/hosted_sites — KPI grid (6 cards → 2 cols on phones) */
    .hosted-sites-management .hs-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* page <style> only kicks in at 600px */
        gap: 8px;
        margin-top: 12px;
    }
    .hosted-sites-management .hs-kpi-card {
        padding: 12px 12px;
        border-radius: 10px; /* editorial card radius */
    }
    .hosted-sites-management .hs-kpi-label {
        font-size: 9.5px;
        letter-spacing: 0.14em;
    }
    .hosted-sites-management .hs-kpi-value {
        font-family: var(--serif);
        font-size: 22px; /* serif 22-24px per HANDOFF §2 */
        line-height: 1.1;
        margin: 6px 0 4px;
    }
    .hosted-sites-management .hs-kpi-sub {
        font-size: 10.5px;
        color: var(--ink-3);
    }

    /* /company/hosted_sites — filter bar wrapper */
    /* The Bootstrap .d-flex.justify-content-between row holds the filter pill
       group on the left and the Import/Add buttons on the right. Stack them
       vertically and let the pills scroll horizontally. */
    .hosted-sites-management .hs-table-section + .d-flex,
    .hosted-sites-management .am-header + .hs-kpi-grid + .d-flex {
        flex-direction: column;
        align-items: stretch !important; /* override .align-items-center */
        gap: 10px !important;
    }
    /* Catch-all: the filter row sits between .hs-kpi-grid and .hs-table-section */
    .hosted-sites-management .hs-filter-bar {
        flex-wrap: nowrap !important;     /* override .flex-wrap on the d-flex */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px !important;
        padding-bottom: 4px;
        min-width: 0;
        width: 100%;
        scrollbar-width: none;
    }
    .hosted-sites-management .hs-filter-bar::-webkit-scrollbar {
        display: none;
    }
    .hosted-sites-management .hs-pill {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 11.5px;
        letter-spacing: 0.02em;
        min-height: 36px;
        line-height: 1;
    }
    .hosted-sites-management .hs-pill-sep {
        flex: 0 0 auto;
        align-self: center;
        padding: 0 2px;
    }
    /* Search input — extract from pill scroll-strip and pin full-width below. */
    .hosted-sites-management .hs-search {
        order: 99;
        width: 100% !important; /* override desktop fixed 200px */
        margin-left: 0 !important;
        margin-top: 6px;
        min-height: 44px;
        flex: 1 0 100%;
        font-size: 14px; /* >= 16px target on iOS would be ideal but desktop spec is 13px; bump slightly */
    }

    /* /company/hosted_sites — header action buttons (Import / Add Site) */
    /* The right-side .d-flex.gap-2 with the two action buttons. Make a 2-col
       row that fills the page width with 44px tap targets. */
    .hosted-sites-management .hs-table-section ~ .d-flex .d-flex.gap-2,
    .hosted-sites-management > .d-flex > .d-flex.gap-2 {
        width: 100%;
        gap: 8px !important;
    }
    .hosted-sites-management > .d-flex > .d-flex.gap-2 > .btn {
        flex: 1 1 0;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        border-radius: 10px;
        font-size: 12px;
    }

    /* /company/hosted_sites — table section wrapper */
    .hosted-sites-management .hs-table-section {
        margin-top: 12px;
    }
    .hosted-sites-management .status-table-wrapper {
        overflow-x: hidden !important; /* kill any inherited table overflow */
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
        border-radius: 10px;
    }

    /* /company/hosted_sites — main hs-table → card stack */
    .hosted-sites-management .hs-table {
        display: block;
        width: 100%;
        min-width: 0;
        border: 0;
        margin: 0;
        font-size: 13px;
    }
    /* Hide thead — column labels don't fit a 2-col card. */
    .hosted-sites-management .hs-table thead {
        position: absolute;
        left: -9999px;
        top: -9999px;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }
    .hosted-sites-management .hs-table tbody {
        display: block;
        width: 100%;
    }

    /* Each .hs-row → editorial card.
       PR #15/#17/#19 lesson: grid <tr> + width:auto on <td> below. */
    .hosted-sites-management .hs-table tbody tr.hs-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 10px;
        row-gap: 6px;
        align-items: start;
        width: 100%;
        padding: 12px 14px !important;
        margin-bottom: 10px;
        border: 1px solid var(--rule) !important;
        border-radius: 10px;
        background: var(--paper-2);
        box-sizing: border-box;
    }

    /* PR #15 lesson: cells need width:auto + box-sizing when parent is grid. */
    .hosted-sites-management .hs-table tbody tr.hs-row > td {
        display: block;
        width: auto !important;
        max-width: 100%;
        min-width: 0;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-sizing: border-box;
        font-family: var(--sans);
        font-size: 12px;
        line-height: 1.35;
        color: var(--ink-body) !important;
        text-align: left !important; /* override .text-end */
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Card column layout — DOM order:
       1=Site (url+client), 2=Provider, 3=Plan, 4=Category, 5=Cost/mo,
       6=Terms, 7=Avg Rev, 8=Margin, 9=Margin %, 10=Next Bill,
       11=Last Payment, 12=Actions. */

    /* Site URL + client name = card title (full width, larger). */
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(1) {
        grid-column: 1 / -1;
        font-size: 14px;
        color: var(--ink) !important;
        padding-bottom: 4px !important;
        border-bottom: 1px dotted var(--rule) !important;
        margin-bottom: 2px;
        overflow-wrap: anywhere; /* break long URLs */
        word-break: break-word;
    }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(1) .hs-site-url {
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 600;
        color: var(--ink);
    }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(1) .hs-site-url.hs-annual {
        font-weight: 700;
    }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(1) .hs-client-name {
        font-size: 11px;
        color: var(--ink-3);
        margin-top: 2px;
    }

    /* Category pill — drop into its own row, left col. */
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(4) {
        grid-column: 1 / -1;
        margin-bottom: 2px;
    }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(4) .hs-cat {
        font-size: 9.5px;
        letter-spacing: 0.14em;
        padding: 3px 10px;
    }

    /* Label-above-value pattern for the 2-col body cells (provider, plan,
       cost/mo, terms, avg rev, margin, margin%, next bill, last payment). */
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(2)::before  { content: "Provider"; }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(3)::before  { content: "Plan"; }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(5)::before  { content: "Cost / mo"; }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(6)::before  { content: "Terms"; }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(7)::before  { content: "Avg Rev"; }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(8)::before  { content: "Margin"; }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(9)::before  { content: "Margin %"; }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(10)::before { content: "Next Bill"; }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(11)::before { content: "Last Payment"; }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(2)::before,
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(3)::before,
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(5)::before,
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(6)::before,
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(7)::before,
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(8)::before,
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(9)::before,
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(10)::before,
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(11)::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
        line-height: 1.2;
    }
    /* Body cell value styling. */
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(2),
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(3),
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(5),
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(6),
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(7),
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(8),
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(9),
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(10),
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(11) {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 500;
        color: var(--ink) !important;
    }
    .hosted-sites-management .hs-table tbody tr.hs-row > td.hs-neg {
        color: var(--status-danger, #e06060) !important;
    }
    /* Last payment sub-line (date under amount). */
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(11) .hs-sub {
        font-size: 10.5px;
        color: var(--ink-3);
        margin-top: 2px;
    }

    /* Actions cell — full width footer with edit + delete buttons. */
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(12) {
        grid-column: 1 / -1;
        display: flex !important;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 6px;
        padding-top: 8px !important;
        border-top: 1px solid var(--rule) !important;
        overflow: visible;
    }
    .hosted-sites-management .hs-table tbody tr.hs-row > td:nth-child(12) .hs-action-icon {
        width: 44px;
        height: 44px;
        border-radius: 8px;
        font-size: 14px;
        border: 1px solid var(--rule);
        background: var(--paper-3);
    }

    /* /company/hosted_sites — totals tfoot row → summary card */
    .hosted-sites-management .hs-table tfoot {
        display: block;
        width: 100%;
    }
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 10px;
        row-gap: 6px;
        width: 100%;
        padding: 12px 14px !important;
        margin-top: 4px;
        border: 1px solid var(--accent, var(--rule)) !important;
        border-radius: 10px;
        background: var(--paper-2);
        box-sizing: border-box;
    }
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td {
        display: block;
        width: auto !important;
        max-width: 100%;
        min-width: 0;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-sizing: border-box;
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink) !important;
        text-align: left !important;
    }
    /* Hide the empty colspan filler cells (cols 2-4 and 6 and 10-13). */
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(2),
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(4),
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(7) {
        display: none;
    }
    /* DOM-order for totals row:
       1=Sites label (full width), 2=colspan3 [hidden],
       3=Cost (col-1, "Total Cost"), 4=empty [hidden],
       5=Revenue (col-2, "Total Rev"), 6=Margin (full width, "Net Margin"),
       7=colspan4 [hidden]. */
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(1) {
        grid-column: 1 / -1;
        font-family: var(--sans);
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3) !important;
        padding-bottom: 4px !important;
        border-bottom: 1px dotted var(--rule) !important;
    }
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(3)::before { content: "Total Cost"; }
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(5)::before { content: "Total Rev"; }
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(6)::before { content: "Net Margin"; }
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(3)::before,
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(5)::before,
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(6)::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
        line-height: 1.2;
    }
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(3),
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(5) {
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 600;
        color: var(--ink) !important;
    }
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(6) {
        grid-column: 1 / -1;
        padding-top: 6px !important;
        border-top: 1px dotted var(--rule) !important;
        margin-top: 2px;
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
        color: var(--ink) !important;
    }
    .hosted-sites-management .hs-table tfoot tr.hs-totals-row > td:nth-child(6).hs-neg {
        color: var(--status-danger, #e06060) !important;
    }

    /* /company/hosted_sites — empty state */
    .hosted-sites-management .hs-empty {
        padding: 32px 16px;
        border-radius: 10px;
        font-size: 13px;
    }
    .hosted-sites-management .hs-empty i {
        font-size: 1.5rem;
    }

    /* /company/hosted_sites — Add / Edit / Import modals (modal-lg) */
    /* Bootstrap already handles modal-lg full-width on phones, but the
       credentials grid (.row.g-2 with col-md-4) needs the form-control sizing
       and field spacing tightened. */
    #addSiteModal .modal-body,
    #editSiteModal .modal-body,
    #importSiteModal .modal-body {
        padding: 14px;
    }
    #addSiteModal .modal-body .form-control,
    #addSiteModal .modal-body .form-select,
    #editSiteModal .modal-body .form-control,
    #editSiteModal .modal-body .form-select,
    #importSiteModal .modal-body .form-control {
        min-height: 44px;
        font-size: 14px;
    }
    #addSiteModal .modal-body .form-label,
    #editSiteModal .modal-body .form-label,
    #importSiteModal .modal-body .form-label {
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    /* Credentials section header + reveal button — stack on phones. */
    #editSiteModal .modal-body .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 8px;
    }
    #editSiteModal #hsRevealCreds {
        min-height: 40px;
        font-size: 12px;
    }
    /* Modal footers — make buttons full-width 44px tap targets. */
    #addSiteModal .modal-footer,
    #editSiteModal .modal-footer,
    #importSiteModal .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
        padding: 12px 14px;
    }
    #addSiteModal .modal-footer > .btn,
    #editSiteModal .modal-footer > .btn,
    #importSiteModal .modal-footer > .btn {
        width: 100%;
        min-height: 44px;
        margin: 0;
    }


    /* =============================================================================
       MOBILE: company/payments_customer_ids
       -----------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing), §4.5 (cards), §4.12 (tables -> cards), §5
       (page patterns). The shared .payments-header / .payments-hero-row /
       .payments-toolbar / .payments-table-wrap rules above already handle the
       outer chrome. This block targets the customer-ids-specific bits:

         1. #cidSearch has inline `min-width: 280px` that forces toolbar overflow
            below 375px -- override to fit the viewport.
         2. #cidTable is a plain (NOT data-mobile="cards") table with 5 cols of
            inputs/select/email. Flip rows to a single-column card stack with
            data-label::before headers driven by column position (no JS, no
            template change). Pair each grid-flipped <tr> with width:auto +
            box-sizing on the <td> (PR #15/#17/#19 lesson).
         3. .payments-modal-shroud center-flex modal: shrink padding so the
            fuzzy-match dialog actually fits on a 375px viewport.
       ============================================================================= */

    /* /company/payments_customer_ids -- search input min-width override */
    .payments-customer-ids #cidSearch {
        min-width: 0;                    /* override inline style="min-width:280px" */
        width: 100%;
        box-sizing: border-box;
        min-height: 44px;                /* HANDOFF §3.5 tap target */
        font-size: 13px;
    }
    .payments-customer-ids .payments-toolbar-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
    }
    .payments-customer-ids .payments-pill-filter {
        align-self: flex-start;          /* don't stretch the checkbox row full-width */
    }

    /* /company/payments_customer_ids -- table wrapper */
    .payments-customer-ids .payments-table-wrap {
        overflow-x: hidden;
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
        padding: 0 12px;
        box-sizing: border-box;
    }

    /* /company/payments_customer_ids -- table -> card-stack */
    .payments-customer-ids #cidTable {
        display: block;
        width: 100%;
        max-width: 100%;
        table-layout: auto;
        border: 0;
    }
    .payments-customer-ids #cidTable colgroup {
        display: none;                   /* desktop col widths irrelevant here */
    }
    .payments-customer-ids #cidTable thead {
        position: absolute;
        left: -9999px;
        top: -9999px;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }
    .payments-customer-ids #cidTable tbody {
        display: block;
        width: 100%;
    }

    /* Each <tr data-client-id> -> stacked card (single column for readability;
       these cells are inputs that benefit from full width). */
    .payments-customer-ids #cidTable tbody tr[data-client-id] {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        row-gap: 10px;
        width: 100%;
        margin: 0 0 8px 0;
        padding: 12px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        box-sizing: border-box;
    }
    /* CRITICAL: width auto + box-sizing so cells don't inherit the colgroup
       widths or any table-cell auto-sizing (PR #15/#17/#19 lesson). */
    .payments-customer-ids #cidTable tbody tr[data-client-id] > td {
        display: block;
        width: auto !important;          /* break inherited col widths */
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
        padding: 0;
        border: 0;
        text-align: left;
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-body);
    }

    /* Inject column labels via ::before. Order matches <thead>:
       1=Client (acts as card title -- no label), 2=Email, 3=Stripe, 4=FanBasis,
       5=Primary. */
    .payments-customer-ids #cidTable tbody tr[data-client-id] > td:nth-child(n+2)::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
        line-height: 1.2;
    }
    .payments-customer-ids #cidTable tbody tr[data-client-id] > td:nth-child(2)::before {
        content: "Email";
    }
    .payments-customer-ids #cidTable tbody tr[data-client-id] > td:nth-child(3)::before {
        content: "Stripe customer ID";
    }
    .payments-customer-ids #cidTable tbody tr[data-client-id] > td:nth-child(4)::before {
        content: "FanBasis customer ID";
    }
    .payments-customer-ids #cidTable tbody tr[data-client-id] > td:nth-child(5)::before {
        content: "Primary provider";
    }

    /* Cell 1 (Client) -- treat as card header: name link + country chip + AM
       status all inline-flow, no label prefix. */
    .payments-customer-ids #cidTable tbody tr[data-client-id] > td:first-child {
        padding-bottom: 8px;
        border-bottom: 1px dotted var(--rule);
    }
    .payments-customer-ids #cidTable tbody tr[data-client-id] > td:first-child a {
        font-family: var(--sans);
        font-size: 15px;
        font-weight: 600;
        color: var(--ink);
        word-break: break-word;
    }
    .payments-customer-ids #cidTable .payments-country {
        margin-left: 6px;
        font-size: 10px;
        letter-spacing: 0.14em;
    }
    .payments-customer-ids #cidTable .payments-am {
        font-size: 11.5px;
        color: var(--ink-3);
        margin-top: 2px;
    }

    /* Cell 2 (Email) -- monospace, wrap long addresses */
    .payments-customer-ids #cidTable .payments-cid-email {
        font-family: var(--mono);
        font-size: 12px;
        color: var(--ink-body);
        word-break: break-all;
        overflow-wrap: anywhere;
    }

    /* Cells 3/4/5 (inputs + select) -- full width, tap-friendly */
    .payments-customer-ids #cidTable .payments-cid-input {
        width: 100%;
        box-sizing: border-box;
        min-height: 44px;                /* HANDOFF §3.5 tap target */
        font-size: 13px;
        padding: 10px 12px;
    }
    /* Select dropdown gets matching height (some UAs ignore min-height on select) */
    .payments-customer-ids #cidTable select.payments-cid-input {
        height: 44px;
        padding-right: 28px;             /* breathing room for native chevron */
    }

    /* /company/payments_customer_ids -- fuzzy-match modal sizing */
    .payments-customer-ids ~ .payments-modal-shroud,
    body .payments-modal-shroud#fuzzyMatchModal {
        /* Shroud has fixed inset:0 so it's already viewport-bound; just trim
           padding so the dialog uses the full mobile width. */
        padding: 12px;
    }
    body .payments-modal-shroud#fuzzyMatchModal .payments-modal {
        max-width: 100%;
        max-height: calc(100vh - 24px);
        border-radius: 16px;             /* HANDOFF §3.4 prominent surface */
    }
    body .payments-modal-shroud#fuzzyMatchModal .payments-modal-header {
        padding: 12px 14px;
    }
    body .payments-modal-shroud#fuzzyMatchModal .payments-modal-header h2 {
        font-family: var(--serif);
        font-size: 18px;
    }
    body .payments-modal-shroud#fuzzyMatchModal .payments-modal-body {
        padding: 14px;
        gap: 12px;
        font-size: 13px;
    }
    body .payments-modal-shroud#fuzzyMatchModal .payments-modal-footer {
        flex-direction: column-reverse;  /* primary action on top, easier reach */
        align-items: stretch;
        gap: 8px;
        padding: 12px 14px;
    }
    body .payments-modal-shroud#fuzzyMatchModal .payments-modal-footer .payments-btn {
        width: 100%;
        min-height: 44px;                /* HANDOFF §3.5 tap target */
        box-sizing: border-box;
        justify-content: center;
        font-size: 13px;
    }
    body .payments-modal-shroud#fuzzyMatchModal .payments-modal-close {
        width: 44px;
        height: 44px;                    /* HANDOFF §3.5 tap target */
    }



    /* =============================================================================
       MOBILE: /company/lifecycle  (PR: mobile/company-lifecycle)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing) + §4 (card / stat / pill components) +
       §5 (per-page card-stack pattern).

       Wide-element inventory (desktop -> mobile transforms applied):
         1. .lc-container        24px padding -> 12px 14px, kill overflow-x.
         2. .lc-header           flex row title+buttons -> column stack.
         3. .lc-pipeline         3 stages in a row -> stays 3 cols but tighter.
         4. .lc-stats            4 stat cards in row -> 2x2 grid.
         5. .lc-table            7-col table -> card-stack with labels via ::before.
         6. .lc-actions          row of icon buttons stays inline at 44px.

       PR #15/#17/#19 lesson applied: every <tr> flipped to display:grid is paired
       with `td { width: auto !important; box-sizing: border-box }` so cells don't
       inherit any desktop min-width from the table.

       Page-specific anchor: `.lc-container` on every selector to keep scoped.
       ============================================================================= */

    /* /company/lifecycle — page wrapper: belt-and-braces no horizontal overflow */
    .lc-container {
        padding: 12px 14px;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* /company/lifecycle — header: title + actions stack vertically */
    .lc-container .lc-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 16px;
    }
    .lc-container .lc-header h1 {
        font-family: var(--serif);
        font-weight: 500;
        font-size: 28px;
        line-height: 1.15;
        letter-spacing: -0.01em;
        color: var(--ink);
    }
    /* Action button row (inline style="display:flex; gap:8px;" on a div) */
    .lc-container .lc-header > div {
        width: 100%;
        gap: 8px !important;               /* defeat inline gap:8px to keep equal */
        flex-wrap: wrap;
    }
    .lc-container .lc-header > div > .lc-action-btn {
        flex: 1 1 0;
        min-height: 44px;
        padding: 10px 12px !important;     /* defeat inline padding:8px 16px */
        font-family: var(--sans);
        font-weight: 600;
        font-size: 11.5px !important;      /* defeat inline font-size:13px */
        letter-spacing: 0.16em;
        text-transform: uppercase;
        justify-content: center;
    }

    /* /company/lifecycle — pipeline: 3 stages stay in a row, tighter padding */
    .lc-container .lc-pipeline {
        gap: 0;
        margin-bottom: 16px;
    }
    .lc-container .lc-pipe-stage {
        padding: 10px 6px;
        min-height: 56px;
    }
    .lc-container .lc-pipe-stage .pipe-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        line-height: 1.2;
    }
    .lc-container .lc-pipe-stage .pipe-count {
        font-family: var(--serif);
        font-weight: 500;
        font-size: 22px;
        margin-top: 4px;
        color: var(--ink);
    }

    /* /company/lifecycle — stats: 4 cards in a row -> 2x2 grid */
    .lc-container .lc-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 16px;
    }
    .lc-container .lc-stat-card {
        min-width: 0;                      /* break flex min-width:120px */
        padding: 12px 14px;
        border-radius: 10px;
    }
    .lc-container .lc-stat-label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }
    .lc-container .lc-stat-value {
        font-family: var(--serif);
        font-weight: 500;
        font-size: 24px;
        margin-top: 4px;
        line-height: 1.1;
    }

    /* /company/lifecycle — table wrapper: drop the border/radius so cards read clean */
    .lc-container > div[style*="border-radius: 10px"] {
        background: transparent !important;            /* inline bg fights card-stack */
        border: 0 !important;                          /* inline border becomes noise */
        border-radius: 0 !important;
        overflow: visible !important;                  /* inline overflow:hidden clips */
    }

    /* /company/lifecycle — table -> card-stack ------------------------------- */
    .lc-container .lc-table,
    .lc-container .lc-table thead,
    .lc-container .lc-table tbody,
    .lc-container .lc-table tr,
    .lc-container .lc-table td {
        display: block;
        width: 100%;
    }
    /* Hide the desktop header row entirely; each card has its own labels via ::before */
    .lc-container .lc-table thead {
        display: none;
    }
    .lc-container .lc-table tr.lc-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 10px;
        row-gap: 8px;
        align-items: start;
        padding: 12px;
        margin-bottom: 10px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
    }
    /* PR #15/#17/#19 lesson: td must reset width + box-sizing so cells don't
       inherit any width from the desktop table layout. */
    .lc-container .lc-table tr.lc-row > td {
        width: auto !important;
        box-sizing: border-box;
        padding: 0 !important;             /* grid gaps handle spacing */
        border: 0;
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-body);
        vertical-align: top;
        background: transparent !important;        /* defeat tr:hover td bg */
    }
    /* Row hover bg looks weird on card; null it. */
    .lc-container .lc-table tr.lc-row:hover > td {
        background: transparent !important;
    }

    /* Card layout:
         td:1 (Client)        -> col span 2, card title
         td:2 (Stage)         -> col 1
         td:3 (Days)          -> col 2
         td:4 (AM)            -> col span 2
         td:5 (Deliverables)  -> col span 2 with progress bar
         td:6 (Content Brain) -> col 1
         td:7 (Actions)       -> col 2, right aligned
    */
    .lc-container .lc-table tr.lc-row > td:nth-child(1) {
        grid-column: 1 / -1;
        padding-bottom: 4px !important;
        border-bottom: 1px dotted var(--rule);
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(1) .client-link {
        font-family: var(--serif);
        font-weight: 500;
        font-size: 18px;
        line-height: 1.2;
        color: var(--ink);
        text-decoration: none;
        overflow-wrap: anywhere;
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(2) {
        grid-column: 1;
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(3) {
        grid-column: 2;
        text-align: right;
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(4) {
        grid-column: 1 / -1;
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(5) {
        grid-column: 1 / -1;
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(6) {
        grid-column: 1;
        align-self: center;
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(7) {
        grid-column: 2;
        text-align: right;
        align-self: center;
    }

    /* Inline ::before labels for the metric cells (stage/days/am/deliverables) */
    .lc-container .lc-table tr.lc-row > td:nth-child(2)::before {
        content: "Stage";
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(3)::before {
        content: "Days";
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(4)::before {
        content: "Account Manager";
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(5)::before {
        content: "Deliverables";
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(6)::before {
        content: "Content Brain";
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(7)::before {
        content: "Actions";
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(n+2)::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
        line-height: 1.2;
    }

    /* Stage badge keeps its pill shape; ensure consistent sizing on mobile */
    .lc-container .lc-table .lc-stage-badge {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        padding: 4px 10px;
        border-radius: 999px;
    }

    /* Days cell: defeat the inline font-size:12px so it lines up with badge */
    .lc-container .lc-table tr.lc-row > td:nth-child(3) {
        font-family: var(--sans);
        font-size: 14px !important;        /* defeat inline font-size:12px */
        font-weight: 500;
        color: var(--ink) !important;      /* defeat inline color:var(--text-400) */
    }

    /* Deliverables: progress bar fills the row, count sits right */
    .lc-container .lc-table tr.lc-row > td:nth-child(5) > div {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .lc-container .lc-table tr.lc-row .lc-progress-bar {
        width: auto;                       /* defeat desktop fixed 100px */
        flex: 1;
        height: 6px;
        border-radius: 999px;
    }
    .lc-container .lc-table tr.lc-row .lc-progress-fill {
        border-radius: 999px;
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(5) > div > span {
        font-family: var(--sans);
        font-size: 12px !important;        /* defeat inline font-size:11px */
        color: var(--ink-body) !important; /* defeat inline color:var(--text-400) */
        flex-shrink: 0;
    }

    /* Content Brain link / Not linked text */
    .lc-container .lc-table tr.lc-row > td:nth-child(6) .lc-action-btn {
        font-size: 10.5px !important;
        padding: 6px 10px !important;
        min-height: 32px;
    }
    .lc-container .lc-table tr.lc-row > td:nth-child(6) > span {
        font-family: var(--sans);
        font-size: 12px !important;
    }

    /* Actions: row of icon buttons, kept inline at 44px tap targets */
    .lc-container .lc-table tr.lc-row .lc-actions {
        display: inline-flex;
        gap: 6px;
        justify-content: flex-end;
    }
    .lc-container .lc-table tr.lc-row .lc-action-btn {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 10.5px;
        border-radius: 6px;
    }

    /* AM cell text styling */
    .lc-container .lc-table tr.lc-row .lc-am {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-body);
    }

    /* /company/lifecycle — empty state */
    .lc-container .lc-empty {
        padding: 40px 16px;
        font-family: var(--sans);
        color: var(--ink-3);
    }
    .lc-container .lc-empty i {
        font-size: 36px;
        margin-bottom: 10px;
    }
    .lc-container .lc-empty p {
        font-size: 13px;
    }

    /* =============================================================================
       /company/content-engine-v2b — design variant: card titles wrap, sticky panel disabled, filter polish
       -----------------------------------------------------------------------------
       Top-up rules for the JS-rendered ".ce-b" page card variant. All selectors
       are scoped to the page-private ".ce-b*" prefix. The template already has
       inline media queries at 900px (stack columns + KPIs to 2-col) and 500px
       (KPIs to 1-col); these rules only adjust phone-specific concerns:
         - Allow long card titles to wrap (kill nowrap+ellipsis)
         - Wrap card meta row so keyword/badge/status never push width
         - Disable position:sticky on the right panel once columns are stacked
         - Filter pills + select get proper tap target heights, 15px to avoid
           iOS auto-zoom on the <select>
         - Generate / Audit / Map action buttons grow to 40px and share width
       ============================================================================= */

    /* Card title: wrap on phones so long page_title strings stay readable */
    .ce-b .ce-b-card-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
        line-height: 1.3;
        margin-bottom: 6px;
    }

    /* Card meta row: wrap chips so they don't push card width */
    .ce-b .ce-b-card-meta {
        flex-wrap: wrap;
        row-gap: 6px;
    }

    /* Right panel: stacked under .ce-b-left at <=900px, so sticky top:80px
       would lock it mid-scroll. Neutralize to static positioning on phones. */
    .ce-b .ce-b-panel {
        position: static;
        top: auto;
    }

    /* Filter bar polish: pills are tappable, select is 40px / 15px to dodge
       iOS zoom-on-focus behaviour for <select> with font-size < 16px. */
    .ce-b .ce-b-filterbar {
        gap: 8px;
    }
    .ce-b .ce-b-filterbar .ce-b-select {
        min-height: 40px;
        font-size: 15px;
        padding: 8px 12px;
        border-radius: 8px;
        flex: 1 1 100%;
    }
    .ce-b .ce-b-filterbar .ce-b-pill {
        min-height: 32px;
        padding: 6px 14px;
        display: inline-flex;
        align-items: center;
        font-size: 12px;
    }

    /* Panel action buttons: 40px tap targets, evenly split the row */
    .ce-b .ce-b-panel-actions {
        gap: 8px;
    }
    .ce-b .ce-b-panel-actions .ce-b-panel-btn {
        flex: 1;
        min-height: 40px;
        padding: 8px 12px;
        font-size: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* /company/bot-registry — Bot Registry: Kanban → stacked, tab strips, action items, activity, troubleshoot
       =========================================================================
       Per HANDOFF.md §3.3 (screen padding 14px), §4.3 (tab strips horizontal-
       scroll, no scrollbar), §4.5 (cards: bg-elev fill, line border, r-md,
       no shadow), §4.6 (stat 2-up), §4.9 (44px buttons), §11 (tab strips
       allowed to horizontal-scroll, page content must not).

       Topping up legacy inline rules (template lines 1733+) which are
       pre-mobile-v2 era. We scope every selector under
       `.am-dashboard.company-dashboard` so nothing bleeds to other pages
       sharing .br-*/.optimus-* classes (only bot-registry uses this wrapper
       combo). The desktop Kanban grid (4 columns @ ≥1400px, 2 @ 1400, 1 @
       900) already collapses to 1 column on mobile via the inline rules at
       lines 272-273; we are restyling the cards/columns themselves to the
       editorial look and killing the radial gradient / glow / box-shadow
       inheritance from the Nexus dark theme. */

    /* Page wrapper: no horizontal scroll, edge padding consistent with §3.3 */
    .am-dashboard.company-dashboard {
        overflow-x: hidden;
    }
    .am-dashboard.company-dashboard .br-container {
        display: block;                     /* defeat desktop flex */
        padding: 0;
        margin: 0;
    }
    .am-dashboard.company-dashboard .br-main {
        padding: 0;                         /* desktop has 20px 24px — page already has m-screen padding */
        max-height: none;                   /* defeat inline calc(100vh - 120px) */
        overflow-y: visible;
        background: transparent;
        width: 100%;
        max-width: 100%;
    }

    /* Optimus status pill — header row should wrap, pill sits below title */
    .am-dashboard.company-dashboard > .am-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    .am-dashboard.company-dashboard .optimus-status-pill {
        max-width: 100%;
        font-size: 11.5px;
        padding: 6px 12px;
        white-space: normal;                /* allow wrap on small screens */
        flex-wrap: wrap;
        gap: 8px;
    }
    .am-dashboard.company-dashboard .optimus-status-pill-meta {
        display: none;                      /* mirror inline @media (max-width:900px) */
    }
    .am-dashboard.company-dashboard .optimus-status-pill-reset {
        min-height: 32px;
        font-size: 10.5px;
    }

    /* Main header — title + refresh indicator stacks on mobile */
    .am-dashboard.company-dashboard .br-main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }
    .am-dashboard.company-dashboard .br-main-title {
        font-family: var(--serif);
        font-size: 22px;                    /* serif h-section per §2 */
        font-weight: 500;
        color: var(--ink);
        line-height: 1.15;
    }
    .am-dashboard.company-dashboard .br-main-title .bi {
        font-size: 18px;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard .br-refresh-indicator {
        font-family: var(--sans);
        font-size: 10.5px;
        color: var(--ink-3);
        letter-spacing: 0.04em;
    }

    /* View toggle bar (Tasks / Action Items / Activity / Troubleshoot) — §4.3
       horizontal-scroll tab strip. Override the .view-toggle-bar global to
       allow scroll instead of wrap, with hidden scrollbar. */
    .am-dashboard.company-dashboard .view-toggle-bar {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 4px;
        padding: 4px;
        margin: 0 0 12px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-bottom: 1px solid var(--rule);
        border-radius: 0;                   /* flatten the rounded bar on mobile */
    }
    .am-dashboard.company-dashboard .view-toggle-bar::-webkit-scrollbar {
        display: none;
    }
    .am-dashboard.company-dashboard .view-toggle-bar .view-toggle {
        flex-shrink: 0;
        min-height: 40px;                   /* tap target */
        padding: 10px 14px;
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        white-space: nowrap;
    }
    .am-dashboard.company-dashboard .view-toggle-bar .br-filter-count {
        font-family: var(--sans);
        font-size: 10px;
        padding: 1px 6px;
        border-radius: 999px;
    }

    /* Status sub-tabs (All / Running / Completed / Failed + date filter +
       sort toggle). Same horizontal-scroll tab-strip pattern. The desktop
       layout shoves the date-range select + sort toggle to the right via
       margin-left:auto; on mobile we let them flow inline after the tabs. */
    .am-dashboard.company-dashboard .br-status-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        align-items: center;
        gap: 6px;
        padding: 4px 6px;
        margin-bottom: 12px;
        border-radius: 8px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .am-dashboard.company-dashboard .br-status-tabs::-webkit-scrollbar {
        display: none;
    }
    .am-dashboard.company-dashboard .br-status-tab {
        flex-shrink: 0;
        min-height: 36px;
        padding: 8px 12px;
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        border-radius: 6px;
    }
    .am-dashboard.company-dashboard .br-status-tab.active {
        background: var(--accent-soft);
        color: var(--ink);
    }
    .am-dashboard.company-dashboard .br-status-tab-count {
        font-family: var(--sans);
        font-size: 9.5px;
        padding: 1px 6px;
        border-radius: 999px;
        background: var(--paper);
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard .br-status-tab.active .br-status-tab-count {
        background: var(--accent);
        color: var(--ink);
    }
    /* The date-range select + sort toggle ride along inside the same strip.
       Inline `margin-left:auto` on the wrapping span pushes them out of flow
       on narrow viewports — neutralize it. */
    .am-dashboard.company-dashboard .br-status-tabs > span[style*="margin-left:auto"] {
        margin-left: 0 !important;          /* defeat inline margin-left:auto */
        flex-shrink: 0;
        display: inline-flex;
        gap: 6px;
        align-items: center;
    }
    .am-dashboard.company-dashboard .br-status-tabs select#dateRangeFilter {
        min-height: 36px;
        padding: 6px 10px !important;       /* defeat inline padding:3px 8px */
        font-size: 11px !important;         /* defeat inline font-size:11px (kept) */
        font-family: var(--sans);
        border-radius: 6px;
        background: var(--paper) !important;
        color: var(--ink) !important;
        border: 1px solid var(--rule) !important;
    }
    .am-dashboard.company-dashboard .br-sort-toggle {
        min-height: 36px;
        padding: 8px 12px;
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 600;
        border-radius: 6px;
        margin-left: 0;                     /* defeat desktop margin-left:auto */
        white-space: nowrap;
    }

    /* Usage panel — strip the gradient + inset shadow, stack stats vertically */
    .am-dashboard.company-dashboard .br-usage-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 14px;
        margin-bottom: 14px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        box-shadow: none;                   /* kill inset gradient shadow */
    }
    .am-dashboard.company-dashboard .br-usage-stats {
        flex-wrap: wrap;
        gap: 14px 20px;
    }
    .am-dashboard.company-dashboard .br-usage-stat {
        min-width: 0;
    }
    .am-dashboard.company-dashboard .br-usage-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard .br-usage-value {
        font-family: var(--serif);
        font-size: 20px;
        font-weight: 500;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard .br-usage-breakdown {
        margin-left: 0;                     /* defeat desktop margin-left:auto */
        gap: 6px;
    }
    .am-dashboard.company-dashboard .br-usage-chip {
        font-family: var(--sans);
        font-size: 10.5px;
        padding: 3px 8px;
        border-radius: 999px;
        background: var(--paper);
        border: 1px solid var(--rule);
        color: var(--ink-body);
    }

    /* Task Board — stack the 4 columns vertically (HARD RULE 3: no horizontal
       scroll on page content). Desktop already has @media (max-width:900px)
       collapsing to 1fr, but the column padding/min-heights/gradients are
       still desktop-sized. Override here. */
    .am-dashboard.company-dashboard .br-board {
        display: flex;
        flex-direction: column;
        gap: 12px;
        grid-template-columns: 1fr;         /* keep grid fallback explicit */
    }
    .am-dashboard.company-dashboard .br-column {
        width: 100%;
        min-width: 0;
        min-height: 0;
        padding: 12px;
        border-radius: 10px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        box-shadow: none;                   /* kill inset radial gradient shadow */
        overflow: visible;
    }
    /* Kill the radial-gradient + hover glow + ::after overlay on each column.
       These are desktop dark-mode flourishes; on cream paper they wash out. */
    .am-dashboard.company-dashboard .br-column::after {
        display: none;
    }
    .am-dashboard.company-dashboard .br-column:hover {
        border-color: var(--rule);
        box-shadow: none;
    }
    /* Keep the colored top-border accent per status — those are semantic. */
    .am-dashboard.company-dashboard .br-column.queued,
    .am-dashboard.company-dashboard .br-column.running {
        border-top: 2px solid var(--accent);
    }
    .am-dashboard.company-dashboard .br-column.completed {
        border-top: 2px solid var(--up, var(--status-success));
    }
    .am-dashboard.company-dashboard .br-column.failed {
        border-top: 2px solid var(--down, var(--status-danger));
    }
    .am-dashboard.company-dashboard .br-column-header {
        gap: 8px;
        padding-bottom: 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid var(--rule);
    }
    .am-dashboard.company-dashboard .br-column-title {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard .br-column-count {
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 600;
        padding: 2px 8px;
        border-radius: 999px;
        background: var(--paper);
        border: 1px solid var(--rule);
        color: var(--ink-body);
    }
    /* "Clear All" mini button in column header — inline styled in template,
       needs a touch larger on mobile for tap target. */
    .am-dashboard.company-dashboard .br-column-header .br-task-btn {
        min-height: 32px;
        padding: 6px 10px !important;       /* defeat inline padding:2px 8px */
        font-size: 10px !important;         /* defeat inline font-size:10px (kept) */
        margin-left: auto;
    }

    /* Task card inside column — flat editorial card (no glow, no radial bg) */
    .am-dashboard.company-dashboard .br-task {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 8px;
        background: var(--paper);
        border: 1px solid var(--rule);
        box-shadow: none;
        max-width: 100%;
        overflow: hidden;
    }
    .am-dashboard.company-dashboard .br-task::after {
        display: none;                      /* kill hover-glow overlay */
    }
    .am-dashboard.company-dashboard .br-task:hover {
        border-color: var(--rule);
        box-shadow: none;
    }
    .am-dashboard.company-dashboard .br-task:active {
        transform: none;                    /* editorial = no scale on tap */
    }
    .am-dashboard.company-dashboard .br-task-top {
        gap: 8px;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard .br-task-title {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 500;
        color: var(--ink);
        line-height: 1.35;
    }
    .am-dashboard.company-dashboard .br-priority {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
    }
    .am-dashboard.company-dashboard .br-task-meta {
        gap: 6px 10px;
        font-family: var(--sans);
        font-size: 11px;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard .br-task-time {
        margin-left: auto;
    }
    .am-dashboard.company-dashboard .br-task-desc-preview {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-body);
        line-height: 1.45;
    }
    /* Task actions row — 44px tap targets, allow wrap on narrow viewports */
    .am-dashboard.company-dashboard .br-task-actions {
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--rule);
    }
    .am-dashboard.company-dashboard .br-task-btn {
        min-height: 36px;                   /* HANDOFF §3.5 small-button height (34) bumped to 36 for inline-dense rows */
        padding: 8px 12px;
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: 0.08em;
        border-radius: 6px;
    }
    .am-dashboard.company-dashboard .br-task-btn.dispatch {
        background: var(--accent-soft);
        color: var(--ink);
        border-color: var(--accent);
    }
    .am-dashboard.company-dashboard .br-task-btn.dispatch:hover {
        background: var(--accent);
        box-shadow: none;
    }

    /* Status indicators (queued/running pills inside task header) */
    .am-dashboard.company-dashboard .br-status-indicator {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
    }
    .am-dashboard.company-dashboard .br-status-badge {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
    }

    /* Action items board */
    .am-dashboard.company-dashboard #actionItemsBoard {
        margin-top: 4px;
    }
    .am-dashboard.company-dashboard .br-action-card {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 8px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        box-shadow: none;
    }
    .am-dashboard.company-dashboard .br-action-card::after {
        display: none;
    }
    .am-dashboard.company-dashboard .br-action-card:hover {
        border-color: var(--rule);
        box-shadow: none;
    }
    .am-dashboard.company-dashboard .br-action-header {
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 8px;
    }
    .am-dashboard.company-dashboard .br-action-title {
        font-family: var(--sans);
        font-size: 14px;
        font-weight: 500;
        color: var(--ink);
        line-height: 1.35;
        margin-bottom: 6px;
    }
    .am-dashboard.company-dashboard .br-action-desc {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-body);
        line-height: 1.45;
    }
    .am-dashboard.company-dashboard .br-action-client {
        font-family: var(--sans);
        font-size: 12px;
        font-weight: 500;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard .br-action-time {
        font-family: var(--sans);
        font-size: 10.5px;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard .br-action-priority {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
    }
    .am-dashboard.company-dashboard .br-action-source {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard .br-action-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    .am-dashboard.company-dashboard .br-action-buttons {
        gap: 8px;
        flex-wrap: wrap;
    }
    .am-dashboard.company-dashboard .br-action-approve,
    .am-dashboard.company-dashboard .br-action-deny {
        min-height: 36px;
        padding: 8px 14px;
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: 0.08em;
        border-radius: 6px;
    }

    /* Activity feed — Activity overview stats grid + fleet rows + event list */
    .am-dashboard.company-dashboard #activityStats {
        grid-template-columns: 1fr 1fr !important;  /* defeat inline minmax(140px,1fr) → forces 2-up */
        gap: 10px !important;
    }
    .am-dashboard.company-dashboard .br-stat-card {
        padding: 12px;
        border-radius: 10px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        box-shadow: none;
    }
    .am-dashboard.company-dashboard .br-stat-card::after {
        display: none;
    }
    .am-dashboard.company-dashboard .br-stat-card:hover {
        border-color: var(--rule);
        box-shadow: none;
    }
    .am-dashboard.company-dashboard .br-stat-card .stat-value {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        color: var(--ink);
        line-height: 1.1;
    }
    .am-dashboard.company-dashboard .br-stat-card .stat-label {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-top: 4px;
    }
    /* Fleet row (Activity > Fleet Health) */
    .am-dashboard.company-dashboard .br-fleet-row {
        flex-wrap: wrap;
        gap: 6px 10px;
        padding: 10px 12px;
        font-family: var(--sans);
        font-size: 12px;
    }
    .am-dashboard.company-dashboard .br-fleet-name {
        min-width: 0;
        font-size: 13px;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard .br-fleet-time,
    .am-dashboard.company-dashboard .br-fleet-result {
        font-size: 11px;
        color: var(--ink-3);
    }
    /* Activity feed event list */
    .am-dashboard.company-dashboard .br-activity-item {
        padding: 10px 12px;
        border-radius: 10px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        box-shadow: none;
    }
    .am-dashboard.company-dashboard .br-activity-item::after {
        display: none;
    }
    .am-dashboard.company-dashboard .br-activity-item:hover {
        background: var(--paper-2);
        border-color: var(--rule);
        box-shadow: none;
    }
    .am-dashboard.company-dashboard .br-activity-icon {
        width: 32px;
        height: 32px;
        border-radius: 6px;
        font-size: 14px;
    }
    .am-dashboard.company-dashboard .br-activity-title {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 500;
        color: var(--ink);
    }
    .am-dashboard.company-dashboard .br-activity-detail {
        font-family: var(--sans);
        font-size: 11.5px;
        color: var(--ink-body);
        line-height: 1.4;
    }
    .am-dashboard.company-dashboard .br-activity-meta {
        gap: 6px 10px;
        font-family: var(--sans);
        font-size: 10.5px;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard .br-activity-tag,
    .am-dashboard.company-dashboard .br-activity-sentiment {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        padding: 2px 7px;
        border-radius: 999px;
    }

    /* Troubleshoot panel — header row stacks, "Report Bug" / "Clear stale"
       buttons get tap-target sizing */
    .am-dashboard.company-dashboard #troubleshootBoard > div[style*="flex-wrap:wrap"] {
        flex-direction: column;
        align-items: stretch !important;    /* defeat inline align-items:center */
        gap: 10px;
    }
    .am-dashboard.company-dashboard #troubleshootBoard > div[style*="flex-wrap:wrap"] > div[style*="display:flex"] {
        flex-wrap: wrap;
        gap: 8px;
    }
    .am-dashboard.company-dashboard #tsClearStaleBtn,
    .am-dashboard.company-dashboard #troubleshootBoard button[onclick*="_tsOpenModal"] {
        min-height: 40px;
        padding: 10px 14px !important;      /* defeat inline padding:5px 12px / 5px 14px */
        font-size: 11px !important;         /* defeat inline font-size:11px (kept) */
        border-radius: 6px;
        font-family: var(--sans);
        font-weight: 600;
        letter-spacing: 0.08em;
    }
    .am-dashboard.company-dashboard #tsWorkerStatusBanner {
        font-size: 12px !important;         /* defeat inline font-size:0.72rem */
        line-height: 1.5 !important;
        padding: 10px 12px !important;
    }
    .am-dashboard.company-dashboard #tsWorkerStatusPill {
        font-size: 9.5px !important;        /* defeat inline 0.65rem */
        padding: 4px 10px !important;
        letter-spacing: 0.14em !important;
    }
    .am-dashboard.company-dashboard #tsShowCancelledWrap {
        font-size: 11.5px !important;       /* defeat inline 11px */
        min-height: 36px;
        align-items: center;
    }
    .am-dashboard.company-dashboard #tsShowCancelledWrap input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }

    /* Empty states inside any of the boards */
    .am-dashboard.company-dashboard .br-empty,
    .am-dashboard.company-dashboard .br-empty-state {
        padding: 32px 16px;
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
    }
    .am-dashboard.company-dashboard .br-empty i {
        font-size: 28px;
        margin-bottom: 8px;
    }

    /* ── Dispatch modal (full-screen sheet on mobile per HANDOFF §4.11) ── */
    .br-modal-backdrop.open {
        align-items: flex-end;              /* slide up from bottom */
        padding: 0;
    }
    .br-modal-backdrop .br-modal {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;       /* bottom sheet shape per §4.11 */
        display: flex;
        flex-direction: column;
        background: var(--paper);
        border: 1px solid var(--rule);
        backdrop-filter: none;              /* defeat desktop blur on cream paper */
    }
    .br-modal-backdrop .br-modal-header {
        padding: 14px 16px;
        background: var(--paper);
        border-bottom: 1px solid var(--rule);
        flex-shrink: 0;
    }
    .br-modal-backdrop .br-modal-header h3 {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
        color: var(--ink);
    }
    .br-modal-backdrop .br-modal-close {
        min-width: 40px;
        min-height: 40px;
        font-size: 22px;
        color: var(--ink-3);
    }
    .br-modal-backdrop .br-modal-body {
        padding: 16px;
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }
    .br-modal-backdrop .br-field {
        margin-bottom: 14px;
    }
    .br-modal-backdrop .br-field label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 6px;
    }
    .br-modal-backdrop .br-field input,
    .br-modal-backdrop .br-field select,
    .br-modal-backdrop .br-field textarea {
        min-height: 44px;
        padding: 10px 12px;
        font-family: var(--sans);
        font-size: 15px;                    /* §4.10 input scale — also prevents iOS zoom-on-focus */
        border-radius: 6px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        color: var(--ink);
    }
    .br-modal-backdrop .br-field textarea {
        min-height: 80px;
    }
    .br-modal-backdrop .br-modal-footer {
        padding: 12px 16px;
        background: var(--paper);
        border-top: 1px solid var(--rule);
        flex-shrink: 0;
        flex-wrap: wrap;
        gap: 8px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    .br-modal-backdrop .br-modal-btn {
        min-height: 44px;
        padding: 12px 18px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        border-radius: 6px;
        flex: 1;
        min-width: 0;
    }
    .br-modal-backdrop .br-modal-btn.primary {
        background: var(--accent);
        color: var(--ink);
        border: 1px solid var(--accent);
    }
    .br-modal-backdrop .br-modal-btn.secondary {
        background: var(--paper-2);
        color: var(--ink-body);
        border: 1px solid var(--rule);
    }

    /* Plan slide-out panel — full screen on mobile */
    .br-plan-backdrop .br-plan-panel {
        width: 100% !important;             /* defeat inline width set by JS */
        max-width: 100%;
        padding: 16px;
        background: var(--paper);
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    /* Reset Optimus overlay (inline-styled by JS, line ~2097) — keep usable */
    #resetOptimusOverlay > div {
        max-width: 92vw !important;
        width: 100% !important;
        margin: 0 14px;
    }


    /* /company/cache-stats — admin cache TTL viewer: cards flatten, 3-col table → labeled card-stack */
    /* Anchor: .am-dashboard:has(.am-contact .bi-lightning-charge) — unique to the cache stats page,
       prevents bleed onto other .am-dashboard admin pages. */
    /* Header — Clear Cache action ≥44px tap target, stacks under title on phones */
    .am-dashboard:has(.am-contact .bi-lightning-charge) .am-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .am-header .am-name {
        font-family: var(--serif);
        font-size: 28px;
        font-weight: 500;
        color: var(--ink);
        margin: 0 0 4px 0;
        line-height: 1.1;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .am-header .am-contact {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-3);
        line-height: 1.4;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .am-header .am-contact .bi {
        color: var(--accent);
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .am-header .am-actions {
        display: flex;
        width: 100%;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .am-header .am-actions .btn {
        flex: 1;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        border-radius: 6px;
        padding: 10px 16px;
    }

    /* Prefix cards — flatten to editorial style */
    .am-dashboard:has(.am-contact .bi-lightning-charge) > .card {
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        box-shadow: none;
        margin-top: 12px;
        overflow: hidden;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) > .card .card-header {
        background: var(--paper);
        border-bottom: 1px solid var(--rule);
        padding: 12px 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) > .card .card-header h5 {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
        color: var(--ink);
        margin: 0;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        word-break: break-all;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) > .card .card-header h5 .bi-folder {
        color: var(--ink-3);
        flex-shrink: 0;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) > .card .card-header .badge {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        border-radius: 999px;
        padding: 4px 10px;
    }

    /* 3-col table → labeled card-stack, no horizontal scroll */
    .am-dashboard:has(.am-contact .bi-lightning-charge) .card-body.p-0 {
        padding: 0;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) {
        display: block;
        width: 100%;
        margin: 0;
        background: transparent;
        color: var(--ink-body);
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) thead {
        display: none;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody {
        display: block;
        width: 100%;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody tr {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--rule);
        background: transparent;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody tr:last-child {
        border-bottom: 0;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody td {
        display: block;
        width: auto !important; /* override Bootstrap's table cell width:100% to prevent overflow */
        box-sizing: border-box;
        padding: 0;
        border: 0;
        background: transparent;
        font-family: var(--sans);
        font-size: 14px;
        color: var(--ink-body);
        line-height: 1.4;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody td::before {
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody td:nth-child(1)::before {
        content: 'Cache Key';
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody td:nth-child(2)::before {
        content: 'Age';
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody td:nth-child(3)::before {
        content: 'Status';
    }
    /* Cache key — keep monospace, allow wrap on long keys */
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody td:nth-child(1) {
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        font-size: 12.5px;
        color: var(--ink);
        word-break: break-all;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) .table:not(.opt-table) tbody td .badge {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        border-radius: 999px;
        padding: 4px 10px;
    }

    /* Empty state card */
    .am-dashboard:has(.am-contact .bi-lightning-charge) > .card:not(:has(.card-header)) .card-body {
        padding: 32px 20px;
        text-align: center;
        color: var(--ink-3);
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) > .card:not(:has(.card-header)) .card-body .bi-database {
        font-size: 32px;
        color: var(--ink-faint);
        display: block;
        margin-bottom: 12px;
    }
    .am-dashboard:has(.am-contact .bi-lightning-charge) > .card:not(:has(.card-header)) .card-body p {
        font-family: var(--serif);
        font-size: 18px;
        color: var(--ink);
        margin: 0;
        line-height: 1.4;
    }

    /* /company/content-engine — Content Engine dashboard: panels stack, 6-col page table → labeled card-stack, side-panel → bottom-sheet */
    /* =============================================================================
       Per HANDOFF.md §3.3 (screen padding), §4.5 (cards flat), §4.6 (stats),
       §4.11 (sheets), §4.12 (table → cards), §11 (no horizontal page scroll;
       tab-strip/chip rows MAY horizontal-scroll).

       The page is heavily JS-rendered with inline style="..." attributes on
       almost every cell — !important is needed only to defeat those inline
       styles, and each occurrence is annotated.
       ============================================================================= */

    /* ── Page wrapper: tighten edge padding, kill any horizontal overflow ─── */
    .ce-page {
        padding: 12px 14px 32px;
        overflow-x: hidden;
    }

    /* ── Header: stack title above action button cluster ─────────────────── */
    /* The content-engine.css @media at 218 already does flex-direction:column
       on .ce-header — this refines typography + button wrapping. */
    .ce-page .ce-header {
        gap: 10px;
        margin-bottom: 12px;
    }
    .ce-page .ce-header h1 {
        font-family: var(--serif);
        font-size: 28px;
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: -0.01em;
        color: var(--ink);
        gap: 8px;
    }
    /* The header right-side action cluster is an inline-styled <div>. The flex
       wrapper has inline style="display: flex; align-items: center; gap: 0.5rem;"
       — let it wrap so Sync / Check Plugins / Pause All / Refresh stack
       cleanly. !important defeats the inline display:flex. */
    .ce-page .ce-header > div[style*="display: flex"] {
        flex-wrap: wrap;
        gap: 8px !important;             /* defeat inline gap: 0.5rem */
        width: 100%;
        justify-content: flex-start;
    }
    .ce-page .ce-header > div[style*="display: flex"] > .btn {
        min-height: 44px;
        padding: 8px 12px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .ce-page .ce-header #ceLastRefresh {
        font-size: 11px;
        flex-basis: 100%;
        margin-right: 0 !important;       /* defeat inline margin-right: 0.25rem */
    }

    /* ── Connection-lost banner: tighten spacing for small screens ────────── */
    .ce-page #ceConnectionBanner {
        padding: 10px 12px !important;    /* defeat inline 10px 16px */
        font-size: 12px !important;       /* defeat inline 0.8rem in narrow viewport */
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .ce-page #ceConnectionBanner > div {
        flex: 1 1 100%;
    }

    /* ── Stats row: 3-up first row, 2-up second row (Clients / Active /
         Blocked  /  Published / Total Pages). content-engine.css already
         sets 3-col at ≤767.98 (line 215) — we tighten tile padding,
         editorial typography per HANDOFF.md §4.6. ───────────────────── */
    .ce-page .ce-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 16px;
    }
    .ce-page .ce-stat {
        padding: 12px 10px;
        border-radius: 10px;
        background: var(--paper-2, var(--surface-1));
        border: 1px solid var(--rule, var(--border-subtle));
    }
    .ce-page .ce-stat-value {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.1;
        margin-bottom: 4px;
        color: var(--ink);
    }
    .ce-page .ce-stat-label {
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }

    /* ── Two-panel layout: stack vertically. content-engine.css already
         sets flex-direction:column; we override max-height on sidebar so
         clients are visible, and full-width on both panels. ──────────── */
    .ce-page .ce-layout {
        gap: 12px;
        height: auto;
        min-height: 0;
        margin-bottom: 16px;
    }
    .ce-page .ce-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 280px;                /* enough to scroll ~5 clients */
        border-radius: 10px;
    }
    .ce-page .ce-sidebar-header {
        padding: 8px;
    }
    .ce-page .ce-sidebar-search {
        min-height: 44px;
        font-size: 14px;
        padding: 10px 10px 10px 32px;
        background-position: 10px center;
    }
    .ce-page .ce-sidebar-item {
        padding: 10px;
        min-height: 44px;
    }
    .ce-page .ce-sidebar-item-name {
        font-size: 14px;
    }
    .ce-page .ce-sidebar-item-phase {
        font-size: 11px;
    }
    .ce-page .ce-main-panel {
        padding: 12px;
        border-radius: 10px;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* ── Detail panel header (rendered HTML at line ~183) ───────────────── */
    /* Inline-styled <div> with display:flex justify-content:space-between
       — break it to two rows so business name + ON/OFF pill sit above the
       Live / Pause / X cluster, all with 44px tap targets. */
    .ce-page .ce-main-panel > div[style*="justify-content:space-between"]:first-child {
        flex-wrap: wrap;
        gap: 8px !important;              /* defeat inline 0.5rem */
        padding-bottom: 10px !important;
    }
    .ce-page .ce-main-panel > div[style*="justify-content:space-between"]:first-child > div {
        flex-wrap: wrap;
    }
    .ce-page .ce-main-panel > div[style*="justify-content:space-between"]:first-child .btn {
        min-height: 36px;
        font-size: 11px !important;       /* defeat inline 0.6rem */
        padding: 6px 10px !important;     /* defeat inline 2px 8px */
    }

    /* ── Compact stats row inside detail panel — let it wrap on phones ── */
    .ce-page .ce-main-panel > div[style*="font-size:0.7rem;color:var(--text-400)"] {
        flex-wrap: wrap;
        gap: 6px 12px !important;         /* defeat inline 0.75rem */
        font-size: 12px !important;       /* defeat inline 0.7rem */
    }
    .ce-page .ce-main-panel > div[style*="font-size:0.7rem;color:var(--text-400)"] > span[style*="margin-left:auto"] {
        margin-left: 0 !important;        /* defeat inline margin-left:auto */
        font-size: 11px !important;
        flex-basis: 100%;
    }

    /* ── Actions row + dropdown: keep on one scrollable strip ─────────── */
    /* This row is the Write 5 / Add / Map / More cluster plus the pace
       select / extend select / + button on the right. It can horizontal-
       scroll (tab-strip pattern, HANDOFF.md §11). */
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        padding-bottom: 4px;
        gap: 6px !important;              /* defeat inline 0.3rem */
        -webkit-overflow-scrolling: touch;
    }
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] .btn,
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] a.btn {
        min-height: 36px;
        font-size: 11px !important;       /* defeat inline 0.58rem */
        padding: 6px 10px !important;     /* defeat inline 2px 8px */
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] select {
        min-height: 36px;
        font-size: 12px !important;       /* defeat inline 0.58rem */
        padding: 4px 8px !important;
    }
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] > span[style*="margin-left:auto"] {
        margin-left: 0 !important;
        flex-shrink: 0;
    }

    /* ── Search input row ──────────────────────────────────────────────── */
    .ce-page .ce-main-panel input[id^="cePageSearch_"] {
        min-height: 40px !important;
        font-size: 14px !important;       /* defeat inline 0.65rem */
        padding: 8px 12px !important;     /* defeat inline 3px 8px */
    }

    /* ── Status + Type filter rows: horizontal-scroll tab-strip ────────── */
    /* Both filter rows have inline display:flex with a 'Status:'/'Type:'
       label on the left, then a chip group inside #ceVBFilters /
       #ceVBTypeFilters. We let the whole row scroll horizontally as a
       chip strip, label sticky on the left. */
    .ce-page .ce-main-panel #ceVBFilters,
    .ce-page .ce-main-panel #ceVBTypeFilters {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px !important;              /* defeat inline 0.2rem */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .ce-page .ce-main-panel #ceVBFilters::-webkit-scrollbar,
    .ce-page .ce-main-panel #ceVBTypeFilters::-webkit-scrollbar {
        display: none;
    }
    .ce-page .ce-main-panel #ceVBFilters > button,
    .ce-page .ce-main-panel #ceVBTypeFilters > button {
        min-height: 32px;
        padding: 6px 12px !important;     /* defeat inline 2px 8px */
        font-size: 11px !important;       /* defeat inline 0.58rem */
        white-space: nowrap;
        flex-shrink: 0;
    }
    /* The 'Status:' / 'Type:' eyebrow label — bump to legible size */
    .ce-page .ce-main-panel > div[style*="margin-bottom:0.3rem"] > span[style*="text-transform:uppercase"],
    .ce-page .ce-main-panel > div[style*="margin-bottom:0.4rem"] > span[style*="text-transform:uppercase"] {
        font-size: 10px !important;       /* defeat inline 0.55rem */
        letter-spacing: 0.14em;
        flex-shrink: 0;
    }

    /* ── Bulk action bar (#ceVBBulkBar): horizontal-scroll strip ─────── */
    /* Inline style sets margin-left:auto on desktop; on mobile we want it
       to break to its own full-width row beneath the type filter row. */
    .ce-page #ceVBBulkBar {
        margin-left: 0 !important;        /* defeat inline margin-left:auto */
        flex-basis: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        gap: 6px !important;              /* defeat inline 0.3rem */
        padding: 4px 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .ce-page #ceVBBulkBar::-webkit-scrollbar { display: none; }
    .ce-page #ceVBBulkBar .btn {
        min-height: 36px;
        font-size: 11px !important;       /* defeat inline 0.56rem */
        padding: 6px 10px !important;     /* defeat inline 2px 8px */
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ce-page #ceVBSelCount {
        font-size: 11px !important;       /* defeat inline 0.6rem */
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* =============================================================================
       PAGES TABLE → CARD STACK
       -----------------------------------------------------------------------------
       Source: lines 280-320 of content_engine.html — JS builds a <table> with
       a 6-column body: [checkbox+eye, Title, Type, Keyword, Status, Date].
       Every <td> has an inline style="..." attribute, so every layout/width
       override needs !important (each one is commented).

       Mobile transform:
         - Hide <thead>
         - Each <tr.ce-vb-row> becomes a bordered card
         - Cells stack as a 1fr grid; each cell shows an injected label via
           ::before. Labels by position: 1=Select, 2=Title, 3=Type,
           4=Keyword, 5=Status, 6=Date.
       ============================================================================= */

    /* Defeat the scrollable wrapper height (calc(100vh - 480px) inline) */
    .ce-page .ce-main-panel > div[style*="max-height:calc(100vh - 480px)"] {
        max-height: none !important;     /* defeat inline 100vh-based cap */
        overflow-y: visible !important;
        overflow-x: hidden !important;
    }

    /* The <table> itself */
    .ce-page .ce-main-panel table {
        display: block;
        width: 100%;
        font-size: 13px !important;       /* defeat inline 0.72rem */
        border-collapse: separate;
        border-spacing: 0;
    }
    .ce-page .ce-main-panel table thead {
        display: none;                    /* labels are injected per cell instead */
    }
    .ce-page .ce-main-panel table tbody {
        display: block;
        width: 100%;
    }

    /* Each row becomes a stand-alone card */
    .ce-page .ce-main-panel tr.ce-vb-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 12px;
        margin-bottom: 10px;
        border: 1px solid var(--rule, var(--border-subtle)) !important; /* defeat inline border-bottom 1px */
        border-radius: 10px;
        background: var(--paper-2, var(--surface-1)) !important;       /* defeat inline alt-row background */
    }

    /* Every <td>: full-width row with a label prefix */
    .ce-page .ce-main-panel tr.ce-vb-row > td {
        display: grid !important;                            /* defeat inline (none) */
        grid-template-columns: 96px 1fr;
        align-items: center;
        gap: 10px;
        width: auto !important;                              /* defeat inline width:28px on cell 1 */
        max-width: none !important;                          /* defeat inline max-width:280px / 130px */
        min-width: 0;
        padding: 6px 0 !important;                           /* defeat inline 0.3rem... */
        margin: 0;
        text-align: left !important;                         /* defeat inline text-align:center/right */
        white-space: normal !important;                      /* defeat inline white-space:nowrap */
        overflow: visible !important;                        /* defeat inline overflow:hidden */
        text-overflow: clip !important;
        font-size: 13px !important;                          /* defeat inline 0.58rem cells */
        color: var(--ink) !important;                        /* defeat inline color:var(--text-400) */
        border: 0 !important;
        box-sizing: border-box;
    }

    /* Labels driven by data-label attr in _renderVB (mobile-followup PR).
       Replaces the brittle :nth-child(N)::before approach so labels survive
       any future column reordering in the JS row builder. */
    .ce-page .ce-main-panel tr.ce-vb-row > td::before {
        content: attr(data-label);
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        align-self: center;
    }

    /* Title cell: prominent, ellipsis OFF (wrap allowed) */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(2) {
        font-family: var(--serif);
        font-size: 16px !important;                          /* defeat inline 0.58rem */
        font-weight: 500;
        line-height: 1.3;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(2) a {
        color: var(--ink) !important;                        /* defeat inline color:var(--text-900) */
        text-decoration: none;
    }

    /* Select cell: checkbox + eye button side-by-side with proper tap target */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(1) > div {
        gap: 12px !important;                                /* defeat inline gap:4px */
    }
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(1) input[type="checkbox"] {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(1) button {
        min-width: 36px;
        min-height: 36px;
        padding: 6px 10px !important;                        /* defeat inline 2px 5px */
        font-size: 14px !important;                          /* defeat inline 0.65rem */
    }

    /* Type cell — capitalize */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(3) {
        font-family: var(--sans);
        text-transform: capitalize;
    }

    /* Keyword cell */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(4) {
        font-family: var(--sans);
        color: var(--ink-body) !important;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* Status badge — full size, left-aligned with its label */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(5) > span {
        font-size: 10px !important;                          /* defeat inline 0.5rem */
        padding: 4px 10px !important;                        /* defeat inline 2px 7px */
        font-family: var(--sans);
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        justify-self: start;
    }

    /* Date cell */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(6) {
        font-family: var(--sans);
        font-size: 12px !important;                          /* defeat inline 0.58rem */
    }

    /* Hide separator <hr> nature from rows on mobile (we already restyled borders) */
    .ce-page .ce-main-panel table tbody tr.ce-vb-row[style*="background:var(--surface-1)"] {
        background: var(--paper-2, var(--surface-1)) !important;
    }

    /* ── Recently Published list — pad + readable typography ───────────── */
    .ce-page .ce-section-title {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-top: 8px;
        margin-bottom: 10px;
    }
    .ce-page .ce-published {
        padding: 12px;
        border-radius: 10px;
    }
    .ce-page .ce-pub-item {
        gap: 10px;
        padding: 10px 0;
    }
    .ce-page .ce-pub-title {
        font-size: 14px;
    }
    .ce-page .ce-pub-meta {
        font-size: 11px;
    }

    /* =============================================================================
       PAGE DETAIL SIDE-PANEL (#cePagePanel)  →  full-width bottom-sheet
       -----------------------------------------------------------------------------
       Source: line 697 — JS appends a <div id="cePagePanel"> with inline
       style="position:fixed; top:52px; right:0; width:380px;
              height:calc(100vh - 52px); ...".
       On a 375px viewport that 380px right-rail is unusable. We pin it to
       the bottom of the screen as a 92dvh-tall sheet, full-width.
       ============================================================================= */
    #cePagePanel {
        position: fixed !important;       /* (matches inline — kept for clarity) */
        top: auto !important;             /* defeat inline top:52px */
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 100% !important;           /* defeat inline width:380px */
        max-width: 100% !important;
        height: 92dvh !important;         /* defeat inline height:calc(100vh - 52px) */
        max-height: 92dvh !important;
        border-left: 0 !important;        /* defeat inline border-left:2px */
        border-top: 1px solid var(--rule, var(--border-subtle)) !important;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 30px rgba(20, 18, 15, 0.18) !important;
        padding: 16px !important;          /* defeat inline 1.2rem */
        z-index: 1080 !important;          /* above bottom nav if present */
    }
    /* The detail panel's margin-right:390px (set inline by the JS) makes the
       table column collapse — undo so the table still renders correctly. */
    #ceDetailPanel[style*="margin-right:390px"] {
        margin-right: 0 !important;       /* defeat inline margin-right:390px */
    }
    #cePagePanel #cePagePanelBody {
        font-size: 14px !important;       /* defeat inline 0.75rem */
        padding-bottom: 32px;             /* HANDOFF.md §3.3 safe-area gutter */
    }
    /* The panel close button needs to be a real 44px tap target */
    #cePagePanel > div:first-child button {
        min-width: 44px;
        min-height: 44px;
        padding: 8px 12px !important;     /* defeat inline 4px 8px */
        font-size: 14px !important;
    }
    /* Page-detail title (the <h3>) */
    #cePagePanel #cePagePanelBody h3 {
        font-family: var(--serif);
        font-size: 20px !important;       /* defeat inline 0.95rem */
        font-weight: 500;
        line-height: 1.25;
    }
    /* Details key/value grid — stack to 1-col so long values aren't cramped */
    #cePagePanel #cePagePanelBody > div[style*="grid-template-columns:110px 1fr"] {
        grid-template-columns: 1fr !important;  /* defeat inline 110px 1fr */
        gap: 8px 0 !important;
    }
    #cePagePanel #cePagePanelBody > div[style*="grid-template-columns:110px 1fr"] > div:nth-child(odd) {
        font-family: var(--sans);
        font-size: 10px !important;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3) !important;
        padding: 0 !important;
    }
    #cePagePanel #cePagePanelBody > div[style*="grid-template-columns:110px 1fr"] > div:nth-child(even) {
        font-size: 14px !important;
        color: var(--ink) !important;
        padding: 0 0 6px 0 !important;
    }
    /* Page-detail action buttons (Publish Now / Re-QA / Unpublish / Remove) */
    #cePagePanel #cePagePanelBody > div[style*="display:flex;gap:6px;flex-wrap:wrap"] {
        gap: 8px !important;              /* defeat inline 6px */
    }
    #cePagePanel #cePagePanelBody > div[style*="display:flex;gap:6px;flex-wrap:wrap"] .btn {
        min-height: 40px;
        font-size: 12px !important;       /* defeat inline 0.65rem */
        padding: 8px 12px !important;     /* defeat inline 3px 10px */
    }

    /* /company/content-engine — Content Engine dashboard: panels stack, 6-col page table → labeled card-stack, side-panel → bottom-sheet */
    /* =============================================================================
       Per HANDOFF.md §3.3 (screen padding), §4.5 (cards flat), §4.6 (stats),
       §4.11 (sheets), §4.12 (table → cards), §11 (no horizontal page scroll;
       tab-strip/chip rows MAY horizontal-scroll).

       The page is heavily JS-rendered with inline style="..." attributes on
       almost every cell — !important is needed only to defeat those inline
       styles, and each occurrence is annotated.
       ============================================================================= */

    /* ── Page wrapper: tighten edge padding, kill any horizontal overflow ─── */
    .ce-page {
        padding: 12px 14px 32px;
        overflow-x: hidden;
    }

    /* ── Header: stack title above action button cluster ─────────────────── */
    /* The content-engine.css @media at 218 already does flex-direction:column
       on .ce-header — this refines typography + button wrapping. */
    .ce-page .ce-header {
        gap: 10px;
        margin-bottom: 12px;
    }
    .ce-page .ce-header h1 {
        font-family: var(--serif);
        font-size: 28px;
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: -0.01em;
        color: var(--ink);
        gap: 8px;
    }
    /* The header right-side action cluster is an inline-styled <div>. The flex
       wrapper has inline style="display: flex; align-items: center; gap: 0.5rem;"
       — let it wrap so Sync / Check Plugins / Pause All / Refresh stack
       cleanly. !important defeats the inline display:flex. */
    .ce-page .ce-header > div[style*="display: flex"] {
        flex-wrap: wrap;
        gap: 8px !important;             /* defeat inline gap: 0.5rem */
        width: 100%;
        justify-content: flex-start;
    }
    .ce-page .ce-header > div[style*="display: flex"] > .btn {
        min-height: 44px;
        padding: 8px 12px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .ce-page .ce-header #ceLastRefresh {
        font-size: 11px;
        flex-basis: 100%;
        margin-right: 0 !important;       /* defeat inline margin-right: 0.25rem */
    }

    /* ── Connection-lost banner: tighten spacing for small screens ────────── */
    .ce-page #ceConnectionBanner {
        padding: 10px 12px !important;    /* defeat inline 10px 16px */
        font-size: 12px !important;       /* defeat inline 0.8rem in narrow viewport */
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .ce-page #ceConnectionBanner > div {
        flex: 1 1 100%;
    }

    /* ── Stats row: 3-up first row, 2-up second row (Clients / Active /
         Blocked  /  Published / Total Pages). content-engine.css already
         sets 3-col at ≤767.98 (line 215) — we tighten tile padding,
         editorial typography per HANDOFF.md §4.6. ───────────────────── */
    .ce-page .ce-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 16px;
    }
    .ce-page .ce-stat {
        padding: 12px 10px;
        border-radius: 10px;
        background: var(--paper-2, var(--surface-1));
        border: 1px solid var(--rule, var(--border-subtle));
    }
    .ce-page .ce-stat-value {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.1;
        margin-bottom: 4px;
        color: var(--ink);
    }
    .ce-page .ce-stat-label {
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
    }

    /* ── Two-panel layout: stack vertically. content-engine.css already
         sets flex-direction:column; we override max-height on sidebar so
         clients are visible, and full-width on both panels. ──────────── */
    .ce-page .ce-layout {
        gap: 12px;
        height: auto;
        min-height: 0;
        margin-bottom: 16px;
    }
    .ce-page .ce-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 280px;                /* enough to scroll ~5 clients */
        border-radius: 10px;
    }
    .ce-page .ce-sidebar-header {
        padding: 8px;
    }
    .ce-page .ce-sidebar-search {
        min-height: 44px;
        font-size: 14px;
        padding: 10px 10px 10px 32px;
        background-position: 10px center;
    }
    .ce-page .ce-sidebar-item {
        padding: 10px;
        min-height: 44px;
    }
    .ce-page .ce-sidebar-item-name {
        font-size: 14px;
    }
    .ce-page .ce-sidebar-item-phase {
        font-size: 11px;
    }
    .ce-page .ce-main-panel {
        padding: 12px;
        border-radius: 10px;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* ── Detail panel header (rendered HTML at line ~183) ───────────────── */
    /* Inline-styled <div> with display:flex justify-content:space-between
       — break it to two rows so business name + ON/OFF pill sit above the
       Live / Pause / X cluster, all with 44px tap targets. */
    .ce-page .ce-main-panel > div[style*="justify-content:space-between"]:first-child {
        flex-wrap: wrap;
        gap: 8px !important;              /* defeat inline 0.5rem */
        padding-bottom: 10px !important;
    }
    .ce-page .ce-main-panel > div[style*="justify-content:space-between"]:first-child > div {
        flex-wrap: wrap;
    }
    .ce-page .ce-main-panel > div[style*="justify-content:space-between"]:first-child .btn {
        min-height: 36px;
        font-size: 11px !important;       /* defeat inline 0.6rem */
        padding: 6px 10px !important;     /* defeat inline 2px 8px */
    }

    /* ── Compact stats row inside detail panel — let it wrap on phones ── */
    .ce-page .ce-main-panel > div[style*="font-size:0.7rem;color:var(--text-400)"] {
        flex-wrap: wrap;
        gap: 6px 12px !important;         /* defeat inline 0.75rem */
        font-size: 12px !important;       /* defeat inline 0.7rem */
    }
    .ce-page .ce-main-panel > div[style*="font-size:0.7rem;color:var(--text-400)"] > span[style*="margin-left:auto"] {
        margin-left: 0 !important;        /* defeat inline margin-left:auto */
        font-size: 11px !important;
        flex-basis: 100%;
    }

    /* ── Actions row + dropdown: keep on one scrollable strip ─────────── */
    /* This row is the Write 5 / Add / Map / More cluster plus the pace
       select / extend select / + button on the right. It can horizontal-
       scroll (tab-strip pattern, HANDOFF.md §11). */
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        padding-bottom: 4px;
        gap: 6px !important;              /* defeat inline 0.3rem */
        -webkit-overflow-scrolling: touch;
    }
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] .btn,
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] a.btn {
        min-height: 36px;
        font-size: 11px !important;       /* defeat inline 0.58rem */
        padding: 6px 10px !important;     /* defeat inline 2px 8px */
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] select {
        min-height: 36px;
        font-size: 12px !important;       /* defeat inline 0.58rem */
        padding: 4px 8px !important;
    }
    .ce-page .ce-main-panel > div[style*="font-size:0.62rem"] > span[style*="margin-left:auto"] {
        margin-left: 0 !important;
        flex-shrink: 0;
    }

    /* ── Search input row ──────────────────────────────────────────────── */
    .ce-page .ce-main-panel input[id^="cePageSearch_"] {
        min-height: 40px !important;
        font-size: 14px !important;       /* defeat inline 0.65rem */
        padding: 8px 12px !important;     /* defeat inline 3px 8px */
    }

    /* ── Status + Type filter rows: horizontal-scroll tab-strip ────────── */
    /* Both filter rows have inline display:flex with a 'Status:'/'Type:'
       label on the left, then a chip group inside #ceVBFilters /
       #ceVBTypeFilters. We let the whole row scroll horizontally as a
       chip strip, label sticky on the left. */
    .ce-page .ce-main-panel #ceVBFilters,
    .ce-page .ce-main-panel #ceVBTypeFilters {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px !important;              /* defeat inline 0.2rem */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .ce-page .ce-main-panel #ceVBFilters::-webkit-scrollbar,
    .ce-page .ce-main-panel #ceVBTypeFilters::-webkit-scrollbar {
        display: none;
    }
    .ce-page .ce-main-panel #ceVBFilters > button,
    .ce-page .ce-main-panel #ceVBTypeFilters > button {
        min-height: 32px;
        padding: 6px 12px !important;     /* defeat inline 2px 8px */
        font-size: 11px !important;       /* defeat inline 0.58rem */
        white-space: nowrap;
        flex-shrink: 0;
    }
    /* The 'Status:' / 'Type:' eyebrow label — bump to legible size */
    .ce-page .ce-main-panel > div[style*="margin-bottom:0.3rem"] > span[style*="text-transform:uppercase"],
    .ce-page .ce-main-panel > div[style*="margin-bottom:0.4rem"] > span[style*="text-transform:uppercase"] {
        font-size: 10px !important;       /* defeat inline 0.55rem */
        letter-spacing: 0.14em;
        flex-shrink: 0;
    }

    /* ── Bulk action bar (#ceVBBulkBar): horizontal-scroll strip ─────── */
    /* Inline style sets margin-left:auto on desktop; on mobile we want it
       to break to its own full-width row beneath the type filter row. */
    .ce-page #ceVBBulkBar {
        margin-left: 0 !important;        /* defeat inline margin-left:auto */
        flex-basis: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        gap: 6px !important;              /* defeat inline 0.3rem */
        padding: 4px 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .ce-page #ceVBBulkBar::-webkit-scrollbar { display: none; }
    .ce-page #ceVBBulkBar .btn {
        min-height: 36px;
        font-size: 11px !important;       /* defeat inline 0.56rem */
        padding: 6px 10px !important;     /* defeat inline 2px 8px */
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ce-page #ceVBSelCount {
        font-size: 11px !important;       /* defeat inline 0.6rem */
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* =============================================================================
       PAGES TABLE → CARD STACK
       -----------------------------------------------------------------------------
       Source: lines 280-320 of content_engine.html — JS builds a <table> with
       a 6-column body: [checkbox+eye, Title, Type, Keyword, Status, Date].
       Every <td> has an inline style="..." attribute, so every layout/width
       override needs !important (each one is commented).

       Mobile transform:
         - Hide <thead>
         - Each <tr.ce-vb-row> becomes a bordered card
         - Cells stack as a 1fr grid; each cell shows an injected label via
           ::before. Labels by position: 1=Select, 2=Title, 3=Type,
           4=Keyword, 5=Status, 6=Date.
       ============================================================================= */

    /* Defeat the scrollable wrapper height (calc(100vh - 480px) inline) */
    .ce-page .ce-main-panel > div[style*="max-height:calc(100vh - 480px)"] {
        max-height: none !important;     /* defeat inline 100vh-based cap */
        overflow-y: visible !important;
        overflow-x: hidden !important;
    }

    /* The <table> itself */
    .ce-page .ce-main-panel table {
        display: block;
        width: 100%;
        font-size: 13px !important;       /* defeat inline 0.72rem */
        border-collapse: separate;
        border-spacing: 0;
    }
    .ce-page .ce-main-panel table thead {
        display: none;                    /* labels are injected per cell instead */
    }
    .ce-page .ce-main-panel table tbody {
        display: block;
        width: 100%;
    }

    /* Each row becomes a stand-alone card */
    .ce-page .ce-main-panel tr.ce-vb-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 12px;
        margin-bottom: 10px;
        border: 1px solid var(--rule, var(--border-subtle)) !important; /* defeat inline border-bottom 1px */
        border-radius: 10px;
        background: var(--paper-2, var(--surface-1)) !important;       /* defeat inline alt-row background */
    }

    /* Every <td>: full-width row with a label prefix */
    .ce-page .ce-main-panel tr.ce-vb-row > td {
        display: grid !important;                            /* defeat inline (none) */
        grid-template-columns: 96px 1fr;
        align-items: center;
        gap: 10px;
        width: auto !important;                              /* defeat inline width:28px on cell 1 */
        max-width: none !important;                          /* defeat inline max-width:280px / 130px */
        min-width: 0;
        padding: 6px 0 !important;                           /* defeat inline 0.3rem... */
        margin: 0;
        text-align: left !important;                         /* defeat inline text-align:center/right */
        white-space: normal !important;                      /* defeat inline white-space:nowrap */
        overflow: visible !important;                        /* defeat inline overflow:hidden */
        text-overflow: clip !important;
        font-size: 13px !important;                          /* defeat inline 0.58rem cells */
        color: var(--ink) !important;                        /* defeat inline color:var(--text-400) */
        border: 0 !important;
        box-sizing: border-box;
    }

    /* Labels driven by data-label attr in _renderVB (mobile-followup PR).
       Replaces the brittle :nth-child(N)::before approach so labels survive
       any future column reordering in the JS row builder. */
    .ce-page .ce-main-panel tr.ce-vb-row > td::before {
        content: attr(data-label);
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        align-self: center;
    }

    /* Title cell: prominent, ellipsis OFF (wrap allowed) */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(2) {
        font-family: var(--serif);
        font-size: 16px !important;                          /* defeat inline 0.58rem */
        font-weight: 500;
        line-height: 1.3;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(2) a {
        color: var(--ink) !important;                        /* defeat inline color:var(--text-900) */
        text-decoration: none;
    }

    /* Select cell: checkbox + eye button side-by-side with proper tap target */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(1) > div {
        gap: 12px !important;                                /* defeat inline gap:4px */
    }
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(1) input[type="checkbox"] {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(1) button {
        min-width: 36px;
        min-height: 36px;
        padding: 6px 10px !important;                        /* defeat inline 2px 5px */
        font-size: 14px !important;                          /* defeat inline 0.65rem */
    }

    /* Type cell — capitalize */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(3) {
        font-family: var(--sans);
        text-transform: capitalize;
    }

    /* Keyword cell */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(4) {
        font-family: var(--sans);
        color: var(--ink-body) !important;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* Status badge — full size, left-aligned with its label */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(5) > span {
        font-size: 10px !important;                          /* defeat inline 0.5rem */
        padding: 4px 10px !important;                        /* defeat inline 2px 7px */
        font-family: var(--sans);
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        justify-self: start;
    }

    /* Date cell */
    .ce-page .ce-main-panel tr.ce-vb-row > td:nth-child(6) {
        font-family: var(--sans);
        font-size: 12px !important;                          /* defeat inline 0.58rem */
    }

    /* Hide separator <hr> nature from rows on mobile (we already restyled borders) */
    .ce-page .ce-main-panel table tbody tr.ce-vb-row[style*="background:var(--surface-1)"] {
        background: var(--paper-2, var(--surface-1)) !important;
    }

    /* ── Recently Published list — pad + readable typography ───────────── */
    .ce-page .ce-section-title {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-top: 8px;
        margin-bottom: 10px;
    }
    .ce-page .ce-published {
        padding: 12px;
        border-radius: 10px;
    }
    .ce-page .ce-pub-item {
        gap: 10px;
        padding: 10px 0;
    }
    .ce-page .ce-pub-title {
        font-size: 14px;
    }
    .ce-page .ce-pub-meta {
        font-size: 11px;
    }

    /* =============================================================================
       PAGE DETAIL SIDE-PANEL (#cePagePanel)  →  full-width bottom-sheet
       -----------------------------------------------------------------------------
       Source: line 697 — JS appends a <div id="cePagePanel"> with inline
       style="position:fixed; top:52px; right:0; width:380px;
              height:calc(100vh - 52px); ...".
       On a 375px viewport that 380px right-rail is unusable. We pin it to
       the bottom of the screen as a 92dvh-tall sheet, full-width.
       ============================================================================= */
    #cePagePanel {
        position: fixed !important;       /* (matches inline — kept for clarity) */
        top: auto !important;             /* defeat inline top:52px */
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 100% !important;           /* defeat inline width:380px */
        max-width: 100% !important;
        height: 92dvh !important;         /* defeat inline height:calc(100vh - 52px) */
        max-height: 92dvh !important;
        border-left: 0 !important;        /* defeat inline border-left:2px */
        border-top: 1px solid var(--rule, var(--border-subtle)) !important;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 30px rgba(20, 18, 15, 0.18) !important;
        padding: 16px !important;          /* defeat inline 1.2rem */
        z-index: 1080 !important;          /* above bottom nav if present */
    }
    /* The detail panel's margin-right:390px (set inline by the JS) makes the
       table column collapse — undo so the table still renders correctly. */
    #ceDetailPanel[style*="margin-right:390px"] {
        margin-right: 0 !important;       /* defeat inline margin-right:390px */
    }
    #cePagePanel #cePagePanelBody {
        font-size: 14px !important;       /* defeat inline 0.75rem */
        padding-bottom: 32px;             /* HANDOFF.md §3.3 safe-area gutter */
    }
    /* The panel close button needs to be a real 44px tap target */
    #cePagePanel > div:first-child button {
        min-width: 44px;
        min-height: 44px;
        padding: 8px 12px !important;     /* defeat inline 4px 8px */
        font-size: 14px !important;
    }
    /* Page-detail title (the <h3>) */
    #cePagePanel #cePagePanelBody h3 {
        font-family: var(--serif);
        font-size: 20px !important;       /* defeat inline 0.95rem */
        font-weight: 500;
        line-height: 1.25;
    }
    /* Details key/value grid — stack to 1-col so long values aren't cramped */
    #cePagePanel #cePagePanelBody > div[style*="grid-template-columns:110px 1fr"] {
        grid-template-columns: 1fr !important;  /* defeat inline 110px 1fr */
        gap: 8px 0 !important;
    }
    #cePagePanel #cePagePanelBody > div[style*="grid-template-columns:110px 1fr"] > div:nth-child(odd) {
        font-family: var(--sans);
        font-size: 10px !important;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3) !important;
        padding: 0 !important;
    }
    #cePagePanel #cePagePanelBody > div[style*="grid-template-columns:110px 1fr"] > div:nth-child(even) {
        font-size: 14px !important;
        color: var(--ink) !important;
        padding: 0 0 6px 0 !important;
    }
    /* Page-detail action buttons (Publish Now / Re-QA / Unpublish / Remove) */
    #cePagePanel #cePagePanelBody > div[style*="display:flex;gap:6px;flex-wrap:wrap"] {
        gap: 8px !important;              /* defeat inline 6px */
    }
    #cePagePanel #cePagePanelBody > div[style*="display:flex;gap:6px;flex-wrap:wrap"] .btn {
        min-height: 40px;
        font-size: 12px !important;       /* defeat inline 0.65rem */
        padding: 8px 12px !important;     /* defeat inline 3px 10px */
    }


    /* =========================================================================
       /company/content-engine-v2a — design variant: list rows wrap, sidebar
       capped scroll, actions dropdown reflows
       -------------------------------------------------------------------------
       Page-private (all selectors scoped to .ce-a / .ce-a-*). The template
       already has an inline @media (max-width:768px) that stacks the sidebar
       above main and switches to height:auto; this section refines spacing,
       wraps the .ce-a-row 4-column flex (title + badge + status + date) so
       title gets its own line, hides the floating "Version A" experiment
       marker, and constrains the actions dropdown so it cannot overflow the
       viewport right edge.
       ========================================================================= */

    /* Hide the floating "Version A — Clean List" experiment marker on mobile
       — it's a design-experiment label, not user-facing copy, and at top:68px
       right:16px it overlaps the main column header. */
    .ce-a-label {
        display: none;
    }

    /* Container — keep the inline @media's column flow but neutralise the
       fixed viewport-height calc which can pin scroll inside .ce-a-main and
       confuse iOS Safari address-bar collapse. */
    .ce-a {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 60px);
        font-size: 14px;
    }

    /* Sidebar — cap height so it never eats more than ~40% of the viewport,
       allow internal scroll, and tighten item padding to a 44px tap target. */
    .ce-a-side {
        width: 100%;
        min-width: 0;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-200);
        overflow-y: auto;
        padding: 8px 0;
    }
    .ce-a-side-item {
        padding: 10px 16px;
        min-height: 44px;
        gap: 12px;
    }
    .ce-a-side-name {
        font-size: 14px;
    }
    .ce-a-side-count {
        font-size: 12px;
    }

    /* Main column — tighten outer padding (the inline rule sets 16px; keep
       that but allow more breathing room on the y-axis). */
    .ce-a-main {
        padding: 16px 14px 24px;
    }

    /* Header row (h2 + stats + actions) — already flex-wraps via inline style,
       just ensure type sizes don't feel cramped. */
    .ce-a-h2 {
        font-size: 18px;
        line-height: 1.25;
    }
    .ce-a-stats {
        font-size: 13px;
        margin: 6px 0 14px;
    }

    /* Filter pills — bump tap target to ≥36px and give breathing room. */
    .ce-a-filters {
        gap: 8px;
        margin-bottom: 14px;
    }
    .ce-a-filter {
        padding: 8px 14px;
        min-height: 36px;
        font-size: 13px;
        line-height: 1;
        display: inline-flex;
        align-items: center;
    }

    /* Page rows — the desktop 4-column nowrap layout (title flex:1, badge,
       status, date) cannot fit on a 375-414px viewport. Flip to a 2-row
       grid: row 1 is the title (no truncation), row 2 is the metadata strip
       (badge + status + date) wrapping as needed. */
    .ce-a-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 12px 0;
        font-size: 14px;
    }
    .ce-a-row-title {
        flex: 0 0 auto;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        font-size: 14px;
        line-height: 1.35;
        font-weight: 500;
        word-break: break-word;
    }
    /* Wrap badge / status / date as a metadata strip below the title. */
    .ce-a-row .ce-a-badge,
    .ce-a-row .ce-a-status,
    .ce-a-row .ce-a-date {
        font-size: 11px;
    }
    .ce-a-row .ce-a-date {
        white-space: nowrap;
        margin-left: auto; /* push date to the right end of the meta strip */
    }
    /* Synthetic meta wrapper isn't in the markup, so use a flex container on
       the row itself via display:contents-style trick: a second-row pseudo
       isn't possible without DOM changes, so instead let the three meta
       spans flow horizontally with gap. Use display:flex on row + wrap. */
    .ce-a-row {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    .ce-a-row-title {
        flex: 0 0 100%; /* title gets its own full line */
        margin-bottom: 2px;
    }
    .ce-a-row .ce-a-badge,
    .ce-a-row .ce-a-status {
        margin-right: 4px;
    }
    /* Progress bar spacing */
    .ce-a-progress {
        margin-bottom: 14px;
    }

    /* Actions button — ensure ≥36px tap target. */
    .ce-a-actions-btn {
        padding: 8px 14px;
        min-height: 36px;
        font-size: 14px;
        line-height: 1;
    }

    /* Actions dropdown — desktop anchors right:0 which on a narrow viewport
       with the button near the right edge would still fit, but the absolute
       position can clip past the screen edge when scrolled. Constrain width
       and let it anchor to the right with a viewport-safe max-width. */
    .ce-a-dropdown {
        right: 0;
        left: auto;
        min-width: 200px;
        max-width: 240px;
        margin-top: 6px;
    }
    .ce-a-dropdown a {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Pace footer */
    .ce-a-pace {
        font-size: 12px;
        margin-top: 20px;
    }

    /* Empty / loading state */
    .ce-a-empty {
        font-size: 14px;
        padding: 32px 16px;
        min-height: 120px;
    }

    /* =============================================================================
       /company/content-engine-v2b — design variant: card titles wrap, sticky panel disabled, filter polish
       -----------------------------------------------------------------------------
       Top-up rules for the JS-rendered ".ce-b" page card variant. All selectors
       are scoped to the page-private ".ce-b*" prefix. The template already has
       inline media queries at 900px (stack columns + KPIs to 2-col) and 500px
       (KPIs to 1-col); these rules only adjust phone-specific concerns:
         - Allow long card titles to wrap (kill nowrap+ellipsis)
         - Wrap card meta row so keyword/badge/status never push width
         - Disable position:sticky on the right panel once columns are stacked
         - Filter pills + select get proper tap target heights, 15px to avoid
           iOS auto-zoom on the <select>
         - Generate / Audit / Map action buttons grow to 40px and share width
       ============================================================================= */

    /* Card title: wrap on phones so long page_title strings stay readable */
    .ce-b .ce-b-card-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
        line-height: 1.3;
        margin-bottom: 6px;
    }

    /* Card meta row: wrap chips so they don't push card width */
    .ce-b .ce-b-card-meta {
        flex-wrap: wrap;
        row-gap: 6px;
    }

    /* Right panel: stacked under .ce-b-left at <=900px, so sticky top:80px
       would lock it mid-scroll. Neutralize to static positioning on phones. */
    .ce-b .ce-b-panel {
        position: static;
        top: auto;
    }

    /* Filter bar polish: pills are tappable, select is 40px / 15px to dodge
       iOS zoom-on-focus behaviour for <select> with font-size < 16px. */
    .ce-b .ce-b-filterbar {
        gap: 8px;
    }
    .ce-b .ce-b-filterbar .ce-b-select {
        min-height: 40px;
        font-size: 15px;
        padding: 8px 12px;
        border-radius: 8px;
        flex: 1 1 100%;
    }
    .ce-b .ce-b-filterbar .ce-b-pill {
        min-height: 32px;
        padding: 6px 14px;
        display: inline-flex;
        align-items: center;
        font-size: 12px;
    }

    /* Panel action buttons: 40px tap targets, evenly split the row */
    .ce-b .ce-b-panel-actions {
        gap: 8px;
    }
    .ce-b .ce-b-panel-actions .ce-b-panel-btn {
        flex: 1;
        min-height: 40px;
        padding: 8px 12px;
        font-size: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* =============================================================================
       MOBILE: /company/content-engine-v3c  (PR: mobile/content-engine-v3c)
       -----------------------------------------------------------------------------
       Per HANDOFF.md §4.12 + global "no horizontal scroll / no nested scroll on
       mobile" rule. Kanban variant uses .ce-c-* (page-private). Template already
       column-stacks at <=900px; here we (a) defeat the 100vh trap on iOS Safari,
       (b) let card titles wrap, (c) drop the column-internal vertical scroll so
       the page scrolls naturally, (d) full-width the client picker, (e) tighten
       gutters, (f) hide the design-experiment label.
       ============================================================================= */
    /* /company/content-engine-v3c — Kanban variant: nested col scroll off, card titles wrap, select full-width */

    /* Container — drop the iOS-hostile fixed viewport height */
    .ce-c {
        height: auto;
        min-height: 0;
    }

    /* Hide the "Version C — Kanban" design-experiment label on mobile */
    .ce-c-label {
        display: none;
    }

    /* Top bar — tighter side padding */
    .ce-c-top {
        padding: 12px 16px;
        gap: 10px;
    }

    /* Client picker — full-width, 40px tall, 15px font to avoid iOS zoom */
    .ce-c-select {
        min-width: 0;
        width: 100%;
        height: 40px;
        padding: 8px 12px;
        font-size: 15px;
    }

    /* Kanban board — sides 12px so columns get more usable width */
    .ce-c-board {
        padding: 0 12px 16px;
        gap: 12px;
        min-height: 0;
    }

    /* Columns — kill nested vertical scroll, let page scroll naturally */
    .ce-c-col {
        flex: none;
        overflow: visible;
        min-height: 0;
    }
    .ce-c-col-body {
        flex: none;
        overflow: visible;
        min-height: 0;
    }

    /* Card titles — wrap instead of single-line ellipsis */
    .ce-c-card-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
    }

    /* Card meta — let badge + keyword reflow */
    .ce-c-card-meta {
        flex-wrap: wrap;
    }

    /* Bottom bar — tighter side padding */
    .ce-c-bottom {
        padding: 10px 16px;
    }

    /* =============================================================================
       /company/integrations-debug — admin integration health: KPIs 2-up, 2-col
       layout already stacks, log entries flow, provider stats table → labeled
       card-stack
       -----------------------------------------------------------------------------
       Scoped to .am-dashboard:has(.am-name + .am-contact .bi-activity) — the
       "System health and recent API calls" line with a bi-activity icon is unique
       to this page among .am-dashboard pages.  Per HANDOFF.md §3 (spacing) /
       §4.4 (stat tiles) / §4.6 (card-stack tables) and PR #15/#17/#19 lesson:
       grid <tr> + width:auto !important on <td> to defeat Bootstrap's
       width:1% collapse on table cells.
       ============================================================================= */

    /* ---------- page wrapper: no horizontal page scroll ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) {
        overflow-x: hidden;
    }

    /* ---------- header: title + actions stack vertically ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-header .am-name {
        font-family: var(--serif);
        font-size: 28px;
        font-weight: 500;
        line-height: 1.2;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-header .am-contact {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-3);
    }

    /* ---------- header actions: Test All / Manage buttons, ≥44px ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-actions .btn {
        flex: 1 1 auto;
        min-height: 44px;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.16em;
        padding: 10px 14px;
        border-radius: 6px;
    }

    /* ---------- KPI tiles: 4 col-md-3 → 2-up grid ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) > .row.g-3.mb-4 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 0 0 20px 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) > .row.g-3.mb-4 > [class*="col-"] {
        width: 100%;
        max-width: 100%;
        flex: none;
        padding: 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .stat-card {
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        padding: 12px 10px;
        text-align: center;
        min-height: 76px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .stat-card .stat-label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        color: var(--ink-3);
        margin: 0;
        line-height: 1.3;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .stat-card .stat-value {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.1;
        color: var(--ink);
    }

    /* ---------- 2-col Bootstrap row: lg breakpoint already stacks; ensure no overflow ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) > .row > [class*="col-lg-"] {
        max-width: 100%;
        min-width: 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) > .row > [class*="col-lg-"] > .card {
        min-width: 0;
        max-width: 100%;
    }

    /* ---------- card headers ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card > .card-header {
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        color: var(--ink);
        padding: 12px 14px;
        gap: 8px;
        flex-wrap: wrap;
    }

    /* ---------- Integration Accounts (left col) ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .provider-section {
        border-bottom: 1px solid var(--rule);
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .provider-header {
        padding: 10px 14px;
        background: var(--paper-2);
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
        color: var(--ink);
        gap: 8px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .provider-header .badge {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.06em;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .accounts-list {
        padding: 4px 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item {
        padding: 8px 14px;
    }
    /* account-info name + status pill: wrap when name is long */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-info {
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-name {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 500;
        color: var(--ink);
        word-break: break-word;
        min-width: 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-status {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-meta {
        flex-wrap: wrap;
        gap: 6px 12px;
        margin-top: 4px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-meta .small,
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-meta span {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
        word-break: break-all;        /* long emails / IDs shouldn't push width */
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .master-assignment,
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .client-overrides {
        padding: 8px 14px;
        font-family: var(--sans);
        font-size: 12px;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 8px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .no-accounts {
        padding: 8px 14px;
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
    }

    /* ---------- Recent API Calls (right col) ---------- */
    /* provider filter <select>: full-width, 40px tall, 15px font (no iOS zoom) */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card-header select.form-select.form-select-sm {
        width: 100% !important;        /* defeat inline style="width:auto" */
        min-height: 40px;
        font-family: var(--sans);
        font-size: 15px;                /* iOS won't zoom inputs ≥16px; 15px is safe with -webkit-text-size-adjust */
        padding: 8px 32px 8px 12px;
        border-radius: 6px;
        border: 1px solid var(--rule);
        background-color: var(--paper);
        color: var(--ink);
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card-header > div:has(> select.form-select) {
        width: 100%;
    }

    /* neutralize log scroll-trap → natural page scroll */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entries {
        max-height: none;
        overflow: visible;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry {
        padding: 10px 14px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-header {
        display: flex;
        flex-wrap: wrap;       /* long operations shouldn't push width */
        align-items: center;
        gap: 6px 8px;
        min-width: 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-time {
        font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
        font-size: 11.5px;
        color: var(--ink-3);
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-provider {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-operation {
        font-family: var(--sans);
        font-size: 12.5px;
        font-weight: 500;
        color: var(--ink);
        min-width: 0;
        word-break: break-word;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-status {
        font-size: 14px;
        line-height: 1;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-latency {
        font-family: var(--sans);
        font-size: 11.5px;
        color: var(--ink-3);
        margin-left: auto;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-client,
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-account,
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-error {
        font-family: var(--sans);
        font-size: 12px;
        margin-top: 4px;
        padding-left: 0;       /* drop desktop indent; mobile is already narrow */
        word-break: break-word;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-preview {
        font-size: 11.5px;
        margin-top: 4px;
        padding-left: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* ---------- Test Results card ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) #testResultsArea .card-header {
        padding: 10px 14px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) #testResultsArea .card-header .btn-close {
        min-width: 36px;
        min-height: 36px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) #testResultsContent .result-item {
        flex-wrap: wrap;
        gap: 6px 8px;
        padding: 8px 0;
        font-family: var(--sans);
        font-size: 12.5px;
    }

    /* ---------- Provider Stats table → card-stack (4 cols) ---------- */
    /* Hide thead on mobile; each row becomes a card with positional labels. */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive {
        overflow-x: visible;    /* don't trap horizontal scroll inside the card */
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) {
        display: block;
        width: 100%;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > thead {
        display: none;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody {
        display: block;
        width: 100%;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 12px;
        padding: 12px 14px;
        margin-bottom: 8px;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper);
        width: 100%;
        box-sizing: border-box;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 0;
        border: none;
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink);
        text-align: left !important;   /* defeat .text-end utility on cells 2-4 */
        width: auto !important;        /* defeat Bootstrap td width:1% collapse */
        box-sizing: border-box;
        min-width: 0;
        word-break: break-word;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        color: var(--ink-3);
        content: attr(data-label);
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(1)::before {
        content: "Provider";
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(2)::before {
        content: "Calls";
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(3)::before {
        content: "Success Rate";
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(4)::before {
        content: "Avg Latency";
    }
    /* Provider badge inside cell 1 */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(1) .badge {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
        align-self: flex-start;
    }
    /* Card body padding: tighten so card-stack rows breathe */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card > .card-body {
        padding: 12px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card-body.p-0 {
        padding: 0;
    }


    /* =============================================================================
       /company/integrations-debug — admin integration health: KPIs 2-up, 2-col
       layout already stacks, log entries flow, provider stats table → labeled
       card-stack
       -----------------------------------------------------------------------------
       Scoped to .am-dashboard:has(.am-name + .am-contact .bi-activity) — the
       "System health and recent API calls" line with a bi-activity icon is unique
       to this page among .am-dashboard pages.  Per HANDOFF.md §3 (spacing) /
       §4.4 (stat tiles) / §4.6 (card-stack tables) and PR #15/#17/#19 lesson:
       grid <tr> + width:auto !important on <td> to defeat Bootstrap's
       width:1% collapse on table cells.
       ============================================================================= */

    /* ---------- page wrapper: no horizontal page scroll ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) {
        overflow-x: hidden;
    }

    /* ---------- header: title + actions stack vertically ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-header .am-name {
        font-family: var(--serif);
        font-size: 28px;
        font-weight: 500;
        line-height: 1.2;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-header .am-contact {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-3);
    }

    /* ---------- header actions: Test All / Manage buttons, ≥44px ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .am-actions .btn {
        flex: 1 1 auto;
        min-height: 44px;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.16em;
        padding: 10px 14px;
        border-radius: 6px;
    }

    /* ---------- KPI tiles: 4 col-md-3 → 2-up grid ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) > .row.g-3.mb-4 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 0 0 20px 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) > .row.g-3.mb-4 > [class*="col-"] {
        width: 100%;
        max-width: 100%;
        flex: none;
        padding: 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .stat-card {
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        padding: 12px 10px;
        text-align: center;
        min-height: 76px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .stat-card .stat-label {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        color: var(--ink-3);
        margin: 0;
        line-height: 1.3;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .stat-card .stat-value {
        font-family: var(--serif);
        font-size: 24px;
        font-weight: 500;
        line-height: 1.1;
        color: var(--ink);
    }

    /* ---------- 2-col Bootstrap row: lg breakpoint already stacks; ensure no overflow ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) > .row > [class*="col-lg-"] {
        max-width: 100%;
        min-width: 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) > .row > [class*="col-lg-"] > .card {
        min-width: 0;
        max-width: 100%;
    }

    /* ---------- card headers ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card > .card-header {
        font-family: var(--sans);
        font-size: 11.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        color: var(--ink);
        padding: 12px 14px;
        gap: 8px;
        flex-wrap: wrap;
    }

    /* ---------- Integration Accounts (left col) ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .provider-section {
        border-bottom: 1px solid var(--rule);
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .provider-header {
        padding: 10px 14px;
        background: var(--paper-2);
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
        color: var(--ink);
        gap: 8px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .provider-header .badge {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        letter-spacing: 0.06em;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .accounts-list {
        padding: 4px 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item {
        padding: 8px 14px;
    }
    /* account-info name + status pill: wrap when name is long */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-info {
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-name {
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 500;
        color: var(--ink);
        word-break: break-word;
        min-width: 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-status {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-meta {
        flex-wrap: wrap;
        gap: 6px 12px;
        margin-top: 4px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-meta .small,
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .account-item .account-meta span {
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
        word-break: break-all;        /* long emails / IDs shouldn't push width */
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .master-assignment,
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .client-overrides {
        padding: 8px 14px;
        font-family: var(--sans);
        font-size: 12px;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 8px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .no-accounts {
        padding: 8px 14px;
        font-family: var(--sans);
        font-size: 12px;
        color: var(--ink-3);
    }

    /* ---------- Recent API Calls (right col) ---------- */
    /* provider filter <select>: full-width, 40px tall, 15px font (no iOS zoom) */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card-header select.form-select.form-select-sm {
        width: 100% !important;        /* defeat inline style="width:auto" */
        min-height: 40px;
        font-family: var(--sans);
        font-size: 15px;                /* iOS won't zoom inputs ≥16px; 15px is safe with -webkit-text-size-adjust */
        padding: 8px 32px 8px 12px;
        border-radius: 6px;
        border: 1px solid var(--rule);
        background-color: var(--paper);
        color: var(--ink);
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card-header > div:has(> select.form-select) {
        width: 100%;
    }

    /* neutralize log scroll-trap → natural page scroll */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entries {
        max-height: none;
        overflow: visible;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry {
        padding: 10px 14px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-header {
        display: flex;
        flex-wrap: wrap;       /* long operations shouldn't push width */
        align-items: center;
        gap: 6px 8px;
        min-width: 0;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-time {
        font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
        font-size: 11.5px;
        color: var(--ink-3);
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-provider {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-operation {
        font-family: var(--sans);
        font-size: 12.5px;
        font-weight: 500;
        color: var(--ink);
        min-width: 0;
        word-break: break-word;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-status {
        font-size: 14px;
        line-height: 1;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-entry .log-latency {
        font-family: var(--sans);
        font-size: 11.5px;
        color: var(--ink-3);
        margin-left: auto;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-client,
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-account,
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-error {
        font-family: var(--sans);
        font-size: 12px;
        margin-top: 4px;
        padding-left: 0;       /* drop desktop indent; mobile is already narrow */
        word-break: break-word;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .log-preview {
        font-size: 11.5px;
        margin-top: 4px;
        padding-left: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* ---------- Test Results card ---------- */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) #testResultsArea .card-header {
        padding: 10px 14px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) #testResultsArea .card-header .btn-close {
        min-width: 36px;
        min-height: 36px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) #testResultsContent .result-item {
        flex-wrap: wrap;
        gap: 6px 8px;
        padding: 8px 0;
        font-family: var(--sans);
        font-size: 12.5px;
    }

    /* ---------- Provider Stats table → card-stack (4 cols) ---------- */
    /* Hide thead on mobile; each row becomes a card with positional labels. */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive {
        overflow-x: visible;    /* don't trap horizontal scroll inside the card */
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) {
        display: block;
        width: 100%;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > thead {
        display: none;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody {
        display: block;
        width: 100%;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 12px;
        padding: 12px 14px;
        margin-bottom: 8px;
        border: 1px solid var(--rule);
        border-radius: 10px;
        background: var(--paper);
        width: 100%;
        box-sizing: border-box;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 0;
        border: none;
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink);
        text-align: left !important;   /* defeat .text-end utility on cells 2-4 */
        width: auto !important;        /* defeat Bootstrap td width:1% collapse */
        box-sizing: border-box;
        min-width: 0;
        word-break: break-word;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td::before {
        font-family: var(--sans);
        font-size: 10.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        color: var(--ink-3);
        content: attr(data-label);
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(1)::before {
        content: "Provider";
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(2)::before {
        content: "Calls";
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(3)::before {
        content: "Success Rate";
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(4)::before {
        content: "Avg Latency";
    }
    /* Provider badge inside cell 1 */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .table-responsive > table.table:not(.opt-table) > tbody > tr > td:nth-child(1) .badge {
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        padding: 3px 8px;
        border-radius: 999px;
        align-self: flex-start;
    }
    /* Card body padding: tighten so card-stack rows breathe */
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card > .card-body {
        padding: 12px;
    }
    .am-dashboard:has(.am-name + .am-contact .bi-activity) .card-body.p-0 {
        padding: 0;
    }


    /* /company/lifecycle-detail — per-client lifecycle: header stack, deliverable grid, extend-trial modal → bottom-sheet */
    .ld-container {
        padding: 12px 14px 32px;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Back link — sane tap target */
    .ld-container .ld-back {
        font-size: 12px;
        min-height: 36px;
        align-items: center;
        margin-bottom: 12px;
    }
    /* Header: stack vertically, action cluster wraps full-width */
    .ld-container .ld-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }
    .ld-container .ld-client-name {
        font-size: 20px;
        line-height: 1.25;
    }
    /* The action cluster is an inline-styled <div> — defeat with !important */
    .ld-container .ld-header > div:last-child {
        display: flex !important; /* defeat inline style="display: flex; gap: 8px;" */
        flex-wrap: wrap !important; /* defeat inline single-row layout */
        gap: 8px !important; /* match scale */
        width: 100%;
    }
    .ld-container .ld-header > div:last-child .ld-btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 40px;
        padding: 10px 12px;
        font-size: 12px;
        justify-content: center;
    }

    /* Inline-styled "days since start" span next to stage badge */
    .ld-container .ld-header > div:first-child > span[style] {
        margin-left: 8px;
        font-size: 11px;
    }

    /* Timeline — 3 steps must fit 360px viewport */
    .ld-container .ld-timeline {
        gap: 0;
    }
    .ld-container .ld-timeline-step {
        padding: 10px 2px;
        min-width: 0;
    }
    .ld-container .ld-timeline-label {
        font-size: 11px;
        line-height: 1.2;
    }

    /* Quick links — wrap to multiple rows, each a real tap target */
    .ld-container .ld-quick-links {
        gap: 8px;
        margin-bottom: 16px;
    }
    .ld-container .ld-quick-link {
        min-height: 36px;
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Bot-readiness warning — flex row stays, but text must wrap cleanly.
       The block uses inline style="..." so overrides need !important. */
    .ld-container > div[style*="rgba(239, 68, 68"] {
        padding: 12px 14px !important; /* defeat inline padding: 14px 20px */
        align-items: flex-start !important; /* defeat inline align-items: center for wrapping text */
    }
    .ld-container > div[style*="rgba(239, 68, 68"] > i {
        flex-shrink: 0;
        margin-top: 2px;
    }
    .ld-container > div[style*="rgba(239, 68, 68"] > div {
        min-width: 0;
    }

    /* Run-all bar — stack, button full-width */
    .ld-container .ld-run-all-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }
    .ld-container .ld-run-all-bar .ld-btn.run {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    /* Stage section header — tighter padding, chevron stays right */
    .ld-container .ld-stage-header {
        padding: 12px 14px;
        gap: 10px;
    }
    .ld-container .ld-stage-title {
        font-size: 13px;
        min-width: 0;
        flex-wrap: wrap;
    }
    .ld-container .ld-stage-progress {
        gap: 8px;
        flex-shrink: 0;
    }
    .ld-container .ld-mini-progress {
        width: 56px;
    }

    /* Deliverable rows → 2-col grid with actions on second full-width row */
    .ld-container .ld-deliverable {
        display: grid;
        grid-template-columns: 24px 1fr;
        grid-template-areas:
            "status info"
            "status agent"
            "actions actions";
        gap: 8px;
        padding: 12px 14px;
        align-items: start;
    }
    .ld-container .ld-deliverable .ld-del-status {
        grid-area: status;
        margin-top: 2px;
    }
    .ld-container .ld-deliverable .ld-del-info {
        grid-area: info;
    }
    .ld-container .ld-deliverable .ld-del-agent {
        grid-area: agent;
        justify-self: start;
        font-size: 10px;
        padding: 2px 6px;
    }
    .ld-container .ld-del-title {
        font-size: 13px;
        line-height: 1.35;
    }
    .ld-container .ld-del-desc {
        font-size: 12px;
        line-height: 1.4;
    }

    /* Actions row — full-width, wrap, right-aligned, ≥36px buttons */
    .ld-container .ld-deliverable .ld-del-actions {
        grid-area: actions;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
        width: 100%;
    }
    .ld-container .ld-deliverable .ld-del-actions .ld-btn {
        min-height: 36px;
        padding: 8px 12px !important; /* defeat inline padding: 2px 8px / 3px 8px on small icon buttons */
        font-size: 12px !important;   /* defeat inline font-size: 10px on re-run / cancel buttons */
    }
    .ld-container .ld-deliverable .ld-del-actions > span {
        display: inline-flex;
        align-items: center;
        min-height: 36px;
        font-size: 12px !important; /* defeat inline font-size: 11px on Done / Running / Failed labels */
    }

    /* Extend Trial modal → bottom sheet.
       The overlay + panel are inline-styled, so all overrides use !important. */
    #extendTrialOverlay {
        align-items: flex-end !important; /* defeat inline align-items: center — dock at bottom */
        justify-content: stretch !important; /* defeat inline justify-content: center */
    }
    #extendTrialOverlay > div {
        width: 100% !important;       /* defeat inline width: 520px */
        max-width: 100% !important;   /* defeat inline max-width: 92vw */
        max-height: 92vh !important;  /* defeat inline max-height: 88vh */
        border-radius: 14px 14px 0 0 !important; /* defeat inline border-radius: 14px — bottom-sheet */
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom)) !important; /* defeat inline padding: 24px + safe-area */
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
    }

    /* Modal form inputs — 44px tap target, 15px font to prevent iOS zoom */
    #extendTrialOverlay input[type="date"],
    #extendTrialOverlay select,
    #extendTrialOverlay textarea {
        width: 100% !important;       /* defeat inline width: 100% (already correct, but reassert under !important) */
        min-height: 44px;
        padding: 11px 12px !important; /* defeat inline padding: 9px 12px */
        font-size: 15px !important;    /* defeat inline font-size: 0.85rem to prevent iOS zoom on focus */
        box-sizing: border-box !important;
    }
    #extendTrialOverlay textarea {
        min-height: 88px;
        font-size: 15px !important; /* defeat inline font-size: 0.82rem */
    }

    /* Modal action row — buttons share width, ≥44px tall */
    #extendTrialOverlay form > div:last-child {
        flex-wrap: wrap !important; /* defeat inline single-row layout if cramped */
        gap: 10px !important;
    }
    #extendTrialOverlay form > div:last-child .ld-btn {
        flex: 1 1 calc(50% - 5px);
        min-height: 44px;
        padding: 12px 14px;
        font-size: 13px;
        justify-content: center;
    }

    /* =============================================================================
       /company/post-call-form — Log Call form: rows single-column,
       15px font inputs (no iOS zoom), submit stacks full-width
       ============================================================================= */

    /* Container: tighter padding, full-width on mobile */
    .pcf-container {
        padding: 14px 14px 32px;
        max-width: 100%;
    }

    /* Back link: bump tap target to 36px */
    .pcf-container .pcf-back {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        padding: 6px 0;
    }

    /* Header: keep h1 at 20px (already mobile-OK) */
    .pcf-container .pcf-header {
        margin-bottom: 20px;
    }

    /* Cards: reduce padding from 24px to 16px */
    .pcf-container .pcf-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    /* Rows: collapse two-column grid to single column on mobile */
    .pcf-container .pcf-row {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }

    /* Conditional blocks keep dashed border; inner row also collapses */
    .pcf-container .pcf-conditional .pcf-row {
        grid-template-columns: 1fr;
    }

    /* Inputs/selects/textareas: 15px font (no iOS zoom), 44px tall */
    .pcf-container .pcf-input,
    .pcf-container .pcf-select,
    .pcf-container .pcf-textarea {
        font-size: 15px;
        padding: 12px 12px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Date/time inputs: explicit 44px min-height */
    .pcf-container input[type="datetime-local"].pcf-input,
    .pcf-container input[type="date"].pcf-input {
        min-height: 44px;
    }

    /* Textarea: preserve min-height + allow vertical resize */
    .pcf-container .pcf-textarea {
        min-height: 80px;
        padding: 10px 12px;
    }

    /* Checkbox labels: 44px tap target */
    .pcf-container .pcf-checkbox {
        padding: 10px 12px;
        min-height: 44px;
        font-size: 14px;
    }

    /* Submit row: stack column-reverse so primary action sits ABOVE Cancel */
    .pcf-container .pcf-submit-row {
        flex-direction: column-reverse;
        gap: 10px;
        margin-top: 20px;
    }

    /* Buttons: full-width, centered, 44px min-height */
    .pcf-container .pcf-submit-row .pcf-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        font-size: 14px;
        padding: 12px 20px;
    }

    /* =============================================================================
       /company/post-call-form — Log Call form: rows single-column,
       15px font inputs (no iOS zoom), submit stacks full-width
       ============================================================================= */

    /* Container: tighter padding, full-width on mobile */
    .pcf-container {
        padding: 14px 14px 32px;
        max-width: 100%;
    }

    /* Back link: bump tap target to 36px */
    .pcf-container .pcf-back {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        padding: 6px 0;
    }

    /* Header: keep h1 at 20px (already mobile-OK) */
    .pcf-container .pcf-header {
        margin-bottom: 20px;
    }

    /* Cards: reduce padding from 24px to 16px */
    .pcf-container .pcf-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    /* Rows: collapse two-column grid to single column on mobile */
    .pcf-container .pcf-row {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }

    /* Conditional blocks keep dashed border; inner row also collapses */
    .pcf-container .pcf-conditional .pcf-row {
        grid-template-columns: 1fr;
    }

    /* Inputs/selects/textareas: 15px font (no iOS zoom), 44px tall */
    .pcf-container .pcf-input,
    .pcf-container .pcf-select,
    .pcf-container .pcf-textarea {
        font-size: 15px;
        padding: 12px 12px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Date/time inputs: explicit 44px min-height */
    .pcf-container input[type="datetime-local"].pcf-input,
    .pcf-container input[type="date"].pcf-input {
        min-height: 44px;
    }

    /* Textarea: preserve min-height + allow vertical resize */
    .pcf-container .pcf-textarea {
        min-height: 80px;
        padding: 10px 12px;
    }

    /* Checkbox labels: 44px tap target */
    .pcf-container .pcf-checkbox {
        padding: 10px 12px;
        min-height: 44px;
        font-size: 14px;
    }

    /* Submit row: stack column-reverse so primary action sits ABOVE Cancel */
    .pcf-container .pcf-submit-row {
        flex-direction: column-reverse;
        gap: 10px;
        margin-top: 20px;
    }

    /* Buttons: full-width, centered, 44px min-height */
    .pcf-container .pcf-submit-row .pcf-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        font-size: 14px;
        padding: 12px 20px;
    }

    /* =============================================================================
       MOBILE: /company/website-requests — pipeline page: tabs scroll, status-table
       → card-stack, modals → bottom-sheet, kanban stacks
       -----------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing), §4.3 (tabs), §4.4 (chips/pills), §4.5 (cards),
       §4.6 (stats), §4.8 (pills), §4.9 (buttons), §4.10 (inputs), §4.11 (sheets),
       §4.12 (tables → card-stack).

       Page root: .am-dashboard.company-dashboard.website-requests-management.
       Every selector is anchored to .website-requests-management OR the page-private
       .wr-* / .wb-kb-* prefixes (kanban + modal selectors include the page anchor
       where needed to defeat the inline <style> in the template).

       What this section does:
        1. Header: reduce the page wrapper's 1.5rem inline padding to 14px, title
           sits flush, "New Build" button row stretches with 44px tap target.
        2. .nav-tabs (3 tabs) horizontal-scroll strip, 44px tap targets, scrollbar
           hidden. Defeats the inline `gap: 4px; padding: 4px` which on small
           widths cramps the labels.
        3. .wr-filter-pill row: nowrap + overflow-x scroll so 5 pills + search
           don't wrap-and-clip. Pills ≥36px tap target, search becomes full-width
           on a second row.
        4. .wr-stats-row: force 2-col across all mobile sizes (the inline 576px
           rule drops to 1-col which wastes vertical space on phones).
        5. .wr-breakdown-bar: tighten radius from 20px → 10px per §3.4.
        6. .status-table: card-stack flip. <thead> hidden, each <tr.wr-row> is a
           bordered card with display: grid; grid-template-columns: 1fr 1fr.
           Defeats the desktop CSS (`.status-table-wrapper { overflow-x: auto }`
           + inline 768px @media `overflow-x: auto` + inline `style="width:30px"`
           on <th>) by hiding the wrapper's scroll and forcing every <td> to
           width:auto. Each <td> gets its own ::before label.
        7. Stage cell: pill stacked above progress bar (already column on desktop,
           but min-width: 110px is removed so it can flex).
        8. .wr-action-icon: 36×36 tap targets (up from 28×28), actions row spans
           full width as a second line.
        9. Calendar tab: toolbar wraps, selects become full-width 44px inputs,
           calendar grid card padding tightened; FullCalendar grid allowed to
           overflow-x scroll inside the card (HANDOFF §11 tolerates this for
           grid widgets).
       10. Kanban tab: columns stack vertically — flex-direction: column, each
           column full width, max-height removed.
       11. Both modals (#newRequestModal, #editRequestModal): bottom-sheet style
           — modal-dialog pinned to bottom (align-items: flex-end), border-radius
           16px 16px 0 0, max-height: 92dvh. Inputs ≥44px tall, 15px font (no
           iOS zoom). Modal-body scrolls.
       ============================================================================= */

    /* 1. Page wrapper — reduce 1.5rem inline padding to 14px screen edge inset. */
    .website-requests-management {
        padding: 14px !important; /* defeat inline `padding: 1.5rem` in template <style> */
    }

    /* 1b. Header: title + action button stack. */
    .website-requests-management .am-header {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 10px;
    }
    .website-requests-management .am-header .am-name {
        font-family: var(--serif);
        font-size: 28px;
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: -0.01em;
        color: var(--ink);
        margin: 0;
    }

    /* 2. Nav-tabs (3 tabs): horizontal-scroll strip. Defeat inline gap:4px / 14px
       border-radius / 10px 16px padding which cramps the labels at 375px. */
    .website-requests-management .nav-tabs {
        display: flex !important; /* defeat inline `display: flex` already there but ensure */
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 4px !important;
        padding: 4px !important;
        margin: 0 0 12px 0 !important;
        border-radius: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .website-requests-management .nav-tabs::-webkit-scrollbar { display: none; }
    .website-requests-management .nav-tabs .nav-item {
        flex: 0 0 auto;
    }
    .website-requests-management .nav-tabs .nav-link {
        min-height: 40px;
        padding: 10px 14px !important;
        font-family: var(--sans);
        font-size: 11.5px !important;
        font-weight: 600;
        letter-spacing: 0.04em;
        white-space: nowrap;
    }

    /* 3. Filter pill row: horizontal-scroll, nowrap. Search input drops below. */
    .website-requests-management .wr-filter-bar {
        display: flex !important;
        flex-wrap: nowrap !important; /* defeat inline 576px `flex-wrap: wrap` */
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px !important;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
    }
    .website-requests-management .wr-filter-bar::-webkit-scrollbar { display: none; }
    .website-requests-management .wr-filter-pill {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 8px 14px !important;
        font-size: 11.5px !important;
        font-family: var(--sans);
        letter-spacing: 0.04em;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
    }
    /* Search input: full-width on its own row inside the filter bar. */
    .website-requests-management .wr-search-input {
        flex: 1 0 100%;
        width: 100% !important;
        min-height: 44px;
        font-size: 15px !important;
        padding: 10px 14px !important;
        border-radius: 6px !important;
        order: 99; /* push to end of scrollable row */
    }
    /* New Build button row: full-width tap target. */
    .website-requests-management #pipeline-content > .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }
    .website-requests-management #pipeline-content > .d-flex.justify-content-between > .btn-primary-opt {
        min-height: 44px;
        font-size: 11.5px !important;
        padding: 10px 16px !important;
        align-self: stretch;
    }

    /* 4. Stats row: 2-col across all mobile widths (defeats inline ≤576px 1-col). */
    .website-requests-management .wr-stats-row {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        margin-top: 4px;
    }
    .website-requests-management .wr-stat-card {
        padding: 12px !important;
        border-radius: 10px !important; /* §3.4 cards = --r-md */
    }
    .website-requests-management .wr-stat-value {
        font-family: var(--serif);
        font-size: 24px !important;
        font-weight: 500;
        line-height: 1.1;
    }
    .website-requests-management .wr-stat-label {
        font-family: var(--sans);
        font-size: 10.5px !important;
        font-weight: 500;
        letter-spacing: 0.14em;
    }
    .website-requests-management .wr-stat-compare {
        font-size: 10.5px !important;
        margin-top: 4px;
    }

    /* 5. Breakdown bar: §3.4 card radius. */
    .website-requests-management .wr-breakdown-bar {
        padding: 12px !important;
        border-radius: 10px !important;
        margin-top: 10px;
    }
    .website-requests-management .wr-breakdown-title {
        font-family: var(--sans);
        font-size: 10.5px !important;
        letter-spacing: 0.14em;
    }
    .website-requests-management .wr-stacked-legend {
        gap: 4px 12px !important;
        margin-top: 8px;
    }
    .website-requests-management .wr-legend-item {
        font-size: 11px !important;
    }

    /* 6. status-table → card-stack. ============================================
       Hide the table's horizontal-scroll wrapper, hide <thead>, flip each
       <tr.wr-row> into a 2-col grid card. Every <td> needs width:auto !important
       to defeat the inline `<th style="width: 30px;">` etc. */
    .website-requests-management .status-table-wrapper {
        overflow: visible !important; /* defeat inline 768px `overflow-x: auto` */
        border: none !important;
        border-radius: 0 !important;
    }
    .website-requests-management table.status-table {
        display: block !important;
        width: 100% !important;
        border-collapse: separate !important;
    }
    .website-requests-management table.status-table thead { display: none !important; }
    .website-requests-management table.status-table tbody {
        display: block !important;
        width: 100%;
    }
    .website-requests-management table.status-table tbody tr.wr-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        column-gap: 10px;
        row-gap: 8px;
        padding: 12px;
        margin-bottom: 10px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        position: relative;
    }
    .website-requests-management table.status-table tbody tr.wr-row:hover td {
        background: transparent !important; /* defeat desktop hover bg */
    }
    .website-requests-management table.status-table tbody tr.wr-row > td {
        display: block !important;
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-body);
        text-align: left !important;
        vertical-align: top;
    }
    /* Label rendered above each value. Spacing scale = 4px gap. */
    .website-requests-management table.status-table tbody tr.wr-row > td::before {
        content: attr(data-label);
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }

    /* Column-by-column labels. Two filter variants:
       (A) status_filter != 'launched' (default):
           1=Drag, 2=#, 3=Website, 4=Stage, 5=Designer, 6=SEO, 7=Developer, 8=Cost,
           9=Due, 10=Actions
       (B) status_filter == 'launched':
           1=#, 2=Website, 3=Designer, 4=SEO, 5=Developer, 6=Cost, 7=Launch, 8=Actions

       We label variant (A) via :nth-child; variant (B) doesn't render the drag
       handle (no `.wr-drag-handle` child), so we detect "no drag" via
       :first-child class fallback. To keep things simple we use the `wr-drag-handle`
       class as the variant gate: when present, indexes shift by +1.
       Variant (B) is launched-only and contains 8 cells (no drag, no stage).
    */

    /* --- Variant A: row HAS .wr-drag-handle as first child --- */
    /* mobile-followup PR: show the drag handle as a 44x44 touch target so
       AMs can reorder pipeline rows on phones via Sortable.js touch-drag.
       Paired with delay:200 + delayOnTouchOnly:true in the JS init so it
       won't fire from accidental scroll-touches. */
    .website-requests-management table.status-table tbody tr.wr-row > td.wr-drag-handle {
        display: flex !important;          /* defeat the prior display:none */
        align-items: center;
        justify-content: center;
        grid-column: 1 / -1;
        min-height: 44px;
        font-size: 18px;
        color: var(--ink-3);
        cursor: grab;
        touch-action: none;                /* prevent page-pan during drag */
        background: var(--paper);
        border-radius: 8px;
        margin-bottom: 6px;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td.wr-drag-handle::before {
        content: "";                        /* no label needed — icon is self-evident */
    }
    /* Spans whole row */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(2) {
        /* "#" priority number — small, top-left meta */
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(2)::before {
        content: "Priority";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(2) .wr-priority-num {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    /* Website name (cell 3) — span full width, larger serif name */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(3) {
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(3)::before {
        content: "Website";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(3) a,
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(3) .fw-medium {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
        color: var(--ink) !important;
        line-height: 1.2;
    }
    /* Stage cell (cell 4) — full width, pill above progress bar */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(4) {
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(4)::before {
        content: "Stage";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(4) .wr-stage-cell {
        min-width: 0 !important; /* defeat inline 110px min-width */
        flex-direction: column;
        gap: 4px;
    }
    /* Designer (5), SEO (6), Developer (7), Cost (8), Due (9) — 2-col */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(5)::before {
        content: "Designer";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(6)::before {
        content: "SEO Specialist";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(7)::before {
        content: "Developer";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(8)::before {
        content: "Cost";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(9)::before {
        content: "Due";
    }
    /* Actions (cell 10) — full-width second line */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(10) {
        grid-column: 1 / -1;
        text-align: left !important;
        margin-top: 4px;
        padding-top: 8px !important;
        border-top: 1px solid var(--rule) !important;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(10)::before {
        content: "Actions";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(10) > div {
        gap: 8px !important;
        display: inline-flex !important;
    }

    /* --- Variant B: launched filter — no drag handle, no stage. Re-label cells
         since :nth-child shifts. Detect via `:first-child:not(.wr-drag-handle)`. */
    .website-requests-management table.status-table tbody tr.wr-row > td:first-child:not(.wr-drag-handle) {
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:first-child:not(.wr-drag-handle)::before {
        content: "Priority";
    }
    /* In variant B, cell 2 (Website) overrides the variant-A "Priority" label set
       above for nth-child(2). Use a more-specific has-not-drag selector to win. */
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(2)::before {
        content: "Website";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(2) {
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(3)::before {
        content: "Designer";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(4)::before {
        content: "SEO Specialist";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(5)::before {
        content: "Developer";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(6)::before {
        content: "Cost";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(7)::before {
        content: "Launch Date";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(8) {
        grid-column: 1 / -1;
        text-align: left !important;
        margin-top: 4px;
        padding-top: 8px !important;
        border-top: 1px solid var(--rule) !important;
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(8)::before {
        content: "Actions";
    }

    /* 7. Action icons — 36×36 tap targets (HANDOFF §3.5 / iconbtn). */
    .website-requests-management .wr-action-icon {
        width: 36px !important;
        height: 36px !important;
        border-radius: 6px !important;
        font-size: 14px !important;
        background: var(--paper-3);
    }

    /* 8. Empty state polish. */
    .website-requests-management .wr-empty-state {
        padding: 32px 16px !important;
        border-radius: 10px !important;
        margin-top: 12px;
    }
    .website-requests-management .wr-empty-icon { font-size: 32px !important; }
    .website-requests-management .wr-empty-state h5 {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
    }
    .website-requests-management .wr-empty-state p {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-3);
    }
    .website-requests-management .wr-empty-state .btn-primary-opt {
        min-height: 44px;
        font-size: 11.5px !important;
    }

    /* 9. Calendar tab toolbar — wrap, full-width selects, 44px height. */
    .website-requests-management .cal-toolbar > .d-flex {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px !important;
    }
    .website-requests-management .cal-toolbar .d-flex.gap-2 {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .website-requests-management .cal-toolbar .form-select {
        flex: 1 1 100%;
        width: 100% !important;
        min-width: 0 !important; /* defeat inline `min-width: 180px;` */
        min-height: 44px;
        font-size: 15px !important;
        padding: 10px 14px !important;
        border-radius: 6px !important;
    }
    .website-requests-management .cal-view-toggle {
        align-self: flex-start;
    }
    .website-requests-management .cal-view-toggle .btn {
        min-height: 40px;
        padding: 8px 14px !important;
        font-size: 11.5px !important;
    }
    .website-requests-management .cal-legend {
        gap: 6px !important;
    }
    .website-requests-management .cal-legend-item {
        font-size: 11px !important;
        padding: 4px 10px !important;
        min-height: 28px;
    }

    /* Calendar card: tighter padding + allow internal grid scroll (HANDOFF §11). */
    .website-requests-management .cal-card-wrapper {
        padding: 4px !important;
        border-radius: 10px !important;
        min-height: 0 !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .website-requests-management .fc .fc-toolbar {
        padding: 12px 8px !important;
        gap: 8px !important;
        flex-wrap: wrap;
    }
    .website-requests-management .fc .fc-toolbar-title {
        font-size: 18px !important;
    }
    .website-requests-management .fc .fc-daygrid-day-frame {
        min-height: 60px !important;
    }
    .website-requests-management .fc .fc-button-primary {
        padding: 8px 12px !important;
        font-size: 11.5px !important;
        min-height: 40px;
    }

    /* Team view: stack header + allow grid to scroll. */
    .website-requests-management .team-view-card {
        border-radius: 10px !important;
    }
    .website-requests-management .team-toolbar {
        flex-wrap: wrap;
        gap: 8px !important;
        padding: 12px !important;
    }
    .website-requests-management .team-toolbar-title {
        font-size: 16px !important;
        flex: 1 0 100%;
        order: -1;
        text-align: left;
    }
    .website-requests-management .team-name-cell {
        width: 100px !important;
        min-width: 100px !important;
        font-size: 12px !important;
        padding: 8px !important;
    }

    /* 10. Kanban board: vertical stack. ========================================
       Defeats inline `display: flex; gap: 12px; overflow-x: auto` on .wb-kb-board
       so columns stack instead of side-scroll. Each column full width. */
    .website-requests-management .wb-kb-board {
        display: flex !important;
        flex-direction: column !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        gap: 10px !important;
        padding-bottom: 16px !important;
    }
    .website-requests-management .wb-kb-column {
        flex: 1 0 auto !important;
        min-width: 0 !important; /* defeat inline 200px / 180px */
        width: 100% !important;
        max-height: none !important;
        border-radius: 10px !important;
    }
    .website-requests-management .wb-kb-col-header {
        padding: 10px 12px !important;
        min-height: 44px;
    }
    .website-requests-management .wb-kb-col-title {
        font-family: var(--sans);
        font-size: 12px !important;
        font-weight: 600;
    }
    .website-requests-management .wb-kb-col-body {
        max-height: none !important;
        padding: 10px !important;
    }
    .website-requests-management .wb-kb-card {
        padding: 12px !important;
        border-radius: 10px !important;
        margin-bottom: 8px !important;
    }
    .website-requests-management .wb-kb-card-name {
        font-family: var(--serif);
        font-size: 16px !important;
        font-weight: 500;
        white-space: normal; /* allow wrap on mobile */
        overflow: visible;
        text-overflow: clip;
    }
    .website-requests-management .wb-kb-card-client {
        font-size: 12px !important;
        white-space: normal;
    }
    .website-requests-management .wb-kb-card-domain {
        font-size: 11px !important;
    }
    .website-requests-management .wb-kb-card-meta {
        font-size: 11px !important;
        gap: 8px 12px !important;
    }
    .website-requests-management .wb-kb-card-meta i {
        font-size: 11px !important;
    }
    .website-requests-management .wb-kb-priority-badge {
        font-size: 10px !important;
        padding: 2px 8px !important;
    }

    /* 11. Modals → bottom-sheet (newRequestModal + editRequestModal).
       Both are scoped via #newRequestModal / #editRequestModal so they don't
       affect any global Bootstrap modals. */
    #newRequestModal.modal,
    #editRequestModal.modal {
        padding: 0 !important;
    }
    #newRequestModal .modal-dialog,
    #editRequestModal .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        min-height: 100%;
        display: flex;
        align-items: flex-end;
        padding: 0;
    }
    #newRequestModal .modal-content,
    #editRequestModal .modal-content {
        width: 100%;
        max-height: 92dvh;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -8px 30px rgba(20, 18, 15, 0.18) !important;
        display: flex;
        flex-direction: column;
    }
    #newRequestModal .modal-header,
    #editRequestModal .modal-header {
        padding: 12px 16px !important;
        flex: 0 0 auto;
    }
    #newRequestModal .modal-header .modal-title,
    #editRequestModal .modal-header .modal-title {
        font-family: var(--serif) !important;
        font-size: 18px !important;
    }
    #newRequestModal .modal-header .btn-close,
    #editRequestModal .modal-header .btn-close {
        width: 44px;
        height: 44px;
        padding: 12px !important;
    }
    #newRequestModal .modal-body,
    #editRequestModal .modal-body {
        padding: 16px !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1 1 auto;
        padding-bottom: 32px !important;
    }
    #newRequestModal .modal-body .form-label,
    #editRequestModal .modal-body .form-label {
        font-size: 10.5px !important;
        letter-spacing: 0.14em !important;
        margin-bottom: 6px !important;
    }
    #newRequestModal .modal-body .form-control,
    #newRequestModal .modal-body .form-select,
    #editRequestModal .modal-body .form-control,
    #editRequestModal .modal-body .form-select {
        min-height: 44px;
        font-size: 15px !important; /* prevent iOS zoom */
        padding: 10px 14px !important;
        border-radius: 6px !important;
    }
    #newRequestModal .modal-body textarea.form-control,
    #editRequestModal .modal-body textarea.form-control {
        min-height: 88px;
    }
    /* Bootstrap col-md-* inside modal body — already stack below md, but ensure
       gutters are tight. */
    #newRequestModal .modal-body .row,
    #editRequestModal .modal-body .row {
        --bs-gutter-x: 0;
        --bs-gutter-y: 0;
        margin: 0;
    }
    #newRequestModal .modal-body .row > [class*="col-"],
    #editRequestModal .modal-body .row > [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
    }
    /* Request type toggle: full-width 44px buttons. */
    #newRequestModal .modal-body .btn-group {
        gap: 0;
    }
    #newRequestModal .modal-body .btn-group .btn-outline-dark {
        min-height: 44px;
        font-size: 11.5px !important;
    }
    /* Modal footer: sticky buttons, stretched. */
    #newRequestModal .modal-footer,
    #editRequestModal .modal-footer {
        padding: 12px 16px !important;
        gap: 8px;
        flex: 0 0 auto;
        border-top: 1px solid var(--rule) !important;
    }
    #newRequestModal .modal-footer .btn,
    #editRequestModal .modal-footer .btn {
        flex: 1 1 auto;
        min-height: 44px;
        font-size: 11.5px !important;
        padding: 10px 16px !important;
    }
    /* Edit-modal pipeline step indicator — keep visible but tighten. */
    #editRequestModal .wr-pipeline-indicator {
        overflow-x: auto;
        padding: 6px 0;
        scrollbar-width: none;
    }
    #editRequestModal .wr-pipeline-indicator::-webkit-scrollbar { display: none; }
    #editRequestModal .wr-pipeline-step {
        min-width: 32px;
    }
    /* Notes timeline inside edit modal. */
    #editRequestModal .wr-notes-timeline {
        max-height: 200px;
    }
    #editRequestModal .wr-add-note-form {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    #editRequestModal .wr-add-note-btn {
        min-height: 44px;
        font-size: 11.5px;
    }


    /* =============================================================================
       MOBILE: /company/website-requests — pipeline page: tabs scroll, status-table
       → card-stack, modals → bottom-sheet, kanban stacks
       -----------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing), §4.3 (tabs), §4.4 (chips/pills), §4.5 (cards),
       §4.6 (stats), §4.8 (pills), §4.9 (buttons), §4.10 (inputs), §4.11 (sheets),
       §4.12 (tables → card-stack).

       Page root: .am-dashboard.company-dashboard.website-requests-management.
       Every selector is anchored to .website-requests-management OR the page-private
       .wr-* / .wb-kb-* prefixes (kanban + modal selectors include the page anchor
       where needed to defeat the inline <style> in the template).

       What this section does:
        1. Header: reduce the page wrapper's 1.5rem inline padding to 14px, title
           sits flush, "New Build" button row stretches with 44px tap target.
        2. .nav-tabs (3 tabs) horizontal-scroll strip, 44px tap targets, scrollbar
           hidden. Defeats the inline `gap: 4px; padding: 4px` which on small
           widths cramps the labels.
        3. .wr-filter-pill row: nowrap + overflow-x scroll so 5 pills + search
           don't wrap-and-clip. Pills ≥36px tap target, search becomes full-width
           on a second row.
        4. .wr-stats-row: force 2-col across all mobile sizes (the inline 576px
           rule drops to 1-col which wastes vertical space on phones).
        5. .wr-breakdown-bar: tighten radius from 20px → 10px per §3.4.
        6. .status-table: card-stack flip. <thead> hidden, each <tr.wr-row> is a
           bordered card with display: grid; grid-template-columns: 1fr 1fr.
           Defeats the desktop CSS (`.status-table-wrapper { overflow-x: auto }`
           + inline 768px @media `overflow-x: auto` + inline `style="width:30px"`
           on <th>) by hiding the wrapper's scroll and forcing every <td> to
           width:auto. Each <td> gets its own ::before label.
        7. Stage cell: pill stacked above progress bar (already column on desktop,
           but min-width: 110px is removed so it can flex).
        8. .wr-action-icon: 36×36 tap targets (up from 28×28), actions row spans
           full width as a second line.
        9. Calendar tab: toolbar wraps, selects become full-width 44px inputs,
           calendar grid card padding tightened; FullCalendar grid allowed to
           overflow-x scroll inside the card (HANDOFF §11 tolerates this for
           grid widgets).
       10. Kanban tab: columns stack vertically — flex-direction: column, each
           column full width, max-height removed.
       11. Both modals (#newRequestModal, #editRequestModal): bottom-sheet style
           — modal-dialog pinned to bottom (align-items: flex-end), border-radius
           16px 16px 0 0, max-height: 92dvh. Inputs ≥44px tall, 15px font (no
           iOS zoom). Modal-body scrolls.
       ============================================================================= */

    /* 1. Page wrapper — reduce 1.5rem inline padding to 14px screen edge inset. */
    .website-requests-management {
        padding: 14px !important; /* defeat inline `padding: 1.5rem` in template <style> */
    }

    /* 1b. Header: title + action button stack. */
    .website-requests-management .am-header {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 10px;
    }
    .website-requests-management .am-header .am-name {
        font-family: var(--serif);
        font-size: 28px;
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: -0.01em;
        color: var(--ink);
        margin: 0;
    }

    /* 2. Nav-tabs (3 tabs): horizontal-scroll strip. Defeat inline gap:4px / 14px
       border-radius / 10px 16px padding which cramps the labels at 375px. */
    .website-requests-management .nav-tabs {
        display: flex !important; /* defeat inline `display: flex` already there but ensure */
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 4px !important;
        padding: 4px !important;
        margin: 0 0 12px 0 !important;
        border-radius: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .website-requests-management .nav-tabs::-webkit-scrollbar { display: none; }
    .website-requests-management .nav-tabs .nav-item {
        flex: 0 0 auto;
    }
    .website-requests-management .nav-tabs .nav-link {
        min-height: 40px;
        padding: 10px 14px !important;
        font-family: var(--sans);
        font-size: 11.5px !important;
        font-weight: 600;
        letter-spacing: 0.04em;
        white-space: nowrap;
    }

    /* 3. Filter pill row: horizontal-scroll, nowrap. Search input drops below. */
    .website-requests-management .wr-filter-bar {
        display: flex !important;
        flex-wrap: nowrap !important; /* defeat inline 576px `flex-wrap: wrap` */
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px !important;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
    }
    .website-requests-management .wr-filter-bar::-webkit-scrollbar { display: none; }
    .website-requests-management .wr-filter-pill {
        flex: 0 0 auto;
        min-height: 36px;
        padding: 8px 14px !important;
        font-size: 11.5px !important;
        font-family: var(--sans);
        letter-spacing: 0.04em;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
    }
    /* Search input: full-width on its own row inside the filter bar. */
    .website-requests-management .wr-search-input {
        flex: 1 0 100%;
        width: 100% !important;
        min-height: 44px;
        font-size: 15px !important;
        padding: 10px 14px !important;
        border-radius: 6px !important;
        order: 99; /* push to end of scrollable row */
    }
    /* New Build button row: full-width tap target. */
    .website-requests-management #pipeline-content > .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }
    .website-requests-management #pipeline-content > .d-flex.justify-content-between > .btn-primary-opt {
        min-height: 44px;
        font-size: 11.5px !important;
        padding: 10px 16px !important;
        align-self: stretch;
    }

    /* 4. Stats row: 2-col across all mobile widths (defeats inline ≤576px 1-col). */
    .website-requests-management .wr-stats-row {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        margin-top: 4px;
    }
    .website-requests-management .wr-stat-card {
        padding: 12px !important;
        border-radius: 10px !important; /* §3.4 cards = --r-md */
    }
    .website-requests-management .wr-stat-value {
        font-family: var(--serif);
        font-size: 24px !important;
        font-weight: 500;
        line-height: 1.1;
    }
    .website-requests-management .wr-stat-label {
        font-family: var(--sans);
        font-size: 10.5px !important;
        font-weight: 500;
        letter-spacing: 0.14em;
    }
    .website-requests-management .wr-stat-compare {
        font-size: 10.5px !important;
        margin-top: 4px;
    }

    /* 5. Breakdown bar: §3.4 card radius. */
    .website-requests-management .wr-breakdown-bar {
        padding: 12px !important;
        border-radius: 10px !important;
        margin-top: 10px;
    }
    .website-requests-management .wr-breakdown-title {
        font-family: var(--sans);
        font-size: 10.5px !important;
        letter-spacing: 0.14em;
    }
    .website-requests-management .wr-stacked-legend {
        gap: 4px 12px !important;
        margin-top: 8px;
    }
    .website-requests-management .wr-legend-item {
        font-size: 11px !important;
    }

    /* 6. status-table → card-stack. ============================================
       Hide the table's horizontal-scroll wrapper, hide <thead>, flip each
       <tr.wr-row> into a 2-col grid card. Every <td> needs width:auto !important
       to defeat the inline `<th style="width: 30px;">` etc. */
    .website-requests-management .status-table-wrapper {
        overflow: visible !important; /* defeat inline 768px `overflow-x: auto` */
        border: none !important;
        border-radius: 0 !important;
    }
    .website-requests-management table.status-table {
        display: block !important;
        width: 100% !important;
        border-collapse: separate !important;
    }
    .website-requests-management table.status-table thead { display: none !important; }
    .website-requests-management table.status-table tbody {
        display: block !important;
        width: 100%;
    }
    .website-requests-management table.status-table tbody tr.wr-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        column-gap: 10px;
        row-gap: 8px;
        padding: 12px;
        margin-bottom: 10px;
        background: var(--paper-2);
        border: 1px solid var(--rule);
        border-radius: 10px;
        position: relative;
    }
    .website-requests-management table.status-table tbody tr.wr-row:hover td {
        background: transparent !important; /* defeat desktop hover bg */
    }
    .website-requests-management table.status-table tbody tr.wr-row > td {
        display: block !important;
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-body);
        text-align: left !important;
        vertical-align: top;
    }
    /* Label rendered above each value. Spacing scale = 4px gap. */
    .website-requests-management table.status-table tbody tr.wr-row > td::before {
        content: attr(data-label);
        display: block;
        font-family: var(--sans);
        font-size: 9.5px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 4px;
    }

    /* Column-by-column labels. Two filter variants:
       (A) status_filter != 'launched' (default):
           1=Drag, 2=#, 3=Website, 4=Stage, 5=Designer, 6=SEO, 7=Developer, 8=Cost,
           9=Due, 10=Actions
       (B) status_filter == 'launched':
           1=#, 2=Website, 3=Designer, 4=SEO, 5=Developer, 6=Cost, 7=Launch, 8=Actions

       We label variant (A) via :nth-child; variant (B) doesn't render the drag
       handle (no `.wr-drag-handle` child), so we detect "no drag" via
       :first-child class fallback. To keep things simple we use the `wr-drag-handle`
       class as the variant gate: when present, indexes shift by +1.
       Variant (B) is launched-only and contains 8 cells (no drag, no stage).
    */

    /* --- Variant A: row HAS .wr-drag-handle as first child --- */
    /* mobile-followup PR: show the drag handle as a 44x44 touch target so
       AMs can reorder pipeline rows on phones via Sortable.js touch-drag.
       Paired with delay:200 + delayOnTouchOnly:true in the JS init so it
       won't fire from accidental scroll-touches. */
    .website-requests-management table.status-table tbody tr.wr-row > td.wr-drag-handle {
        display: flex !important;          /* defeat the prior display:none */
        align-items: center;
        justify-content: center;
        grid-column: 1 / -1;
        min-height: 44px;
        font-size: 18px;
        color: var(--ink-3);
        cursor: grab;
        touch-action: none;                /* prevent page-pan during drag */
        background: var(--paper);
        border-radius: 8px;
        margin-bottom: 6px;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td.wr-drag-handle::before {
        content: "";                        /* no label needed — icon is self-evident */
    }
    /* Spans whole row */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(2) {
        /* "#" priority number — small, top-left meta */
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(2)::before {
        content: "Priority";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(2) .wr-priority-num {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    /* Website name (cell 3) — span full width, larger serif name */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(3) {
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(3)::before {
        content: "Website";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(3) a,
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(3) .fw-medium {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
        color: var(--ink) !important;
        line-height: 1.2;
    }
    /* Stage cell (cell 4) — full width, pill above progress bar */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(4) {
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(4)::before {
        content: "Stage";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(4) .wr-stage-cell {
        min-width: 0 !important; /* defeat inline 110px min-width */
        flex-direction: column;
        gap: 4px;
    }
    /* Designer (5), SEO (6), Developer (7), Cost (8), Due (9) — 2-col */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(5)::before {
        content: "Designer";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(6)::before {
        content: "SEO Specialist";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(7)::before {
        content: "Developer";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(8)::before {
        content: "Cost";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(9)::before {
        content: "Due";
    }
    /* Actions (cell 10) — full-width second line */
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(10) {
        grid-column: 1 / -1;
        text-align: left !important;
        margin-top: 4px;
        padding-top: 8px !important;
        border-top: 1px solid var(--rule) !important;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(10)::before {
        content: "Actions";
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:nth-child(10) > div {
        gap: 8px !important;
        display: inline-flex !important;
    }

    /* --- Variant B: launched filter — no drag handle, no stage. Re-label cells
         since :nth-child shifts. Detect via `:first-child:not(.wr-drag-handle)`. */
    .website-requests-management table.status-table tbody tr.wr-row > td:first-child:not(.wr-drag-handle) {
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row > td:first-child:not(.wr-drag-handle)::before {
        content: "Priority";
    }
    /* In variant B, cell 2 (Website) overrides the variant-A "Priority" label set
       above for nth-child(2). Use a more-specific has-not-drag selector to win. */
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(2)::before {
        content: "Website";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(2) {
        grid-column: 1 / -1;
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(3)::before {
        content: "Designer";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(4)::before {
        content: "SEO Specialist";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(5)::before {
        content: "Developer";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(6)::before {
        content: "Cost";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(7)::before {
        content: "Launch Date";
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(8) {
        grid-column: 1 / -1;
        text-align: left !important;
        margin-top: 4px;
        padding-top: 8px !important;
        border-top: 1px solid var(--rule) !important;
    }
    .website-requests-management table.status-table tbody tr.wr-row:not(:has(> td.wr-drag-handle)) > td:nth-child(8)::before {
        content: "Actions";
    }

    /* 7. Action icons — 36×36 tap targets (HANDOFF §3.5 / iconbtn). */
    .website-requests-management .wr-action-icon {
        width: 36px !important;
        height: 36px !important;
        border-radius: 6px !important;
        font-size: 14px !important;
        background: var(--paper-3);
    }

    /* 8. Empty state polish. */
    .website-requests-management .wr-empty-state {
        padding: 32px 16px !important;
        border-radius: 10px !important;
        margin-top: 12px;
    }
    .website-requests-management .wr-empty-icon { font-size: 32px !important; }
    .website-requests-management .wr-empty-state h5 {
        font-family: var(--serif);
        font-size: 18px;
        font-weight: 500;
    }
    .website-requests-management .wr-empty-state p {
        font-family: var(--sans);
        font-size: 13px;
        color: var(--ink-3);
    }
    .website-requests-management .wr-empty-state .btn-primary-opt {
        min-height: 44px;
        font-size: 11.5px !important;
    }

    /* 9. Calendar tab toolbar — wrap, full-width selects, 44px height. */
    .website-requests-management .cal-toolbar > .d-flex {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px !important;
    }
    .website-requests-management .cal-toolbar .d-flex.gap-2 {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .website-requests-management .cal-toolbar .form-select {
        flex: 1 1 100%;
        width: 100% !important;
        min-width: 0 !important; /* defeat inline `min-width: 180px;` */
        min-height: 44px;
        font-size: 15px !important;
        padding: 10px 14px !important;
        border-radius: 6px !important;
    }
    .website-requests-management .cal-view-toggle {
        align-self: flex-start;
    }
    .website-requests-management .cal-view-toggle .btn {
        min-height: 40px;
        padding: 8px 14px !important;
        font-size: 11.5px !important;
    }
    .website-requests-management .cal-legend {
        gap: 6px !important;
    }
    .website-requests-management .cal-legend-item {
        font-size: 11px !important;
        padding: 4px 10px !important;
        min-height: 28px;
    }

    /* Calendar card: tighter padding + allow internal grid scroll (HANDOFF §11). */
    .website-requests-management .cal-card-wrapper {
        padding: 4px !important;
        border-radius: 10px !important;
        min-height: 0 !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .website-requests-management .fc .fc-toolbar {
        padding: 12px 8px !important;
        gap: 8px !important;
        flex-wrap: wrap;
    }
    .website-requests-management .fc .fc-toolbar-title {
        font-size: 18px !important;
    }
    .website-requests-management .fc .fc-daygrid-day-frame {
        min-height: 60px !important;
    }
    .website-requests-management .fc .fc-button-primary {
        padding: 8px 12px !important;
        font-size: 11.5px !important;
        min-height: 40px;
    }

    /* Team view: stack header + allow grid to scroll. */
    .website-requests-management .team-view-card {
        border-radius: 10px !important;
    }
    .website-requests-management .team-toolbar {
        flex-wrap: wrap;
        gap: 8px !important;
        padding: 12px !important;
    }
    .website-requests-management .team-toolbar-title {
        font-size: 16px !important;
        flex: 1 0 100%;
        order: -1;
        text-align: left;
    }
    .website-requests-management .team-name-cell {
        width: 100px !important;
        min-width: 100px !important;
        font-size: 12px !important;
        padding: 8px !important;
    }

    /* 10. Kanban board: vertical stack. ========================================
       Defeats inline `display: flex; gap: 12px; overflow-x: auto` on .wb-kb-board
       so columns stack instead of side-scroll. Each column full width. */
    .website-requests-management .wb-kb-board {
        display: flex !important;
        flex-direction: column !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        gap: 10px !important;
        padding-bottom: 16px !important;
    }
    .website-requests-management .wb-kb-column {
        flex: 1 0 auto !important;
        min-width: 0 !important; /* defeat inline 200px / 180px */
        width: 100% !important;
        max-height: none !important;
        border-radius: 10px !important;
    }
    .website-requests-management .wb-kb-col-header {
        padding: 10px 12px !important;
        min-height: 44px;
    }
    .website-requests-management .wb-kb-col-title {
        font-family: var(--sans);
        font-size: 12px !important;
        font-weight: 600;
    }
    .website-requests-management .wb-kb-col-body {
        max-height: none !important;
        padding: 10px !important;
    }
    .website-requests-management .wb-kb-card {
        padding: 12px !important;
        border-radius: 10px !important;
        margin-bottom: 8px !important;
    }
    .website-requests-management .wb-kb-card-name {
        font-family: var(--serif);
        font-size: 16px !important;
        font-weight: 500;
        white-space: normal; /* allow wrap on mobile */
        overflow: visible;
        text-overflow: clip;
    }
    .website-requests-management .wb-kb-card-client {
        font-size: 12px !important;
        white-space: normal;
    }
    .website-requests-management .wb-kb-card-domain {
        font-size: 11px !important;
    }
    .website-requests-management .wb-kb-card-meta {
        font-size: 11px !important;
        gap: 8px 12px !important;
    }
    .website-requests-management .wb-kb-card-meta i {
        font-size: 11px !important;
    }
    .website-requests-management .wb-kb-priority-badge {
        font-size: 10px !important;
        padding: 2px 8px !important;
    }

    /* 11. Modals → bottom-sheet (newRequestModal + editRequestModal).
       Both are scoped via #newRequestModal / #editRequestModal so they don't
       affect any global Bootstrap modals. */
    #newRequestModal.modal,
    #editRequestModal.modal {
        padding: 0 !important;
    }
    #newRequestModal .modal-dialog,
    #editRequestModal .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        min-height: 100%;
        display: flex;
        align-items: flex-end;
        padding: 0;
    }
    #newRequestModal .modal-content,
    #editRequestModal .modal-content {
        width: 100%;
        max-height: 92dvh;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -8px 30px rgba(20, 18, 15, 0.18) !important;
        display: flex;
        flex-direction: column;
    }
    #newRequestModal .modal-header,
    #editRequestModal .modal-header {
        padding: 12px 16px !important;
        flex: 0 0 auto;
    }
    #newRequestModal .modal-header .modal-title,
    #editRequestModal .modal-header .modal-title {
        font-family: var(--serif) !important;
        font-size: 18px !important;
    }
    #newRequestModal .modal-header .btn-close,
    #editRequestModal .modal-header .btn-close {
        width: 44px;
        height: 44px;
        padding: 12px !important;
    }
    #newRequestModal .modal-body,
    #editRequestModal .modal-body {
        padding: 16px !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1 1 auto;
        padding-bottom: 32px !important;
    }
    #newRequestModal .modal-body .form-label,
    #editRequestModal .modal-body .form-label {
        font-size: 10.5px !important;
        letter-spacing: 0.14em !important;
        margin-bottom: 6px !important;
    }
    #newRequestModal .modal-body .form-control,
    #newRequestModal .modal-body .form-select,
    #editRequestModal .modal-body .form-control,
    #editRequestModal .modal-body .form-select {
        min-height: 44px;
        font-size: 15px !important; /* prevent iOS zoom */
        padding: 10px 14px !important;
        border-radius: 6px !important;
    }
    #newRequestModal .modal-body textarea.form-control,
    #editRequestModal .modal-body textarea.form-control {
        min-height: 88px;
    }
    /* Bootstrap col-md-* inside modal body — already stack below md, but ensure
       gutters are tight. */
    #newRequestModal .modal-body .row,
    #editRequestModal .modal-body .row {
        --bs-gutter-x: 0;
        --bs-gutter-y: 0;
        margin: 0;
    }
    #newRequestModal .modal-body .row > [class*="col-"],
    #editRequestModal .modal-body .row > [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
    }
    /* Request type toggle: full-width 44px buttons. */
    #newRequestModal .modal-body .btn-group {
        gap: 0;
    }
    #newRequestModal .modal-body .btn-group .btn-outline-dark {
        min-height: 44px;
        font-size: 11.5px !important;
    }
    /* Modal footer: sticky buttons, stretched. */
    #newRequestModal .modal-footer,
    #editRequestModal .modal-footer {
        padding: 12px 16px !important;
        gap: 8px;
        flex: 0 0 auto;
        border-top: 1px solid var(--rule) !important;
    }
    #newRequestModal .modal-footer .btn,
    #editRequestModal .modal-footer .btn {
        flex: 1 1 auto;
        min-height: 44px;
        font-size: 11.5px !important;
        padding: 10px 16px !important;
    }
    /* Edit-modal pipeline step indicator — keep visible but tighten. */
    #editRequestModal .wr-pipeline-indicator {
        overflow-x: auto;
        padding: 6px 0;
        scrollbar-width: none;
    }
    #editRequestModal .wr-pipeline-indicator::-webkit-scrollbar { display: none; }
    #editRequestModal .wr-pipeline-step {
        min-width: 32px;
    }
    /* Notes timeline inside edit modal. */
    #editRequestModal .wr-notes-timeline {
        max-height: 200px;
    }
    #editRequestModal .wr-add-note-form {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    #editRequestModal .wr-add-note-btn {
        min-height: 44px;
        font-size: 11.5px;
    }

    /* =========================================================================
       /company/gmb/profile-detail — per-profile GBP page: header stacks,
       hero 1-col, tabs scroll, tab content baseline rules
       -------------------------------------------------------------------------
       Page-private classes are `.gbp-detail-*` mounted under
       `.gbp-mgmt.gbp-detail`. All selectors here are anchored to `.gbp-detail`
       so we don't bleed into the GBP management list page (which also uses
       `.gbp-mgmt`). Desktop CSS lives in gmb-profile-detail.css +
       gmb-management-v2.css — those files already have a `@media
       (max-width: 900px)` block which sets header column / hero single-col,
       but it leaves the actions row, tab strip, breadcrumb, and tab-content
       cards desktop-shaped. We tighten everything for ≤375px here.
       ========================================================================= */

    /* Page gutter — desktop is 24px/28px; on phone trim to keep cards
       full-bleed-ish without hugging the edge. */
    .gbp-detail {
        padding: 12px 12px 40px;
    }

    /* ── Breadcrumb ─────────────────────────────────────────────────────── */
    /* Allow wrap so long client + profile names don't push the page wide
       and trigger horizontal scroll. */
    .gbp-detail .gbp-detail-breadcrumb {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 10.5px;
        margin-bottom: 12px;
        font-family: var(--sans);
        letter-spacing: 0.04em;
    }

    /* ── Page header ────────────────────────────────────────────────────── */
    /* Desktop CSS already flips to column at ≤900px; we just tighten and
       make the actions row genuinely usable on a phone. */
    .gbp-detail .gbp-detail-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }
    .gbp-detail .gbp-detail-eyebrow {
        font-size: 10px;
        letter-spacing: 0.14em;
        margin-bottom: 4px;
    }
    .gbp-detail .gbp-detail-title {
        font-family: var(--serif);
        font-size: 22px;
        line-height: 1.15;
        letter-spacing: -0.005em;
    }
    .gbp-detail .gbp-detail-subtitle {
        font-size: 12px;
        margin-top: 4px;
        line-height: 1.35;
    }

    /* Actions row — wrap into a 2-col grid of buttons.
       Primary "+ New post" takes a full row so the highest-intent CTA is
       always the widest tap target. Each button ≥44px tall (iOS HIG). */
    .gbp-detail .gbp-detail-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .gbp-detail .gbp-detail-actions .gbp-btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 44px;
        padding: 10px 12px;
        font-size: 12px;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
        box-sizing: border-box;
    }
    .gbp-detail .gbp-detail-actions .gbp-btn-primary {
        /* Make the primary CTA the full row's worth — easier to find,
           bigger tap target. */
        flex-basis: 100%;
    }

    /* ── Hero card ──────────────────────────────────────────────────────── */
    /* Desktop CSS at ≤900px already drops to a single grid column, but
       the rating stays left-aligned and the ring + label sit beside each
       other. On phones we want a clean vertical stack with the ring
       centred so it reads as the page's primary status indicator. */
    .gbp-detail .gbp-detail-hero {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 14px 14px 16px;
        border-radius: 10px;
        margin-bottom: 12px;
    }
    .gbp-detail .gbp-detail-hero__health {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }
    .gbp-detail .gbp-detail-hero__health-label {
        text-align: center;
    }
    /* Kvs go 2-up so we still get density but don't overflow on 320px-ish
       widths. The desktop ≤900px rule collapses to 1fr; we override back
       to 2 columns because the values are short labels. */
    .gbp-detail .gbp-detail-hero__kvs {
        grid-template-columns: 1fr 1fr;
        gap: 10px 14px;
        width: 100%;
    }
    .gbp-detail .gbp-detail-kv__value {
        font-size: 12.5px;
    }
    .gbp-detail .gbp-detail-hero__rating {
        text-align: center;
        width: 100%;
        padding-top: 4px;
        border-top: 1px solid var(--rule);
    }
    .gbp-detail .gbp-detail-hero__rating-value {
        font-size: 26px;
    }

    /* ── Status banner (JS-rendered) ────────────────────────────────────── */
    .gbp-detail #gbpStatusBanner .gbp-detail-banner {
        padding: 12px 14px;
        font-size: 12.5px;
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-start;
        border-radius: 10px;
        margin-bottom: 12px;
    }
    .gbp-detail #gbpStatusBanner .gbp-detail-banner__msg {
        flex: 1 1 100%;
        line-height: 1.4;
    }

    /* ── Tabs — horizontal scroll strip per HANDOFF §11 ─────────────────── */
    .gbp-detail .gbp-detail-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;          /* Firefox */
        margin: 4px -12px 14px;          /* bleed to edges so scroll feels native */
        padding: 0 12px;
    }
    .gbp-detail .gbp-detail-tabs::-webkit-scrollbar {
        display: none;                   /* webkit hide */
    }
    .gbp-detail .gbp-detail-tab {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 10px 14px;
        font-size: 12.5px;
        white-space: nowrap;
    }

    /* ── Tab content (JS-rendered into #gbpTabContent) ──────────────────── */
    /* Conservative rules — only target classes we know exist from
       gmb-profile-detail.css. The JS injects one or more of these per
       tab. Anything not handled here falls back to the desktop CSS, which
       is fine for most short text rows but would overflow on tables. */

    /* Generic detail card — tighten padding so cards feel mobile-native. */
    .gbp-detail .gbp-detail-card {
        padding: 12px 14px;
        border-radius: 10px;
        margin-bottom: 10px;
    }
    .gbp-detail .gbp-detail-card h3 {
        font-size: 11px;
        margin-bottom: 10px;
    }
    /* Two-col tab layout collapses to single column. */
    .gbp-detail .gbp-detail-twocol {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Posts tab — toolbar wraps, list items already stack via desktop's
       ≤900px rule. We tighten padding and ensure action buttons hit 44px. */
    .gbp-detail .gbp-posts-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    .gbp-detail .gbp-post-item {
        padding: 12px 14px;
        gap: 6px;
        font-size: 13px;
    }
    .gbp-detail .gbp-post-actions {
        justify-content: flex-start;
        gap: 6px;
    }
    .gbp-detail .gbp-post-actions button {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 11px;
        border-radius: 6px;
    }

    /* Audit log — desktop's ≤900px rule already collapses the grid to 1col.
       Add padding tweaks and a label-style for the type/time columns so
       the stacked rows read cleanly without their original column headers. */
    .gbp-detail .gbp-audit-row {
        padding: 10px 14px;
        gap: 4px;
        font-size: 12px;
    }
    .gbp-detail .gbp-audit-row__type,
    .gbp-detail .gbp-audit-row__time {
        font-size: 10.5px;
    }

    /* Inline compose form (lives in Posts tab when active). */
    .gbp-detail .gbp-compose-card {
        padding: 14px;
        border-radius: 10px;
    }
    .gbp-detail .gbp-compose-row textarea,
    .gbp-detail .gbp-compose-row input,
    .gbp-detail .gbp-compose-row select {
        font-size: 14px;                 /* ≥14px so iOS Safari doesn't zoom on focus */
        padding: 10px 12px;
        min-height: 44px;
        box-sizing: border-box;
    }
    .gbp-detail .gbp-compose-row textarea {
        min-height: 110px;
    }
    .gbp-detail .gbp-compose-actions {
        gap: 8px;
    }
    .gbp-detail .gbp-compose-actions .gbp-btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 44px;
        justify-content: center;
    }

    /* Empty-state placeholders (Reviews / Info / Insights) — pad less and
       keep the title from cramming against the card edge on 320px. */
    .gbp-detail .gbp-tab-empty {
        padding: 32px 16px;
        border-radius: 10px;
    }
    .gbp-detail .gbp-tab-empty__title {
        font-size: 18px;
    }
    .gbp-detail .gbp-tab-empty__sub {
        font-size: 12.5px;
    }


    /* =========================================================================
       /company/gmb/profile-detail — per-profile GBP page: header stacks,
       hero 1-col, tabs scroll, tab content baseline rules
       -------------------------------------------------------------------------
       Page-private classes are `.gbp-detail-*` mounted under
       `.gbp-mgmt.gbp-detail`. All selectors here are anchored to `.gbp-detail`
       so we don't bleed into the GBP management list page (which also uses
       `.gbp-mgmt`). Desktop CSS lives in gmb-profile-detail.css +
       gmb-management-v2.css — those files already have a `@media
       (max-width: 900px)` block which sets header column / hero single-col,
       but it leaves the actions row, tab strip, breadcrumb, and tab-content
       cards desktop-shaped. We tighten everything for ≤375px here.
       ========================================================================= */

    /* Page gutter — desktop is 24px/28px; on phone trim to keep cards
       full-bleed-ish without hugging the edge. */
    .gbp-detail {
        padding: 12px 12px 40px;
    }

    /* ── Breadcrumb ─────────────────────────────────────────────────────── */
    /* Allow wrap so long client + profile names don't push the page wide
       and trigger horizontal scroll. */
    .gbp-detail .gbp-detail-breadcrumb {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 10.5px;
        margin-bottom: 12px;
        font-family: var(--sans);
        letter-spacing: 0.04em;
    }

    /* ── Page header ────────────────────────────────────────────────────── */
    /* Desktop CSS already flips to column at ≤900px; we just tighten and
       make the actions row genuinely usable on a phone. */
    .gbp-detail .gbp-detail-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }
    .gbp-detail .gbp-detail-eyebrow {
        font-size: 10px;
        letter-spacing: 0.14em;
        margin-bottom: 4px;
    }
    .gbp-detail .gbp-detail-title {
        font-family: var(--serif);
        font-size: 22px;
        line-height: 1.15;
        letter-spacing: -0.005em;
    }
    .gbp-detail .gbp-detail-subtitle {
        font-size: 12px;
        margin-top: 4px;
        line-height: 1.35;
    }

    /* Actions row — wrap into a 2-col grid of buttons.
       Primary "+ New post" takes a full row so the highest-intent CTA is
       always the widest tap target. Each button ≥44px tall (iOS HIG). */
    .gbp-detail .gbp-detail-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .gbp-detail .gbp-detail-actions .gbp-btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 44px;
        padding: 10px 12px;
        font-size: 12px;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
        box-sizing: border-box;
    }
    .gbp-detail .gbp-detail-actions .gbp-btn-primary {
        /* Make the primary CTA the full row's worth — easier to find,
           bigger tap target. */
        flex-basis: 100%;
    }

    /* ── Hero card ──────────────────────────────────────────────────────── */
    /* Desktop CSS at ≤900px already drops to a single grid column, but
       the rating stays left-aligned and the ring + label sit beside each
       other. On phones we want a clean vertical stack with the ring
       centred so it reads as the page's primary status indicator. */
    .gbp-detail .gbp-detail-hero {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 14px 14px 16px;
        border-radius: 10px;
        margin-bottom: 12px;
    }
    .gbp-detail .gbp-detail-hero__health {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }
    .gbp-detail .gbp-detail-hero__health-label {
        text-align: center;
    }
    /* Kvs go 2-up so we still get density but don't overflow on 320px-ish
       widths. The desktop ≤900px rule collapses to 1fr; we override back
       to 2 columns because the values are short labels. */
    .gbp-detail .gbp-detail-hero__kvs {
        grid-template-columns: 1fr 1fr;
        gap: 10px 14px;
        width: 100%;
    }
    .gbp-detail .gbp-detail-kv__value {
        font-size: 12.5px;
    }
    .gbp-detail .gbp-detail-hero__rating {
        text-align: center;
        width: 100%;
        padding-top: 4px;
        border-top: 1px solid var(--rule);
    }
    .gbp-detail .gbp-detail-hero__rating-value {
        font-size: 26px;
    }

    /* ── Status banner (JS-rendered) ────────────────────────────────────── */
    .gbp-detail #gbpStatusBanner .gbp-detail-banner {
        padding: 12px 14px;
        font-size: 12.5px;
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-start;
        border-radius: 10px;
        margin-bottom: 12px;
    }
    .gbp-detail #gbpStatusBanner .gbp-detail-banner__msg {
        flex: 1 1 100%;
        line-height: 1.4;
    }

    /* ── Tabs — horizontal scroll strip per HANDOFF §11 ─────────────────── */
    .gbp-detail .gbp-detail-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;          /* Firefox */
        margin: 4px -12px 14px;          /* bleed to edges so scroll feels native */
        padding: 0 12px;
    }
    .gbp-detail .gbp-detail-tabs::-webkit-scrollbar {
        display: none;                   /* webkit hide */
    }
    .gbp-detail .gbp-detail-tab {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 10px 14px;
        font-size: 12.5px;
        white-space: nowrap;
    }

    /* ── Tab content (JS-rendered into #gbpTabContent) ──────────────────── */
    /* Conservative rules — only target classes we know exist from
       gmb-profile-detail.css. The JS injects one or more of these per
       tab. Anything not handled here falls back to the desktop CSS, which
       is fine for most short text rows but would overflow on tables. */

    /* Generic detail card — tighten padding so cards feel mobile-native. */
    .gbp-detail .gbp-detail-card {
        padding: 12px 14px;
        border-radius: 10px;
        margin-bottom: 10px;
    }
    .gbp-detail .gbp-detail-card h3 {
        font-size: 11px;
        margin-bottom: 10px;
    }
    /* Two-col tab layout collapses to single column. */
    .gbp-detail .gbp-detail-twocol {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Posts tab — toolbar wraps, list items already stack via desktop's
       ≤900px rule. We tighten padding and ensure action buttons hit 44px. */
    .gbp-detail .gbp-posts-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    .gbp-detail .gbp-post-item {
        padding: 12px 14px;
        gap: 6px;
        font-size: 13px;
    }
    .gbp-detail .gbp-post-actions {
        justify-content: flex-start;
        gap: 6px;
    }
    .gbp-detail .gbp-post-actions button {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 11px;
        border-radius: 6px;
    }

    /* Audit log — desktop's ≤900px rule already collapses the grid to 1col.
       Add padding tweaks and a label-style for the type/time columns so
       the stacked rows read cleanly without their original column headers. */
    .gbp-detail .gbp-audit-row {
        padding: 10px 14px;
        gap: 4px;
        font-size: 12px;
    }
    .gbp-detail .gbp-audit-row__type,
    .gbp-detail .gbp-audit-row__time {
        font-size: 10.5px;
    }

    /* Inline compose form (lives in Posts tab when active). */
    .gbp-detail .gbp-compose-card {
        padding: 14px;
        border-radius: 10px;
    }
    .gbp-detail .gbp-compose-row textarea,
    .gbp-detail .gbp-compose-row input,
    .gbp-detail .gbp-compose-row select {
        font-size: 14px;                 /* ≥14px so iOS Safari doesn't zoom on focus */
        padding: 10px 12px;
        min-height: 44px;
        box-sizing: border-box;
    }
    .gbp-detail .gbp-compose-row textarea {
        min-height: 110px;
    }
    .gbp-detail .gbp-compose-actions {
        gap: 8px;
    }
    .gbp-detail .gbp-compose-actions .gbp-btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 44px;
        justify-content: center;
    }

    /* Empty-state placeholders (Reviews / Info / Insights) — pad less and
       keep the title from cramming against the card edge on 320px. */
    .gbp-detail .gbp-tab-empty {
        padding: 32px 16px;
        border-radius: 10px;
    }
    .gbp-detail .gbp-tab-empty__title {
        font-size: 18px;
    }
    .gbp-detail .gbp-tab-empty__sub {
        font-size: 12.5px;
    }

    /* =========================================================================
       /company/gmb — GMB Management: header stacks, kanban scroll-trap off,
       detail panel slide-up bottom-sheet
       -------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing), §4 (cards/buttons/inputs), §10 (bottom-sheet),
       §11 (tab strip with horizontal scroll). The page ships an inline <style>
       block (template lines 4–183) with its own @media(max-width:700px) that
       handles the basics. This section tops it up between 700.01–767.98px and
       fixes remaining issues at <=700px that the inline block didn't catch.
       All selectors page-scoped via .gmb-wrap or .gmb-detail-panel.
       ========================================================================= */

    /* Page padding: pull in tight on phones (was 24px 32px desktop) */
    .gmb-wrap {
        padding: 12px 14px 32px;
    }

    /* Header — inline @media at ≤700px already stacks it. Top up the
       700.01–767.98px band so the buttons don't crowd the title. */
    .gmb-wrap .gmb-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }
    .gmb-wrap .gmb-header h1 {
        font-size: 24px;
        line-height: 1.15;
    }
    .gmb-wrap .gmb-header-actions {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .gmb-wrap .gmb-header-actions .gmb-btn {
        min-height: 40px;
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Stats bar — inline block flex-wraps at ≤700px. Make each stat sit
       inline without forcing a single overflow row. */
    .gmb-wrap .gmb-stats {
        flex-wrap: wrap;
        gap: 10px 16px;
        padding: 12px 14px;
        border-radius: 16px;
        font-size: 12px;
    }
    .gmb-wrap .gmb-stat {
        flex: 0 0 auto;
        min-width: 0;
    }

    /* Tabs — keep as a strip; allow horizontal scroll so all tabs remain
       reachable. Hide webkit scrollbar for cleanliness (HANDOFF §11). */
    .gmb-wrap .gmb-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 4px;
        gap: 4px;
        margin-bottom: 12px;
    }
    .gmb-wrap .gmb-tabs::-webkit-scrollbar {
        display: none;
    }
    .gmb-wrap .gmb-tab {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Filters — inline @media at ≤700px already wraps. Make search full-width,
       inputs 44px tall with 15px font to avoid iOS zoom. Break view-toggle
       margin-left:auto so it doesn't right-anchor on its own row. */
    .gmb-wrap .gmb-filters {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 14px;
    }
    .gmb-wrap .gmb-search {
        flex: 1 1 100%;
        max-width: 100%;
        min-height: 44px;
        padding: 11px 14px;
        font-size: 15px;
        border-radius: 10px;
    }
    .gmb-wrap .gmb-select {
        min-height: 44px;
        padding: 11px 12px;
        font-size: 15px;
        border-radius: 10px;
    }
    .gmb-wrap .view-toggle {
        margin-left: 0;
        padding: 4px;
        border-radius: 10px;
    }
    .gmb-wrap .view-toggle .view-toggle-btn {
        min-height: 40px;
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Connected accounts bars — wrap chips and let the meta text break */
    .gmb-wrap .gbp-accounts-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
        border-radius: 12px;
    }
    .gmb-wrap .gbp-account-chip {
        font-size: 12px;
    }

    /* List view — client group header and profile rows. Allow names to wrap
       so long titles aren't ellipsis-clipped on narrow screens. */
    .gmb-wrap .gmb-client-header {
        padding: 12px 14px;
        border-radius: 12px;
        gap: 8px;
    }
    .gmb-wrap .gmb-client-profiles {
        padding-left: 8px;
    }
    .gmb-wrap .gmb-row {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 10px 12px;
        gap: 6px 10px;
        white-space: normal;
    }
    .gmb-wrap .gmb-row * {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    /* Kanban — inline @media at ≤700px already single-cols the board. Kill
       the column max-height calc(100vh - 280px) so columns expand naturally
       and the page (not the column) scrolls. */
    .gmb-wrap .kb-board {
        gap: 10px;
    }
    .gmb-wrap .kb-board.cols-4,
    .gmb-wrap .kb-board.cols-3 {
        grid-template-columns: 1fr;
    }
    .gmb-wrap .kb-column {
        max-height: none;
        min-height: 0;
        overflow: visible;
        border-radius: 14px;
    }
    .gmb-wrap .kb-column-body {
        max-height: none;
        overflow-y: visible;
        padding: 8px;
    }
    .gmb-wrap .kb-column-header {
        padding: 12px 14px;
    }
    .gmb-wrap .kb-card {
        padding: 12px;
        border-radius: 12px;
    }
    .gmb-wrap .kb-card-name,
    .gmb-wrap .kb-card-client {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.3;
    }
    .gmb-wrap .kb-card-name {
        font-size: 14px;
    }
    .gmb-wrap .kb-card-client {
        font-size: 12px;
    }
    .gmb-wrap .kb-card-footer {
        flex-wrap: wrap;
        gap: 6px 8px;
    }
    .gmb-wrap .kb-add-column {
        max-width: 100%;
        width: 100%;
        min-height: 64px;
    }

    /* Detail panel — flip from right slide-in to bottom-sheet. The inline
       <style> block sets `right: -530px` and `.open { right: 0 }` with a
       `transition: right .25s ease`. We override with !important so the
       sheet anchors to the bottom and slides up via transform. */
    .gmb-detail-panel {
        top: auto !important;              /* defeat inline `top:0` so the sheet sits at the bottom */
        bottom: 0 !important;               /* defeat absent inline bottom value */
        left: 0 !important;                 /* defeat inline implicit left from right:-530px */
        right: 0 !important;                /* defeat inline `right:-530px` so width spans viewport */
        width: 100% !important;             /* defeat inline `width:520px` */
        height: 92dvh !important;           /* defeat inline `height:100%` */
        max-height: 92dvh;
        border-left: none !important;       /* defeat inline left border */
        border-top: 1px solid var(--border-subtle);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform 0.25s ease !important; /* defeat inline `transition: right .25s ease` */
    }
    .gmb-detail-panel.open {
        right: 0 !important;                /* defeat inline `.open { right: 0 }` (no-op but explicit) */
        transform: translateY(0);
    }
    .gmb-detail-header {
        padding: 14px 16px;
        gap: 10px;
    }
    .gmb-detail-header h2 {
        max-width: none;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        font-size: 18px;
        line-height: 1.2;
    }
    .gmb-detail-close {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        padding: 0;
    }
    .gmb-detail-body {
        padding: 16px;
    }
    .gmb-detail-section {
        margin-bottom: 16px;
    }
    .gmb-detail-panel .gmb-fields-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .gmb-detail-panel .gmb-field-value {
        font-size: 14px;
    }
    .gmb-detail-panel .gmb-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .gmb-detail-panel .gmb-action-btn {
        min-height: 36px;
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 8px;
    }


    /* =========================================================================
       /company/gmb — GMB Management: header stacks, kanban scroll-trap off,
       detail panel slide-up bottom-sheet
       -------------------------------------------------------------------------
       Per HANDOFF.md §3 (spacing), §4 (cards/buttons/inputs), §10 (bottom-sheet),
       §11 (tab strip with horizontal scroll). The page ships an inline <style>
       block (template lines 4–183) with its own @media(max-width:700px) that
       handles the basics. This section tops it up between 700.01–767.98px and
       fixes remaining issues at <=700px that the inline block didn't catch.
       All selectors page-scoped via .gmb-wrap or .gmb-detail-panel.
       ========================================================================= */

    /* Page padding: pull in tight on phones (was 24px 32px desktop) */
    .gmb-wrap {
        padding: 12px 14px 32px;
    }

    /* Header — inline @media at ≤700px already stacks it. Top up the
       700.01–767.98px band so the buttons don't crowd the title. */
    .gmb-wrap .gmb-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }
    .gmb-wrap .gmb-header h1 {
        font-size: 24px;
        line-height: 1.15;
    }
    .gmb-wrap .gmb-header-actions {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .gmb-wrap .gmb-header-actions .gmb-btn {
        min-height: 40px;
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Stats bar — inline block flex-wraps at ≤700px. Make each stat sit
       inline without forcing a single overflow row. */
    .gmb-wrap .gmb-stats {
        flex-wrap: wrap;
        gap: 10px 16px;
        padding: 12px 14px;
        border-radius: 16px;
        font-size: 12px;
    }
    .gmb-wrap .gmb-stat {
        flex: 0 0 auto;
        min-width: 0;
    }

    /* Tabs — keep as a strip; allow horizontal scroll so all tabs remain
       reachable. Hide webkit scrollbar for cleanliness (HANDOFF §11). */
    .gmb-wrap .gmb-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 4px;
        gap: 4px;
        margin-bottom: 12px;
    }
    .gmb-wrap .gmb-tabs::-webkit-scrollbar {
        display: none;
    }
    .gmb-wrap .gmb-tab {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Filters — inline @media at ≤700px already wraps. Make search full-width,
       inputs 44px tall with 15px font to avoid iOS zoom. Break view-toggle
       margin-left:auto so it doesn't right-anchor on its own row. */
    .gmb-wrap .gmb-filters {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 14px;
    }
    .gmb-wrap .gmb-search {
        flex: 1 1 100%;
        max-width: 100%;
        min-height: 44px;
        padding: 11px 14px;
        font-size: 15px;
        border-radius: 10px;
    }
    .gmb-wrap .gmb-select {
        min-height: 44px;
        padding: 11px 12px;
        font-size: 15px;
        border-radius: 10px;
    }
    .gmb-wrap .view-toggle {
        margin-left: 0;
        padding: 4px;
        border-radius: 10px;
    }
    .gmb-wrap .view-toggle .view-toggle-btn {
        min-height: 40px;
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Connected accounts bars — wrap chips and let the meta text break */
    .gmb-wrap .gbp-accounts-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
        border-radius: 12px;
    }
    .gmb-wrap .gbp-account-chip {
        font-size: 12px;
    }

    /* List view — client group header and profile rows. Allow names to wrap
       so long titles aren't ellipsis-clipped on narrow screens. */
    .gmb-wrap .gmb-client-header {
        padding: 12px 14px;
        border-radius: 12px;
        gap: 8px;
    }
    .gmb-wrap .gmb-client-profiles {
        padding-left: 8px;
    }
    .gmb-wrap .gmb-row {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 10px 12px;
        gap: 6px 10px;
        white-space: normal;
    }
    .gmb-wrap .gmb-row * {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    /* Kanban — inline @media at ≤700px already single-cols the board. Kill
       the column max-height calc(100vh - 280px) so columns expand naturally
       and the page (not the column) scrolls. */
    .gmb-wrap .kb-board {
        gap: 10px;
    }
    .gmb-wrap .kb-board.cols-4,
    .gmb-wrap .kb-board.cols-3 {
        grid-template-columns: 1fr;
    }
    .gmb-wrap .kb-column {
        max-height: none;
        min-height: 0;
        overflow: visible;
        border-radius: 14px;
    }
    .gmb-wrap .kb-column-body {
        max-height: none;
        overflow-y: visible;
        padding: 8px;
    }
    .gmb-wrap .kb-column-header {
        padding: 12px 14px;
    }
    .gmb-wrap .kb-card {
        padding: 12px;
        border-radius: 12px;
    }
    .gmb-wrap .kb-card-name,
    .gmb-wrap .kb-card-client {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.3;
    }
    .gmb-wrap .kb-card-name {
        font-size: 14px;
    }
    .gmb-wrap .kb-card-client {
        font-size: 12px;
    }
    .gmb-wrap .kb-card-footer {
        flex-wrap: wrap;
        gap: 6px 8px;
    }
    .gmb-wrap .kb-add-column {
        max-width: 100%;
        width: 100%;
        min-height: 64px;
    }

    /* Detail panel — flip from right slide-in to bottom-sheet. The inline
       <style> block sets `right: -530px` and `.open { right: 0 }` with a
       `transition: right .25s ease`. We override with !important so the
       sheet anchors to the bottom and slides up via transform. */
    .gmb-detail-panel {
        top: auto !important;              /* defeat inline `top:0` so the sheet sits at the bottom */
        bottom: 0 !important;               /* defeat absent inline bottom value */
        left: 0 !important;                 /* defeat inline implicit left from right:-530px */
        right: 0 !important;                /* defeat inline `right:-530px` so width spans viewport */
        width: 100% !important;             /* defeat inline `width:520px` */
        height: 92dvh !important;           /* defeat inline `height:100%` */
        max-height: 92dvh;
        border-left: none !important;       /* defeat inline left border */
        border-top: 1px solid var(--border-subtle);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform 0.25s ease !important; /* defeat inline `transition: right .25s ease` */
    }
    .gmb-detail-panel.open {
        right: 0 !important;                /* defeat inline `.open { right: 0 }` (no-op but explicit) */
        transform: translateY(0);
    }
    .gmb-detail-header {
        padding: 14px 16px;
        gap: 10px;
    }
    .gmb-detail-header h2 {
        max-width: none;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        font-size: 18px;
        line-height: 1.2;
    }
    .gmb-detail-close {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        padding: 0;
    }
    .gmb-detail-body {
        padding: 16px;
    }
    .gmb-detail-section {
        margin-bottom: 16px;
    }
    .gmb-detail-panel .gmb-fields-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .gmb-detail-panel .gmb-field-value {
        font-size: 14px;
    }
    .gmb-detail-panel .gmb-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .gmb-detail-panel .gmb-action-btn {
        min-height: 36px;
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 8px;
    }


    /* =============================================================================
       MOBILE: /company/content-map — Client Brain: header stacks, tabs scroll,
       modals → bottom-sheets, table baseline → card-stack
       -----------------------------------------------------------------------------
       Page is too large to fully audit; this rule-set targets the page shell
       (header / site-tabs / main-tabs / tab-content), the dropdown menu, the
       two known modals (`cm-modal-backdrop`, `cm-edit-modal`), and baseline
       card-stack behaviour for any `<table>` inside `.cm-page`. JS-rendered
       widget content (`.cmw-*`, `.cb-*`) gets broad-stroke comfort rules but
       column-by-column table labelling is deferred to a future pass.
       ============================================================================= */

    /* Page shell — defeat .cm-page padding: 1.5rem and ensure no horizontal
       scroll regardless of what JS renders inside. */
    .cm-page {
        padding: 12px 14px 32px !important; /* defeat .cm-page padding: 1.5rem */
        min-height: 100dvh;
        overflow-x: hidden;
    }

    /* ── Header ──
       Desktop: single horizontal row with `margin-left: auto` action cluster.
       Mobile: stack into 2 logical rows via flex-wrap. Title row takes full
       width, then badges flow, then the action cluster wraps onto its own line
       at full width. */
    .cm-page .cm-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 10px;
        margin-bottom: 12px;
    }
    .cm-page .cm-header .cm-back {
        font-size: 20px;
        line-height: 1;
        padding: 8px 4px;
        min-width: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .cm-page .cm-header h1 {
        font-family: var(--serif);
        font-size: 22px;
        line-height: 1.2;
        font-weight: 400;
        margin: 0;
        flex: 1 1 auto;
        min-width: 0;
        /* Allow the long client name to wrap rather than overflow. */
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .cm-page .cm-header h1 span.cm-client-name {
        display: inline;
    }
    .cm-page .cm-header .cm-badge {
        font-size: 10px;
        padding: 3px 8px;
        flex-shrink: 0;
    }
    /* Client-ID chip (inline-styled span next to the badge) — keep on title row,
       wrap allowed. */
    .cm-page .cm-header > span[title="Client ID — click to select"] {
        flex-shrink: 0;
        max-width: 100%;
    }
    /* Action cluster: the inline-styled wrapper `<div style="margin-left:auto">`
       holding Edit / Extend / dropdown. Defeat the right-anchor so it wraps to
       its own row at full width. */
    .cm-page .cm-header > div[style*="margin-left:auto"],
    .cm-page .cm-header > div[style*="margin-left: auto"] {
        margin-left: 0 !important;        /* defeat inline margin-left:auto */
        width: 100%;
        flex-basis: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    /* Extend/Edit buttons — bump to 40px tap target, comfortable padding.
       Defeats inline `padding: 6px 10px` and small font-size from
       content-map.css `.cm-extend-btn`. */
    .cm-page .cm-header .cm-extend-btn {
        min-height: 40px;
        padding: 8px 14px !important;     /* defeat inline padding overrides */
        font-size: 12.5px;
        border-radius: 10px;
        margin-left: 0 !important;        /* defeat .cm-extend-btn margin-left: auto */
        flex: 1 1 auto;
        justify-content: center;
        white-space: nowrap;
    }
    /* The three-dots button is special — keep it square and at the end. */
    .cm-page .cm-header .cmw-dropdown {
        flex: 0 0 auto;
        position: relative;
    }
    .cm-page .cm-header .cmw-dropdown > .cm-extend-btn {
        flex: 0 0 auto;
        min-width: 40px !important;
        width: 40px;
        padding: 8px 0 !important;
    }

    /* ── Multi-site tab bar — horizontal scroll, no wrap.
       Defeats `flex-wrap: wrap` from content-map.css line 1242. */
    .cm-page .cm-site-tabs {
        flex-wrap: nowrap !important;     /* defeat desktop flex-wrap: wrap */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
        padding: 4px;
        margin-bottom: 12px;
    }
    .cm-page .cm-site-tabs::-webkit-scrollbar { display: none; }
    .cm-page .cm-site-tab,
    .cm-page .cm-site-tab-add {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 10px 14px;
        font-size: 12px;
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
    }

    /* ── Main tabs — horizontal-scroll strip per HANDOFF §11.
       Desktop: flex with gap, rounded pill container. Mobile: scroll.
       Defeats no specific desktop rule; just adds overflow. */
    .cm-page .cm-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 2px;
        padding: 4px;
        margin-bottom: 12px;
        border-radius: 12px;
    }
    .cm-page .cm-tabs::-webkit-scrollbar { display: none; }
    .cm-page .cm-tab {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 10px 14px;
        font-size: 13px;
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
        border-radius: 8px;
    }

    /* ── Tab panel baseline ── */
    .cm-page .cm-tab-content {
        padding: 0;
    }
    .cm-page .cm-tab-content.active {
        padding: 12px 0 0 0;
    }

    /* ── Dropdown menu — fit within viewport.
       Defeats inline `style="right:0;left:auto"` (which is desktop-correct
       but on mobile the menu can still overflow the right edge with very
       wide content). Position relative to header action row. */
    .cm-page .cmw-dropdown-menu {
        right: 0 !important;
        left: auto !important;
        min-width: 220px;
        max-width: min(280px, calc(100vw - 28px));
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        /* Bottom-sheet-like elevation since this is the one place a shadow
           is allowed (per HANDOFF.md §4.5). */
        box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    }
    .cm-page .cmw-dropdown-menu .cmw-dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
        font-size: 14px;
        font-family: var(--sans);
    }

    /* ── Generic confirm/edit modal backdrop → bottom-sheet ──
       Desktop: centered dialog. Mobile: slide up from bottom, full width,
       rounded top corners only. Defeats `align-items: center` and
       `padding: 20px` on the backdrop. */
    .cm-modal-backdrop {
        align-items: flex-end !important; /* defeat align-items: center */
        padding: 0 !important;            /* defeat padding: 20px */
    }
    .cm-modal-backdrop .cm-modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0 !important; /* bottom-sheet corners */
        padding: 18px 16px calc(20px + env(safe-area-inset-bottom)) !important;
        max-height: 92dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .cm-modal-backdrop .cm-modal-title {
        font-size: 18px;
        font-family: var(--serif);
    }
    .cm-modal-backdrop .cm-modal-body {
        font-size: 15px;
        line-height: 1.5;
    }
    .cm-modal-backdrop .cm-modal-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .cm-modal-backdrop .cm-modal-btn {
        flex: 1 1 auto;
        min-height: 44px;
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 10px;
    }

    /* ── Edit Client modal → bottom-sheet ──
       Defeats `max-width: 780px`, `max-height: calc(100vh - 40px)`,
       `border-radius: 18px` (all four corners). */
    .cm-edit-modal {
        max-width: 100% !important;       /* defeat max-width: 780px */
        width: 100% !important;
        max-height: 92dvh !important;     /* defeat calc(100vh - 40px) */
        border-radius: 16px 16px 0 0 !important; /* bottom-sheet */
        margin-bottom: 0;
    }
    .cm-edit-modal__head {
        padding: 16px 16px 10px;
    }
    .cm-edit-modal__title {
        font-family: var(--serif);
        font-size: 20px;
    }
    .cm-edit-modal__close {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    /* Edit-modal sub-tabs strip — already overflow-x:auto in desktop CSS;
       just enlarge tap targets and hide scrollbar. */
    .cm-edit-modal__tabs {
        padding: 0 12px;
        gap: 4px;
        scrollbar-width: none;
    }
    .cm-edit-modal__tabs::-webkit-scrollbar { display: none; }
    .cm-edit-modal__tab {
        min-height: 40px;
        padding: 10px 12px;
        font-size: 11.5px;
    }
    .cm-edit-modal__body {
        padding: 14px 16px;
        gap: 12px;
        /* Override the desktop fixed min-height which is too tall on phones
           with software keyboards visible. */
        min-height: 0 !important;
        max-height: none !important;
    }
    /* Edit-modal form controls — bump to comfortable 44px tap target & 16px
       font so iOS Safari doesn't auto-zoom on focus.
       Defeats `height: 34px; font-size: 0.82rem; padding: 7px 10px`. */
    .cm-edit-field input,
    .cm-edit-field select,
    .cm-edit-field textarea {
        height: 44px !important;          /* defeat height: 34px */
        font-size: 16px !important;       /* defeat 0.82rem, prevent iOS zoom */
        padding: 10px 12px !important;    /* defeat 7px 10px */
        border-radius: 10px;
    }
    .cm-edit-field textarea {
        height: auto !important;
        min-height: 88px;
    }
    .cm-edit-modal__foot {
        padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
        flex-wrap: wrap;
        gap: 8px;
    }
    .cm-edit-modal__foot .cm-modal-btn {
        flex: 1 1 auto;
        min-height: 44px;
        padding: 10px 14px;
        font-size: 13px;
    }

    /* ── Generic widget cards (JS-rendered via .cmw-card) ──
       Apply mobile-comfortable padding and radius. Specificity is one class
       so we don't need `!important` unless content-map.css adds more later. */
    .cm-page .cmw-card {
        padding: 12px;
        border-radius: 10px;
    }

    /* Generic widget rows that the JS sets to multi-column inline grids.
       We can't override inline grid-template-columns from CSS without
       `!important` + attribute selectors per variant — leave layout alone
       and just ensure they wrap and never cause horizontal page scroll. */
    .cm-page .cmw-row {
        max-width: 100%;
        min-width: 0;
    }

    /* ── Filter / search bars inside tab content — wrap, full-width inputs.
       Defeats `.cm-filter-bar input[type="text"] { width: 200px }`. */
    .cm-page .cm-filter-bar {
        flex-wrap: wrap;
        gap: 8px;
        align-items: stretch;
    }
    .cm-page .cm-filter-bar input[type="text"],
    .cm-page .cm-filter-bar select {
        width: 100% !important;           /* defeat width: 200px */
        flex: 1 1 100%;
        min-height: 44px;
        padding: 10px 12px;
        font-size: 16px;                  /* prevent iOS zoom */
        border-radius: 10px;
    }
    .cm-page .cm-filter-bar .cm-btn {
        flex: 1 1 auto;
        min-height: 40px;
        font-size: 12.5px;
        padding: 8px 14px;
    }

    /* ── Bulk action bar — keep compact, single row, scroll if needed ── */
    .cm-page .cm-bulk-bar {
        flex-wrap: wrap;
        font-size: 12px;
        padding: 8px 12px;
    }

    /* ── Big content tables — card-stack baseline.
       Scope is `.cm-page table:not(.opt-table)` so we don't break the
       global .opt-table styles. We can't label columns positionally because
       there are at least three different tables here (Pages, Engine,
       Costings, Reports, Tasks) with different column orders that are
       built dynamically by JS — labels are deferred to a follow-up.
       This gives a readable single-column stack until that's done. */
    .cm-page table:not(.opt-table),
    .cm-page .cm-table,
    .cm-page .cm-costings-table {
        display: block;
        width: 100% !important;
        white-space: normal !important;   /* defeat .cm-table white-space: nowrap */
        border-collapse: collapse;
    }
    .cm-page table:not(.opt-table) thead,
    .cm-page .cm-table thead,
    .cm-page .cm-costings-table thead {
        display: none;                    /* hide the header row */
    }
    .cm-page table:not(.opt-table) tbody,
    .cm-page .cm-table tbody,
    .cm-page .cm-costings-table tbody {
        display: block;
        width: 100%;
    }
    .cm-page table:not(.opt-table) tbody tr,
    .cm-page .cm-table tbody tr,
    .cm-page .cm-costings-table tbody tr {
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 10px 12px;
        margin-bottom: 8px;
        background: var(--paper-2, var(--surface-1));
        border: 1px solid var(--rule, var(--border-subtle));
        border-radius: 10px;
    }
    .cm-page table:not(.opt-table) tbody td,
    .cm-page .cm-table tbody td,
    .cm-page .cm-costings-table tbody td {
        display: block;
        width: auto !important;           /* defeat any inline width */
        box-sizing: border-box;
        padding: 4px 0 !important;        /* defeat .cm-table td padding */
        border-bottom: none !important;   /* defeat .cm-table td border-bottom */
        font-size: 13px;
        text-align: left !important;      /* defeat .num text-align: right */
        white-space: normal;
        overflow-wrap: anywhere;
    }
    /* Labels driven by data-label attr (mobile-followup PR — data-label
       was added to each <td> in the JS row builders across 6 tables:
       Pages, Costings monthly, Costings full, Conflict pages, Topical
       silos docs, Reports recent published). Survives column reorders. */
    .cm-page table:not(.opt-table) tbody td[data-label]::before,
    .cm-page .cm-table tbody td[data-label]::before,
    .cm-page .cm-costings-table tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
    }
    /* Table-wrap on mobile — drop sticky max-height that would create a
       nested scroll inside the page scroll, and remove h-scroll since we
       card-stacked. */
    .cm-page .cm-table-wrap {
        max-height: none !important;     /* defeat max-height: calc(100vh - 260px) */
        overflow: visible !important;    /* defeat overflow-x: auto */
        border-radius: 10px;
    }
    /* The matrix table (City × Service) intentionally h-scrolls per its
       desktop design. Keep that behaviour — undo card-stack for it. */
    .cm-page .cm-matrix-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
        border-radius: 10px;
    }
    .cm-page .cm-matrix {
        display: table;                   /* re-establish table layout */
    }
    .cm-page .cm-matrix thead {
        display: table-header-group;
    }
    .cm-page .cm-matrix tbody {
        display: table-row-group;
    }
    .cm-page .cm-matrix tbody tr {
        display: table-row;
        grid-template-columns: none;
        gap: 0;
        padding: 0;
        margin: 0;
        background: transparent;
        border: none;
        border-radius: 0;
    }
    .cm-page .cm-matrix tbody td {
        display: table-cell;
        padding: 4px 8px !important;
        text-align: center !important;
        border: 1px solid var(--rule, var(--border-subtle));
    }
    .cm-page .cm-matrix tbody td:first-child {
        text-align: left !important;
    }

    /* ── Overview grids: keep the existing desktop responsive breakpoints
       (cm-stats-row → 2col @640, cm-kpi-hero → 2col @640) honest — they
       already adapt, just ensure their inner cards have mobile padding. */
    .cm-page .cm-stat-card,
    .cm-page .cm-info-card,
    .cm-page .cm-health,
    .cm-page .cm-brief,
    .cm-page .cm-kpi-card,
    .cm-page .cm-costings-card {
        padding: 12px;
        border-radius: 12px;
    }
    .cm-page .cm-stat-card .cm-stat-value,
    .cm-page .cm-kpi-value,
    .cm-page .cm-costings-card__value {
        font-size: 22px;
    }

    /* Inline-styled toolbar rows in JS-rendered panels (Reports, Tasks,
       Command Center) often use `display:flex; gap:...` with right-anchored
       buttons. Allow wrap so they don't push the page wider than 100%. */
    .cm-page .cm-tab-content > div[style*="display:flex"],
    .cm-page .cm-tab-content div[style*="display: flex"] {
        flex-wrap: wrap;
    }

    /* ── Cannibalization side panel → bottom sheet on mobile ──
       Desktop slides in from the right at 480px wide; that's wider than
       most phones. Convert to a full-width bottom sheet so the dismiss/
       merge buttons stay reachable. */
    .cm-cannibal-panel {
        width: 100% !important;           /* defeat width: 480px */
        max-width: 100% !important;       /* defeat max-width: 95vw */
        height: auto !important;          /* defeat height: 100vh */
        max-height: 92dvh;
        top: auto !important;             /* defeat top: 0 */
        bottom: 0;
        right: 0;
        left: 0;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
        border-left: none;
        border-top: 1px solid var(--rule, var(--border-subtle));
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .cm-cannibal-panel.open {
        transform: translateY(0);
    }
    .cm-cannibal-panel .ccp-actions {
        flex-wrap: wrap;
    }
    .cm-cannibal-panel .ccp-merge-btn,
    .cm-cannibal-panel .ccp-dismiss-btn {
        flex: 1 1 auto;
        min-height: 44px;
        font-size: 13px;
        padding: 10px 14px;
    }


    /* =============================================================================
       MOBILE: /company/content-map — Client Brain: header stacks, tabs scroll,
       modals → bottom-sheets, table baseline → card-stack
       -----------------------------------------------------------------------------
       Page is too large to fully audit; this rule-set targets the page shell
       (header / site-tabs / main-tabs / tab-content), the dropdown menu, the
       two known modals (`cm-modal-backdrop`, `cm-edit-modal`), and baseline
       card-stack behaviour for any `<table>` inside `.cm-page`. JS-rendered
       widget content (`.cmw-*`, `.cb-*`) gets broad-stroke comfort rules but
       column-by-column table labelling is deferred to a future pass.
       ============================================================================= */

    /* Page shell — defeat .cm-page padding: 1.5rem and ensure no horizontal
       scroll regardless of what JS renders inside. */
    .cm-page {
        padding: 12px 14px 32px !important; /* defeat .cm-page padding: 1.5rem */
        min-height: 100dvh;
        overflow-x: hidden;
    }

    /* ── Header ──
       Desktop: single horizontal row with `margin-left: auto` action cluster.
       Mobile: stack into 2 logical rows via flex-wrap. Title row takes full
       width, then badges flow, then the action cluster wraps onto its own line
       at full width. */
    .cm-page .cm-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 10px;
        margin-bottom: 12px;
    }
    .cm-page .cm-header .cm-back {
        font-size: 20px;
        line-height: 1;
        padding: 8px 4px;
        min-width: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .cm-page .cm-header h1 {
        font-family: var(--serif);
        font-size: 22px;
        line-height: 1.2;
        font-weight: 400;
        margin: 0;
        flex: 1 1 auto;
        min-width: 0;
        /* Allow the long client name to wrap rather than overflow. */
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .cm-page .cm-header h1 span.cm-client-name {
        display: inline;
    }
    .cm-page .cm-header .cm-badge {
        font-size: 10px;
        padding: 3px 8px;
        flex-shrink: 0;
    }
    /* Client-ID chip (inline-styled span next to the badge) — keep on title row,
       wrap allowed. */
    .cm-page .cm-header > span[title="Client ID — click to select"] {
        flex-shrink: 0;
        max-width: 100%;
    }
    /* Action cluster: the inline-styled wrapper `<div style="margin-left:auto">`
       holding Edit / Extend / dropdown. Defeat the right-anchor so it wraps to
       its own row at full width. */
    .cm-page .cm-header > div[style*="margin-left:auto"],
    .cm-page .cm-header > div[style*="margin-left: auto"] {
        margin-left: 0 !important;        /* defeat inline margin-left:auto */
        width: 100%;
        flex-basis: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    /* Extend/Edit buttons — bump to 40px tap target, comfortable padding.
       Defeats inline `padding: 6px 10px` and small font-size from
       content-map.css `.cm-extend-btn`. */
    .cm-page .cm-header .cm-extend-btn {
        min-height: 40px;
        padding: 8px 14px !important;     /* defeat inline padding overrides */
        font-size: 12.5px;
        border-radius: 10px;
        margin-left: 0 !important;        /* defeat .cm-extend-btn margin-left: auto */
        flex: 1 1 auto;
        justify-content: center;
        white-space: nowrap;
    }
    /* The three-dots button is special — keep it square and at the end. */
    .cm-page .cm-header .cmw-dropdown {
        flex: 0 0 auto;
        position: relative;
    }
    .cm-page .cm-header .cmw-dropdown > .cm-extend-btn {
        flex: 0 0 auto;
        min-width: 40px !important;
        width: 40px;
        padding: 8px 0 !important;
    }

    /* ── Multi-site tab bar — horizontal scroll, no wrap.
       Defeats `flex-wrap: wrap` from content-map.css line 1242. */
    .cm-page .cm-site-tabs {
        flex-wrap: nowrap !important;     /* defeat desktop flex-wrap: wrap */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
        padding: 4px;
        margin-bottom: 12px;
    }
    .cm-page .cm-site-tabs::-webkit-scrollbar { display: none; }
    .cm-page .cm-site-tab,
    .cm-page .cm-site-tab-add {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 10px 14px;
        font-size: 12px;
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
    }

    /* ── Main tabs — horizontal-scroll strip per HANDOFF §11.
       Desktop: flex with gap, rounded pill container. Mobile: scroll.
       Defeats no specific desktop rule; just adds overflow. */
    .cm-page .cm-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 2px;
        padding: 4px;
        margin-bottom: 12px;
        border-radius: 12px;
    }
    .cm-page .cm-tabs::-webkit-scrollbar { display: none; }
    .cm-page .cm-tab {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 10px 14px;
        font-size: 13px;
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
        border-radius: 8px;
    }

    /* ── Tab panel baseline ── */
    .cm-page .cm-tab-content {
        padding: 0;
    }
    .cm-page .cm-tab-content.active {
        padding: 12px 0 0 0;
    }

    /* ── Dropdown menu — fit within viewport.
       Defeats inline `style="right:0;left:auto"` (which is desktop-correct
       but on mobile the menu can still overflow the right edge with very
       wide content). Position relative to header action row. */
    .cm-page .cmw-dropdown-menu {
        right: 0 !important;
        left: auto !important;
        min-width: 220px;
        max-width: min(280px, calc(100vw - 28px));
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        /* Bottom-sheet-like elevation since this is the one place a shadow
           is allowed (per HANDOFF.md §4.5). */
        box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    }
    .cm-page .cmw-dropdown-menu .cmw-dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
        font-size: 14px;
        font-family: var(--sans);
    }

    /* ── Generic confirm/edit modal backdrop → bottom-sheet ──
       Desktop: centered dialog. Mobile: slide up from bottom, full width,
       rounded top corners only. Defeats `align-items: center` and
       `padding: 20px` on the backdrop. */
    .cm-modal-backdrop {
        align-items: flex-end !important; /* defeat align-items: center */
        padding: 0 !important;            /* defeat padding: 20px */
    }
    .cm-modal-backdrop .cm-modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0 !important; /* bottom-sheet corners */
        padding: 18px 16px calc(20px + env(safe-area-inset-bottom)) !important;
        max-height: 92dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .cm-modal-backdrop .cm-modal-title {
        font-size: 18px;
        font-family: var(--serif);
    }
    .cm-modal-backdrop .cm-modal-body {
        font-size: 15px;
        line-height: 1.5;
    }
    .cm-modal-backdrop .cm-modal-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .cm-modal-backdrop .cm-modal-btn {
        flex: 1 1 auto;
        min-height: 44px;
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 10px;
    }

    /* ── Edit Client modal → bottom-sheet ──
       Defeats `max-width: 780px`, `max-height: calc(100vh - 40px)`,
       `border-radius: 18px` (all four corners). */
    .cm-edit-modal {
        max-width: 100% !important;       /* defeat max-width: 780px */
        width: 100% !important;
        max-height: 92dvh !important;     /* defeat calc(100vh - 40px) */
        border-radius: 16px 16px 0 0 !important; /* bottom-sheet */
        margin-bottom: 0;
    }
    .cm-edit-modal__head {
        padding: 16px 16px 10px;
    }
    .cm-edit-modal__title {
        font-family: var(--serif);
        font-size: 20px;
    }
    .cm-edit-modal__close {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    /* Edit-modal sub-tabs strip — already overflow-x:auto in desktop CSS;
       just enlarge tap targets and hide scrollbar. */
    .cm-edit-modal__tabs {
        padding: 0 12px;
        gap: 4px;
        scrollbar-width: none;
    }
    .cm-edit-modal__tabs::-webkit-scrollbar { display: none; }
    .cm-edit-modal__tab {
        min-height: 40px;
        padding: 10px 12px;
        font-size: 11.5px;
    }
    .cm-edit-modal__body {
        padding: 14px 16px;
        gap: 12px;
        /* Override the desktop fixed min-height which is too tall on phones
           with software keyboards visible. */
        min-height: 0 !important;
        max-height: none !important;
    }
    /* Edit-modal form controls — bump to comfortable 44px tap target & 16px
       font so iOS Safari doesn't auto-zoom on focus.
       Defeats `height: 34px; font-size: 0.82rem; padding: 7px 10px`. */
    .cm-edit-field input,
    .cm-edit-field select,
    .cm-edit-field textarea {
        height: 44px !important;          /* defeat height: 34px */
        font-size: 16px !important;       /* defeat 0.82rem, prevent iOS zoom */
        padding: 10px 12px !important;    /* defeat 7px 10px */
        border-radius: 10px;
    }
    .cm-edit-field textarea {
        height: auto !important;
        min-height: 88px;
    }
    .cm-edit-modal__foot {
        padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
        flex-wrap: wrap;
        gap: 8px;
    }
    .cm-edit-modal__foot .cm-modal-btn {
        flex: 1 1 auto;
        min-height: 44px;
        padding: 10px 14px;
        font-size: 13px;
    }

    /* ── Generic widget cards (JS-rendered via .cmw-card) ──
       Apply mobile-comfortable padding and radius. Specificity is one class
       so we don't need `!important` unless content-map.css adds more later. */
    .cm-page .cmw-card {
        padding: 12px;
        border-radius: 10px;
    }

    /* Generic widget rows that the JS sets to multi-column inline grids.
       We can't override inline grid-template-columns from CSS without
       `!important` + attribute selectors per variant — leave layout alone
       and just ensure they wrap and never cause horizontal page scroll. */
    .cm-page .cmw-row {
        max-width: 100%;
        min-width: 0;
    }

    /* ── Filter / search bars inside tab content — wrap, full-width inputs.
       Defeats `.cm-filter-bar input[type="text"] { width: 200px }`. */
    .cm-page .cm-filter-bar {
        flex-wrap: wrap;
        gap: 8px;
        align-items: stretch;
    }
    .cm-page .cm-filter-bar input[type="text"],
    .cm-page .cm-filter-bar select {
        width: 100% !important;           /* defeat width: 200px */
        flex: 1 1 100%;
        min-height: 44px;
        padding: 10px 12px;
        font-size: 16px;                  /* prevent iOS zoom */
        border-radius: 10px;
    }
    .cm-page .cm-filter-bar .cm-btn {
        flex: 1 1 auto;
        min-height: 40px;
        font-size: 12.5px;
        padding: 8px 14px;
    }

    /* ── Bulk action bar — keep compact, single row, scroll if needed ── */
    .cm-page .cm-bulk-bar {
        flex-wrap: wrap;
        font-size: 12px;
        padding: 8px 12px;
    }

    /* ── Big content tables — card-stack baseline.
       Scope is `.cm-page table:not(.opt-table)` so we don't break the
       global .opt-table styles. We can't label columns positionally because
       there are at least three different tables here (Pages, Engine,
       Costings, Reports, Tasks) with different column orders that are
       built dynamically by JS — labels are deferred to a follow-up.
       This gives a readable single-column stack until that's done. */
    .cm-page table:not(.opt-table),
    .cm-page .cm-table,
    .cm-page .cm-costings-table {
        display: block;
        width: 100% !important;
        white-space: normal !important;   /* defeat .cm-table white-space: nowrap */
        border-collapse: collapse;
    }
    .cm-page table:not(.opt-table) thead,
    .cm-page .cm-table thead,
    .cm-page .cm-costings-table thead {
        display: none;                    /* hide the header row */
    }
    .cm-page table:not(.opt-table) tbody,
    .cm-page .cm-table tbody,
    .cm-page .cm-costings-table tbody {
        display: block;
        width: 100%;
    }
    .cm-page table:not(.opt-table) tbody tr,
    .cm-page .cm-table tbody tr,
    .cm-page .cm-costings-table tbody tr {
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 10px 12px;
        margin-bottom: 8px;
        background: var(--paper-2, var(--surface-1));
        border: 1px solid var(--rule, var(--border-subtle));
        border-radius: 10px;
    }
    .cm-page table:not(.opt-table) tbody td,
    .cm-page .cm-table tbody td,
    .cm-page .cm-costings-table tbody td {
        display: block;
        width: auto !important;           /* defeat any inline width */
        box-sizing: border-box;
        padding: 4px 0 !important;        /* defeat .cm-table td padding */
        border-bottom: none !important;   /* defeat .cm-table td border-bottom */
        font-size: 13px;
        text-align: left !important;      /* defeat .num text-align: right */
        white-space: normal;
        overflow-wrap: anywhere;
    }
    /* Labels driven by data-label attr (mobile-followup PR — data-label
       was added to each <td> in the JS row builders across 6 tables:
       Pages, Costings monthly, Costings full, Conflict pages, Topical
       silos docs, Reports recent published). Survives column reorders. */
    .cm-page table:not(.opt-table) tbody td[data-label]::before,
    .cm-page .cm-table tbody td[data-label]::before,
    .cm-page .cm-costings-table tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-family: var(--sans);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 2px;
    }
    /* Table-wrap on mobile — drop sticky max-height that would create a
       nested scroll inside the page scroll, and remove h-scroll since we
       card-stacked. */
    .cm-page .cm-table-wrap {
        max-height: none !important;     /* defeat max-height: calc(100vh - 260px) */
        overflow: visible !important;    /* defeat overflow-x: auto */
        border-radius: 10px;
    }
    /* The matrix table (City × Service) intentionally h-scrolls per its
       desktop design. Keep that behaviour — undo card-stack for it. */
    .cm-page .cm-matrix-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
        border-radius: 10px;
    }
    .cm-page .cm-matrix {
        display: table;                   /* re-establish table layout */
    }
    .cm-page .cm-matrix thead {
        display: table-header-group;
    }
    .cm-page .cm-matrix tbody {
        display: table-row-group;
    }
    .cm-page .cm-matrix tbody tr {
        display: table-row;
        grid-template-columns: none;
        gap: 0;
        padding: 0;
        margin: 0;
        background: transparent;
        border: none;
        border-radius: 0;
    }
    .cm-page .cm-matrix tbody td {
        display: table-cell;
        padding: 4px 8px !important;
        text-align: center !important;
        border: 1px solid var(--rule, var(--border-subtle));
    }
    .cm-page .cm-matrix tbody td:first-child {
        text-align: left !important;
    }

    /* ── Overview grids: keep the existing desktop responsive breakpoints
       (cm-stats-row → 2col @640, cm-kpi-hero → 2col @640) honest — they
       already adapt, just ensure their inner cards have mobile padding. */
    .cm-page .cm-stat-card,
    .cm-page .cm-info-card,
    .cm-page .cm-health,
    .cm-page .cm-brief,
    .cm-page .cm-kpi-card,
    .cm-page .cm-costings-card {
        padding: 12px;
        border-radius: 12px;
    }
    .cm-page .cm-stat-card .cm-stat-value,
    .cm-page .cm-kpi-value,
    .cm-page .cm-costings-card__value {
        font-size: 22px;
    }

    /* Inline-styled toolbar rows in JS-rendered panels (Reports, Tasks,
       Command Center) often use `display:flex; gap:...` with right-anchored
       buttons. Allow wrap so they don't push the page wider than 100%. */
    .cm-page .cm-tab-content > div[style*="display:flex"],
    .cm-page .cm-tab-content div[style*="display: flex"] {
        flex-wrap: wrap;
    }

    /* ── Cannibalization side panel → bottom sheet on mobile ──
       Desktop slides in from the right at 480px wide; that's wider than
       most phones. Convert to a full-width bottom sheet so the dismiss/
       merge buttons stay reachable. */
    .cm-cannibal-panel {
        width: 100% !important;           /* defeat width: 480px */
        max-width: 100% !important;       /* defeat max-width: 95vw */
        height: auto !important;          /* defeat height: 100vh */
        max-height: 92dvh;
        top: auto !important;             /* defeat top: 0 */
        bottom: 0;
        right: 0;
        left: 0;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
        border-left: none;
        border-top: 1px solid var(--rule, var(--border-subtle));
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .cm-cannibal-panel.open {
        transform: translateY(0);
    }
    .cm-cannibal-panel .ccp-actions {
        flex-wrap: wrap;
    }
    .cm-cannibal-panel .ccp-merge-btn,
    .cm-cannibal-panel .ccp-dismiss-btn {
        flex: 1 1 auto;
        min-height: 44px;
        font-size: 13px;
        padding: 10px 14px;
    }

    /* /company/content-engine polish (mobile-followup PR — resolves the
       three deferred items from PR #39) */

    /* A. Bootstrap dropdown menu sizing — scoped to .ce-page so it
       doesn't leak globally. The "More" dropdown is Popper-portaled,
       so we anchor on the .dropdown-menu itself rather than .ce-page
       descendant, but check for a dropdown class that .ce-page emits.
       Bootstrap portals append to body so .ce-page parent selector
       won't work; we instead target the data-bs-toggle source via
       a globally-scoped but narrow .dropdown-menu rule that's safe
       at ≤767.98px because all dropdowns benefit from larger tap
       targets on mobile. */
    body .dropdown-menu .dropdown-item {
        font-size: 14px;
        min-height: 44px;
        padding: 10px 16px;
        display: flex;
        align-items: center;
    }

    /* B. Live/Pause/Resume/X cluster — keep on same row as client name
       where possible, wrap as a single unit when not. The template
       already puts the cluster in its own flex parent at line 187;
       these rules guarantee the unit-wrap behaviour on mobile. */
    .ce-page #ceDetailPanel > div[style*="border-bottom:1px solid var(--border-200)"][style*="justify-content:space-between"] {
        flex-wrap: wrap !important;       /* defeat inline (no flex-wrap means default nowrap) */
        gap: 6px;
        row-gap: 8px;
    }
    .ce-page #ceDetailPanel > div[style*="justify-content:space-between"] > div[style*="gap:0.35rem"] {
        flex-shrink: 0;
        flex-wrap: nowrap;                /* cluster stays as a unit */
    }
    .ce-page #ceDetailPanel > div[style*="justify-content:space-between"] > div[style*="gap:0.35rem"] > .btn,
    .ce-page #ceDetailPanel > div[style*="justify-content:space-between"] > div[style*="gap:0.35rem"] > button {
        min-height: 32px;
        font-size: 11px !important;       /* defeat inline 0.6rem */
        padding: 6px 10px !important;     /* defeat inline 2px 8px */
    }

    /* C. Page-detail backdrop (added by ceShowPageDetail in mobile-
       followup PR). On mobile the panel is a full-width bottom-sheet,
       so dim the page behind it for visual focus. */
    #cePagePanelBackdrop {
        background: rgba(20, 18, 15, 0.42) !important;
        z-index: 998;
    }

    /* ==========================================================================
       Bot Activity panel — desktop slide-out → mobile bottom-sheet
       --------------------------------------------------------------------------
       Triggered from topbar bi-cpu button. Panel is <aside id="botPanel"> at
       base.html:576. Desktop slides from right: 420px wide, top:0, right:-440px
       → right:0 on .open. Mobile flips to a full-width bottom-sheet using
       translateY so the sheet behaves correctly on small screens.

       Toggle class: .open (added by toggleBotStatus in base.html:945).
       Backdrop tap-to-dismiss is already wired (overlay onclick → closeBotPanel).
       ========================================================================== */

    /* Overlay backdrop — slight dim so the sheet has visual focus on mobile */
    .bot-panel-overlay.open {
        background: rgba(20, 18, 15, 0.42) !important;   /* defeat features.css rgba(0,0,0,0.3) */
    }

    /* Panel: bottom-sheet positioning */
    aside.bot-panel {
        top: auto !important;                            /* defeat features.css top:0 */
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;                             /* defeat features.css right:-440px (desktop hidden) and .open right:0 */
        width: 100% !important;                          /* defeat features.css width:420px */
        max-width: 100% !important;                      /* defeat features.css max-width:90vw */
        height: 92dvh !important;
        max-height: 92dvh;
        border-left: none !important;                    /* defeat features.css border-left */
        border-top: 1px solid var(--border-200);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 24px rgba(0,0,0,0.18);
        transform: translateY(100%);
        transition: transform 0.25s cubic-bezier(0.4,0,0.2,1) !important;  /* defeat features.css transition:right */
        padding-bottom: env(safe-area-inset-bottom);
    }
    aside.bot-panel.open {
        transform: translateY(0);
    }

    /* Header: comfortable touch close button */
    .bot-panel-header {
        padding: 16px 16px 12px !important;              /* defeat features.css 14px 16px */
        font-size: 15px !important;                      /* defeat features.css 0.88rem */
    }
    .bot-panel-close {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.2rem !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Filters: stack rows, make every control 44px tall with 15px font
       (no iOS zoom on focus). The template inlines style="..." on each
       input/select/date, so !important is needed on every override. */
    .bot-panel-filters {
        padding: 12px 14px !important;                   /* defeat features.css 10px 16px */
        gap: 10px !important;                            /* defeat features.css 6px */
    }
    .bot-filter-row {
        gap: 8px !important;                             /* defeat features.css 6px */
        flex-wrap: wrap;
    }
    .bot-panel-filters #botClientSearch {
        flex: 1 1 100%;
        min-height: 44px;
        font-size: 15px !important;                      /* defeat inline 0.72rem (iOS zoom) */
        padding: 10px 12px 10px 32px !important;         /* defeat inline 5px 8px 5px 26px */
    }
    .bot-panel-filters #botPanelFilter {
        flex: 1 1 100%;
        min-height: 44px;
        font-size: 15px !important;                      /* defeat inline 0.72rem */
        padding: 10px 12px !important;                   /* defeat inline 5px 6px */
        min-width: 0 !important;                         /* defeat inline min-width:85px */
    }
    .bot-panel-filters #botDateFrom,
    .bot-panel-filters #botDateTo {
        min-height: 44px;
        font-size: 15px !important;                      /* defeat inline 0.7rem */
        padding: 10px 12px !important;                   /* defeat inline 4px 6px */
        flex: 1;
    }
    .bot-panel-filters .bot-filter-row > span {
        font-size: 12px !important;                      /* defeat inline 0.68rem */
        color: var(--text-400);
    }
    .bot-panel-filters .bot-filter-row > button[onclick*="clearBotFilters"] {
        min-width: 44px;
        min-height: 44px;
        font-size: 1rem !important;                      /* defeat inline 0.78rem */
        padding: 8px !important;                         /* defeat inline 2px 4px */
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .bot-panel-filters .bot-filter-input-wrap > i {
        font-size: 12px !important;                      /* defeat inline 0.68rem (search icon stays prominent enough) */
        left: 10px !important;                           /* match new padding */
    }
    .bot-filter-summary {
        font-size: 12px !important;                      /* defeat features.css 0.65rem */
    }

    /* Agents row: chips can stay flex-wrap, just bigger */
    .bot-panel-agents {
        padding: 12px 14px !important;
        gap: 6px !important;
    }
    .bot-agent-chip {
        padding: 6px 12px !important;                    /* defeat features.css 3px 10px */
        font-size: 12px !important;                      /* defeat features.css 0.68rem */
        min-height: 32px;
    }

    /* Task list: comfortable padding on each task. .bot-panel-list keeps
       its overflow-y:auto (the sheet itself is fixed height, list scrolls
       inside that — correct UX). */
    .bot-task-item {
        padding: 14px 14px !important;                   /* defeat features.css 12px 16px */
    }
    .bot-task-title {
        font-size: 14px !important;                      /* defeat features.css 0.8rem */
    }
    .bot-task-title .task-status {
        font-size: 10.5px !important;                    /* defeat features.css 0.62rem */
        padding: 3px 8px !important;                     /* defeat features.css 1px 6px */
    }
    .bot-task-meta {
        font-size: 12px !important;                      /* defeat features.css 0.7rem */
    }
    .bot-task-chevron {
        font-size: 12px !important;                      /* defeat features.css 0.7rem */
    }
    .bot-task-expand {
        font-size: 13px !important;                      /* defeat features.css 0.74rem */
    }
    .bot-task-output {
        font-size: 12px !important;                      /* defeat features.css 0.72rem */
        max-height: none !important;                     /* defeat features.css 300px — let it flow naturally inside the sheet */
    }
    .bot-panel-empty {
        font-size: 14px !important;                      /* defeat features.css 0.82rem */
        padding: 48px 16px !important;                   /* defeat features.css 40px 16px */
    }

    /* ── Inbox Kanban board → stack columns vertically on phones ──────────
       The desktop board is a 5-wide grid (repeat(5, minmax(240px,1fr)) +
       overflow-x:auto) that runs off-screen on a phone. Stack the columns
       full-width instead — each status as its own section — so there's no
       horizontal scrolling. Targets #inboxBoard because the desktop
       .inbox-board rule lives in an inbox.html <style> that loads after this
       file; the id keeps us winning regardless of source order. */
    #inboxBoard.inbox-board {
        grid-template-columns: 1fr !important;           /* defeat inbox.html repeat(5, …) */
        overflow-x: visible !important;                  /* defeat inbox.html overflow-x:auto — no sideways scroll */
        gap: 10px !important;
    }
    #inboxBoard .inbox-board-column {
        min-height: 0 !important;                        /* defeat inbox.html 220px so empty columns aren't tall */
    }

    } /* end @media (max-width: 767.98px) */
