/* ai page styles — owned by the ai page owner. Shared rules stay in ../pages.css (read-only for page owners). */
.ai-overview{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.ai-overview .stat{min-width:0;align-items:flex-start}
.ai-overview .stat-value{display:block;overflow-wrap:anywhere;font-size:var(--fs-20)}
.ai-overview .stat-value .money{font-size:var(--fs-20)}
.ai-tier-stat{width:100%;font:inherit;text-align:left;cursor:pointer;border:0}
.ai-tier-stat .stat-label{display:block}
.ai-tier-stat small{display:flex;align-items:center;gap:4px;margin-top:4px;font-size:var(--fs-12);color:var(--blue)}
.ai-earnings-note{margin:8px 2px 16px;line-height:1.6}
.ai-week-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:14px}
.ai-week-data{min-width:0}
.ai-week-actions .week-v b,.ai-week-actions .week-r b{font-size:var(--num-m)}
.ai-week-actions .week-foot{margin-top:12px}
.ai-week-actions .week-foot .fine{align-items:flex-start;font-size:var(--fs-13);line-height:1.6}
.ai-week-actions .week-foot .ico{flex:none;margin-top:2px}
.ai-exit-action{padding-top:12px;border-top:1px solid var(--hairline);display:flex;justify-content:flex-end}
.ai-exit-action .btn{width:auto;min-height:44px;height:auto;padding:10px 16px;font-size:var(--fs-14);white-space:normal;line-height:1.5}
.ai-settings-body,.ai-records-body{padding-top:20px}
.ai-records .fills-mod{padding:0;background:none;box-shadow:none;border:0}
.ai-records .sec{margin-top:0}
@container app (max-width:350px){
  .ai-overview{gap:8px}
  .ai-overview .stat{gap:8px;padding:12px 10px}
  .ai-overview .stat .itile{width:28px;height:28px}
  .ai-overview .stat-value,.ai-overview .stat-value .money{font-size:var(--fs-17)}
  .ai-week-actions{gap:12px;padding:16px}
}

/* fills table while another history page loads: keep the old rows, dimmed */
.fills-mod{transition:opacity .2s var(--ease-out, ease)}
.fills-mod.is-pending{opacity:.55;pointer-events:none}
/* fill rows open the linked order: keyboard focus is visible on the whole row */
.fills-mod tr[role="button"]:focus{outline:none}
.fills-mod tr[role="button"]:focus-visible td{background:rgba(21,101,242,.08)}
.fills-mod tr[role="button"]:focus-visible td:first-child{box-shadow:inset 3px 0 0 var(--blue)}
.fills-mod .ai-fail{color:var(--bad);font-weight:650}
/* unit + time-zone label beside the side chips: two short lines, right aligned */
.fills-bar > .fills-units{display:flex;flex-direction:column;align-items:flex-end;line-height:1.35;text-align:right}

/* inline errors (enrol CTA, prefs / exit sheets) */
.ai-err{margin-top:10px;text-align:left}

/* settings: why only new matching waits (LIVE off) */
.settings .reason{margin:-2px 0 10px}
/* model tags: a selected model that admin disabled */
.tag--off{color:var(--ink-3);background:transparent;box-shadow:inset 0 0 0 1px var(--hairline)}

/* weekly box: count across plans above this tier's limit */
.ai-week-over{margin:8px 0 0}

/* enrol: back to the closed plan's overview */
.ai-back{margin:-4px 0 6px}
.ai-back .lnk{margin-left:-4px}
/* enrol section headings never break mid-word (the hint for step 3 sits inside its card) */
.ai-sec h2{flex:none;white-space:nowrap}
.ai-sec > :not(h2){min-width:0;text-align:right}
.ai-pref-hint{margin:0 2px 10px}
/* tier tiles: weekly runs left / balance too low */
.tier-tile .tt-meta.is-left{color:var(--blue-ink);font-weight:600}
.tier-tile .tt-meta.is-warn{color:var(--warn);font-weight:650}
.tier-tile.is-dim:not(.on){background:rgba(255,255,255,.5);box-shadow:inset 0 0 0 1px var(--hairline)}
.tier-tile.is-dim:not(.on) .tt-lv,.tier-tile.is-dim:not(.on) .tt-min{color:var(--ink-3)}
.tier-grid + .field-msg{margin-top:10px}
/* quick amounts wrap instead of scrolling (the last chip was cut at 320) */
.page-ai .chips.quick{flex-wrap:wrap;overflow:visible;margin:10px 0 0;padding:4px 0 0}
/* CTA notes (no models / no runs left this week) sit just above the button */
.enrol-cta > .field-msg{margin:0 2px 10px}

