@media (max-width: 900px) {
  body.xl-mobile-cross-account-detail {
    --xl-ink: #082c36;
    --xl-ink-soft: #123f48;
    --xl-gold: #c49748;
    --xl-ivory: #f5f1e9;
    --xl-surface: #fffdf8;
    --xl-line: #ddd4c5;
    --xl-text: #162d32;
    --xl-muted: #6b7b7b;
    background: var(--xl-ivory);
    color: var(--xl-text);
  }

  body.xl-mobile-cross-account-detail .mobile-shell,
  body.xl-mobile-cross-account-detail .mobile-content,
  body.xl-mobile-cross-account-detail main {
    background: var(--xl-ivory) !important;
  }

  body.xl-mobile-cross-account-detail .mobile-campaigns {
    gap: 8px !important;
    padding-bottom: 76px;
  }

  body.xl-mobile-cross-account-detail .page-title {
    min-height: 50px;
    padding: 5px 2px 7px;
    border-bottom: 1px solid rgba(196, 151, 72, .42);
  }

  body.xl-mobile-cross-account-detail .page-title h1 {
    margin: 0 !important;
    color: var(--xl-ink);
    font-size: 22px !important;
    letter-spacing: -.02em;
  }

  body.xl-mobile-cross-account-detail .page-title small {
    color: var(--xl-muted) !important;
  }

  body.xl-mobile-cross-account-detail .level-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 4px !important;
    padding: 4px !important;
    border: 1px solid rgba(196, 151, 72, .46) !important;
    border-radius: 14px !important;
    background: rgba(255, 253, 248, .96) !important;
    box-shadow: 0 6px 18px rgba(8, 44, 54, .06) !important;
  }

  body.xl-mobile-cross-account-detail .level-tabs button {
    position: relative;
    min-width: 0;
    height: 44px !important;
    padding: 0 6px !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    background: rgba(245, 241, 233, .72) !important;
    color: var(--xl-ink-soft) !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    letter-spacing: .01em;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  }

  body.xl-mobile-cross-account-detail .level-tabs button.active {
    border-color: #173f47 !important;
    background: linear-gradient(180deg, #123f48 0%, var(--xl-ink) 100%) !important;
    color: #fff !important;
    box-shadow: 0 5px 13px rgba(8, 44, 54, .22), inset 0 -3px 0 var(--xl-gold) !important;
    transform: translateY(-1px);
  }

  body.xl-mobile-cross-account-detail .level-tabs button:focus-visible {
    outline: 2px solid rgba(196, 151, 72, .72);
    outline-offset: 2px;
  }

  body.xl-mobile-cross-account-detail .scope-hint {
    padding: 6px 9px !important;
    border-left-color: var(--xl-gold) !important;
    background: #fbf4e5 !important;
    color: #74551f !important;
  }

  body.xl-mobile-cross-account-detail .toolbar {
    gap: 6px !important;
    scrollbar-width: none;
  }

  body.xl-mobile-cross-account-detail .toolbar::-webkit-scrollbar { display: none; }

  body.xl-mobile-cross-account-detail .toolbar select,
  body.xl-mobile-cross-account-detail .search-box,
  body.xl-mobile-cross-account-detail .layout-tools {
    height: 38px !important;
    border-color: var(--xl-line) !important;
    background: var(--xl-surface) !important;
  }

  body.xl-mobile-cross-account-detail .search-box {
    width: min(210px, 58vw) !important;
  }

  body.xl-mobile-cross-account-detail .layout-tools {
    min-height: 38px;
    padding: 4px 7px !important;
  }

  body.xl-mobile-cross-account-detail .bulk-toolbar {
    position: fixed;
    right: 10px;
    bottom: calc(62px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 35;
    min-height: 50px;
    padding: 7px !important;
    border-color: rgba(196, 151, 72, .72) !important;
    border-radius: 13px !important;
    background: rgba(255, 253, 248, .97) !important;
    box-shadow: 0 10px 30px rgba(8, 44, 54, .17);
    backdrop-filter: blur(12px);
  }

  body.xl-mobile-cross-account-detail .bulk-toolbar button {
    border-color: rgba(8, 44, 54, .17) !important;
    background: #fff !important;
    color: var(--xl-ink) !important;
  }

  body.xl-mobile-cross-account-detail .bulk-toolbar button:first-of-type {
    background: var(--xl-ink) !important;
    color: #fff !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll {
    max-height: none !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: 0 !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll thead { display: none !important; }
  body.xl-mobile-cross-account-detail .table-scroll tbody {
    display: grid !important;
    gap: 8px;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row {
    display: grid !important;
    grid-template-columns: 38px 48px repeat(5, minmax(0, 1fr));
    grid-template-rows: auto auto;
    min-height: 118px;
    overflow: hidden;
    border: 1px solid var(--xl-line);
    border-radius: 14px;
    background: var(--xl-surface);
    box-shadow: 0 4px 14px rgba(8, 44, 54, .06);
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td {
    position: static !important;
    display: none;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    padding: 8px 6px !important;
    border: 0 !important;
    background: transparent !important;
    color: inherit;
    white-space: normal !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td:nth-child(1),
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td:nth-child(2),
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td:nth-child(3),
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-orders,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-cpa,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-spend,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-roi,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-budget {
    display: block;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    padding-left: 12px !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-name {
    position: relative !important;
    grid-column: 3 / -1;
    grid-row: 1;
    min-height: 54px;
    padding: 10px 58px 7px 3px !important;
  }

  body.xl-mobile-cross-account-detail .xl-mobile-row-expand {
    position: absolute;
    top: 12px;
    right: 10px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(196, 151, 72, .55);
    border-radius: 999px;
    background: #fff9eb;
    color: #7a571f;
    font-size: 11px;
    font-weight: 800;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-orders,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-cpa,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-spend,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-roi,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-budget {
    grid-row: 2;
    padding: 8px 4px 10px !important;
    border-top: 1px solid rgba(8, 44, 54, .08) !important;
    text-align: center;
    font-weight: 850;
  }

  body.xl-mobile-cross-account-detail .xl-cell-orders { grid-column: 3; }
  body.xl-mobile-cross-account-detail .xl-cell-cpa { grid-column: 4; }
  body.xl-mobile-cross-account-detail .xl-cell-spend { grid-column: 5; }
  body.xl-mobile-cross-account-detail .xl-cell-roi { grid-column: 6; color: #916315 !important; }
  body.xl-mobile-cross-account-detail .xl-cell-budget { grid-column: 7; }

  body.xl-mobile-cross-account-detail .xl-mobile-detail-row [data-xl-label]::before {
    content: attr(data-xl-label);
    display: block;
    margin-bottom: 3px;
    color: var(--xl-muted);
    font-size: 9px;
    font-weight: 650;
  }

  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded {
    grid-template-columns: 38px 48px repeat(5, minmax(0, 1fr));
    grid-template-rows: auto auto auto auto;
    border-color: rgba(196, 151, 72, .68);
    box-shadow: 0 8px 22px rgba(8, 44, 54, .1);
  }

  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-cpc,
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-aov,
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-strategy,
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-bid,
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-product,
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-action {
    display: block;
    grid-row: 3;
    min-width: 0;
    padding: 6px 4px !important;
    border-top: 1px solid rgba(196, 151, 72, .25) !important;
    text-align: center;
    font-size: 11px;
    line-height: 1.25;
  }

  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-cpc { grid-column: 3; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-aov { grid-column: 4; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-strategy { grid-column: 5; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-bid { grid-column: 6; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-product { grid-column: 7; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-product {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-action {
    grid-column: 3 / -1;
    grid-row: 4;
    min-height: 38px;
    padding: 5px 8px !important;
    text-align: right;
  }

  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-action button,
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-action a {
    min-height: 30px;
    padding-block: 4px;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.tone-green { background: #d7efe2 !important; }
  body.xl-mobile-cross-account-detail .table-scroll tr.tone-blue { background: #dce9f7 !important; }
  body.xl-mobile-cross-account-detail .table-scroll tr.tone-purple { background: #e9e0f3 !important; }
  body.xl-mobile-cross-account-detail .table-scroll tr.tone-orange { background: #f7e2c3 !important; }
  body.xl-mobile-cross-account-detail .table-scroll tr.tone-red { background: #f4d5d2 !important; }
  body.xl-mobile-cross-account-detail .table-scroll tr.tone-cyan { background: #d8edef !important; }
  body.xl-mobile-cross-account-detail .table-scroll tr.tone-pink { background: #f2dfe8 !important; }
  body.xl-mobile-cross-account-detail .table-scroll tr.tone-paused {
    background: #172026 !important;
    color: #fff !important;
    border-color: #303a3f;
  }

  body.xl-mobile-cross-account-detail .empty-copy {
    border: 1px dashed var(--xl-line);
    border-radius: 14px;
    background: var(--xl-surface);
  }
}

/* v2: compact account header and viewport-safe mobile cards. */
@media (max-width: 900px) {
  body.xl-mobile-cross-account-detail .mobile-header {
    gap: 6px !important;
    padding: 8px 12px !important;
  }

  body.xl-mobile-cross-account-detail .context-toggle {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    min-height: 42px !important;
    padding: 6px 9px 6px 11px !important;
    border: 1px solid #d7e0ea !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 3px 12px rgba(8, 44, 54, .05) !important;
  }

  body.xl-mobile-cross-account-detail .context-toggle > span {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 7px !important;
    min-width: 0 !important;
    text-align: left !important;
  }

  body.xl-mobile-cross-account-detail .context-toggle b,
  body.xl-mobile-cross-account-detail .context-toggle small,
  body.xl-mobile-cross-account-detail .context-toggle em {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body.xl-mobile-cross-account-detail .context-toggle b {
    color: var(--xl-ink) !important;
    font-size: 14px !important;
  }

  body.xl-mobile-cross-account-detail .context-toggle small {
    color: var(--xl-muted) !important;
    font-size: 11px !important;
  }

  body.xl-mobile-cross-account-detail .context-toggle em {
    padding: 4px 8px !important;
    border-radius: 999px !important;
    background: #eef4fa !important;
    color: #245d91 !important;
    font-size: 10px !important;
    font-style: normal !important;
    font-weight: 800 !important;
  }

  body.xl-mobile-cross-account-detail .context-panel {
    margin-top: 2px !important;
    padding: 10px !important;
    border: 1px solid #d7e0ea !important;
    border-radius: 13px !important;
    background: #fff !important;
    box-shadow: 0 10px 26px rgba(8, 44, 54, .1) !important;
  }

  body.xl-mobile-cross-account-detail .layout-tools {
    display: none !important;
  }

  body.xl-mobile-cross-account-detail .mobile-campaigns,
  body.xl-mobile-cross-account-detail .table-scroll,
  body.xl-mobile-cross-account-detail .table-scroll table,
  body.xl-mobile-cross-account-detail .table-scroll tbody {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll {
    overflow-x: hidden !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: 44px repeat(5, minmax(0, 1fr)) !important;
    grid-template-rows: minmax(58px, auto) minmax(54px, auto) !important;
    box-sizing: border-box !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td * {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td:nth-child(1) {
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: center !important;
    padding-left: 10px !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > td:nth-child(2) {
    grid-column: 1 !important;
    grid-row: 2 !important;
    align-self: center !important;
    padding-left: 8px !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-name {
    grid-column: 2 / -1 !important;
    grid-row: 1 !important;
    min-height: 58px !important;
    padding: 10px 66px 7px 4px !important;
    overflow: hidden !important;
  }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-name > * {
    display: block !important;
    max-width: 100% !important;
  }

  body.xl-mobile-cross-account-detail .xl-cell-orders { grid-column: 2 !important; }
  body.xl-mobile-cross-account-detail .xl-cell-cpa { grid-column: 3 !important; }
  body.xl-mobile-cross-account-detail .xl-cell-spend { grid-column: 4 !important; }
  body.xl-mobile-cross-account-detail .xl-cell-roi { grid-column: 5 !important; }
  body.xl-mobile-cross-account-detail .xl-cell-budget { grid-column: 6 !important; }

  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-orders,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-cpa,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-spend,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-roi,
  body.xl-mobile-cross-account-detail .table-scroll tr.xl-mobile-detail-row > .xl-cell-budget {
    grid-row: 2 !important;
    min-width: 0 !important;
    padding: 8px 2px 9px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 12px !important;
  }

  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded {
    grid-template-columns: 44px repeat(5, minmax(0, 1fr)) !important;
    grid-template-rows: minmax(58px, auto) minmax(54px, auto) auto auto !important;
  }

  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-cpc { grid-column: 2 !important; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-aov { grid-column: 3 !important; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-strategy { grid-column: 4 !important; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-bid { grid-column: 5 !important; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-product { grid-column: 6 !important; }
  body.xl-mobile-cross-account-detail .xl-mobile-detail-row.is-expanded > .xl-cell-action { grid-column: 2 / -1 !important; }

  body.xl-mobile-cross-account-detail .bulk-toolbar {
    right: 8px !important;
    left: 8px !important;
    display: flex !important;
    gap: 5px !important;
    max-width: calc(100vw - 16px) !important;
    overflow-x: auto !important;
    box-sizing: border-box !important;
  }

  body.xl-mobile-cross-account-detail .bulk-toolbar button {
    flex: 0 0 auto !important;
    min-width: max-content !important;
  }
}