/* enrol: model chips wrap instead of scrolling; long names never push the page wider.
   The chip stays overflow:visible so its ::after (44px hit area from components.css) is not clipped; the label span carries the ellipsis.
   Rows sit 10px apart so one row's hit area never covers the next row's chips. */
.pref-pick{row-gap:10px}
.pref-pick .chip{max-width:100%;white-space:nowrap;overflow:visible}
.pref-pick .chip .chip-txt{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
.pref-pick .chip .chip-note{flex:none;font-size:var(--fs-11);font-weight:650;color:var(--warn)}
.pref-pick .chip[aria-pressed="true"] .chip-note{color:rgba(255,255,255,.82)}

/* prefs sheet */
.ai-pf-hint{margin:0 2px 10px}
.ai-pf-gone{margin:0 0 12px}
.ai-nooffer{color:var(--warn);font-weight:600}

/* trade sheet: labels stay on one line, long values (source demand) wrap */
.sheet--trade .sheet-card .kv > span:first-child{flex:none;white-space:nowrap}
.sheet--trade .sheet-card .kv > :last-child{min-width:0;overflow-wrap:anywhere}
/* receipts: side label, then the full receipt id (never cut), then the time */
.sheet--trade .receipt .rc-copy b{white-space:normal}
.sheet--trade .receipt .rc-id{display:block;margin-top:2px;font-size:var(--fs-12);font-weight:600;line-height:1.35;color:var(--ink-2);word-break:break-all}
.sheet--trade .receipt .fine{display:block;margin-top:2px}
.sheet--trade .receipt .nw{white-space:nowrap}
/* narrow phones: the status pill drops under the receipt text so the id keeps a readable width */
@container app (max-width:350px){
  .sheet--trade .receipt{flex-wrap:wrap;row-gap:6px}
  .sheet--trade .receipt .rc-copy{flex:1 1 150px}
  .sheet--trade .receipt > .pill{margin-left:46px}
}

/* trade sheet: copy buttons beside order number and receipts.
   The glyph box stays 32px; the ::after extends the hit area to 44px on both axes and sits above the neighbouring rows / text
   (z-index) so the extension is not covered by later siblings. */
.receipt .icon-btn.mini{flex:none;margin:-6px -2px -6px -4px}
.sheet-card .kv .icon-btn.mini{margin:-8px -6px -8px 2px}
.sheet--trade .icon-btn.mini{position:relative;z-index:1}
.sheet--trade .icon-btn.mini::after{content:"";position:absolute;inset:-6px}
.ai-stat-note{margin:12px 2px;line-height:1.6}
.tier-table-scroll{max-width:100%;overflow-x:auto;margin-bottom:12px;overscroll-behavior-inline:contain}
.tier-table-scroll .tier-tbl{min-width:280px}
.tier-table-scroll th{white-space:normal;line-height:1.45}
.tier-table-scroll td:first-child .tag{display:table;margin-top:4px;padding:2px 4px;min-height:20px}
.execution-note{margin:10px 0 16px;font-size:var(--fs-13);color:var(--ink-3)}
.execution-note summary{display:flex;align-items:center;gap:6px;cursor:pointer;min-height:44px}
.execution-note p{margin:6px 0 12px;line-height:1.6}
.sheet--trade .receipt{flex-wrap:wrap;row-gap:8px}
.sheet--trade .receipt .rc-copy{flex:1 1 170px;min-width:0}
.sheet--trade .receipt .rc-id{word-break:normal;overflow-wrap:anywhere;line-height:1.6;user-select:all}
.sheet--trade .receipt > .pill{margin-left:auto}
