/* ═════════════════════════════════════════════════════════════════════════════
   AI OPTIMIZER — premium copilot surface. Fully scoped under #page-aiopt.
   Color language: purple=AI · green=recommended · blue=info · amber=warning ·
   red=critical · grey=historical. Dark/light via .aiopt-dark on the root.
   ═════════════════════════════════════════════════════════════════════════════ */

#page-aiopt {
  --ao-purple: #7C5CFC;  --ao-purple-dk: #6446E8; --ao-purple-bg: #F3F0FF;
  --ao-green:  #16A34A;  --ao-green-bg:  #ECFDF3;
  --ao-blue:   #2563EB;  --ao-blue-bg:   #EFF6FF;
  --ao-amber:  #D97706;  --ao-amber-bg:  #FFFBEB;
  --ao-red:    #DC2626;  --ao-red-bg:    #FEF2F2;
  --ao-grey:   #6B7280;  --ao-grey-bg:   #F3F4F6;
  --ao-bg: #F7F8FB; --ao-card: #FFFFFF; --ao-card2: #FAFBFE;
  --ao-border: #E7EAF3; --ao-border2: #DDE2EF;
  --ao-ink: #101828; --ao-body: #414B63; --ao-muted: #8A93A8;
  --ao-r: 18px; --ao-r-sm: 12px;
  --ao-shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 20px -6px rgba(16,24,40,.08);
  --ao-shadow-lg: 0 8px 30px -6px rgba(16,24,40,.16);
  --ao-tr: .18s cubic-bezier(.4,0,.2,1);
}
#page-aiopt .aiopt-dark, #page-aiopt.aiopt-dark, #aiopt-root.aiopt-dark {
  --ao-purple-bg: rgba(124,92,252,.14); --ao-green-bg: rgba(22,163,74,.14);
  --ao-blue-bg: rgba(37,99,235,.16);   --ao-amber-bg: rgba(217,119,6,.15);
  --ao-red-bg: rgba(220,38,38,.15);    --ao-grey-bg: rgba(107,114,128,.18);
  --ao-bg: #0E1116; --ao-card: #161B24; --ao-card2: #1B2130;
  --ao-border: #232B3B; --ao-border2: #2C3549;
  --ao-ink: #F2F4F8; --ao-body: #B9C1D4; --ao-muted: #6E7891;
  --ao-shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.5);
  --ao-shadow-lg: 0 10px 36px -6px rgba(0,0,0,.6);
}
#aiopt-root { background: var(--ao-bg); margin: -22px -24px -40px; padding: 22px 24px 60px; min-height: calc(100vh - 60px); color: var(--ao-body); font-size: 13.5px; transition: background var(--ao-tr); }

/* ── Animations ─────────────────────────────────────────────────────────────── */
@keyframes aoUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── List ⇄ Game screen transition (2026-08) ─────────────────────────────────── */
@keyframes aoPage { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
#aiopt-root .ao-page-in { animation: aoPage .28s cubic-bezier(.2, .7, .3, 1) both; }
#aiopt-root .ao-backbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--ao-card); border: 1px solid var(--ao-border);
  border-radius: var(--ao-r-lg, 14px); box-shadow: var(--ao-shadow, 0 1px 3px rgba(15,23,42,.06));
  position: sticky; top: 0; z-index: 5;
}
#aiopt-root .ao-back-title { font-size: 15px; font-weight: 800; color: var(--ao-ink); display: inline-flex; align-items: center; gap: 8px; }
/* Wider game cards on the AI list (needs room for Now/After × 3 metrics).
   Scoped to #aiopt-root — the ROAS tab's grid is untouched. */
#aiopt-root .ri-game-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* ── Game screen: hero + collapsible sections (2026-08) ─────────────────────── */
#aiopt-root .ao-hero { padding: 16px 18px; margin-bottom: 14px; }
#aiopt-root .ao-hero-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
#aiopt-root .ao-hero-actions { margin-left: auto; display: flex; gap: 8px; }
#aiopt-root .ao-hero-conf { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--ao-muted); }
#aiopt-root .ao-hero-conf-track { width: 54px; height: 5px; border-radius: 999px; background: var(--ao-grey-bg, rgba(120,120,140,.15)); overflow: hidden; display: inline-block; }
#aiopt-root .ao-hero-conf-track > span { display: block; height: 100%; border-radius: 999px; background: var(--ao-purple); }
#aiopt-root .ao-hero-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 10px; margin-bottom: 12px; }
#aiopt-root .ao-ht { border: 1px solid var(--ao-border); border-radius: 12px; background: var(--ao-card2); padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; transition: border-color .15s, box-shadow .15s; }
#aiopt-root .ao-ht:hover { border-color: var(--ao-border2, var(--ao-border)); box-shadow: 0 3px 10px rgba(15,23,42,.06); }
#aiopt-root .ao-ht-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#aiopt-root .ao-ht-l { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ao-muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#aiopt-root .ao-ht-l i { color: var(--ao-purple); font-size: 10px; }
#aiopt-root .ao-ht-t { font-size: 9.5px; font-weight: 600; color: var(--ao-muted); white-space: nowrap; opacity: .8; }
#aiopt-root .ao-ht-v { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
#aiopt-root .ao-ht-v0 { font-size: 14px; font-weight: 700; color: var(--ao-muted); }
#aiopt-root .ao-ht-v i { color: var(--ao-muted); font-size: 10px; opacity: .7; }
#aiopt-root .ao-ht-v1 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
#aiopt-root .ao-ht-foot { display: flex; align-items: center; gap: 8px; min-height: 18px; flex-wrap: wrap; }
#aiopt-root .ao-ht-chip { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
#aiopt-root .ao-ht-n { font-size: 10.5px; color: var(--ao-muted); line-height: 1.35; }
#aiopt-root .ao-hero-why { display: flex; gap: 10px; margin-top: 12px; padding: 11px 14px; border-radius: 11px; background: var(--ao-purple-bg); border-left: 3px solid var(--ao-purple); font-size: 12.5px; line-height: 1.65; color: var(--ao-body); }
#aiopt-root .ao-hero-why > i { color: var(--ao-purple); margin-top: 3px; }
#aiopt-root .ao-hero-why b { display: block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ao-purple); margin-bottom: 2px; }

/* "What to change" — compact multi-column change cards (RAISE / TEST / TRIM) */
#aiopt-root .ao-chg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
#aiopt-root .ao-chg { border: 1px solid var(--ao-border); border-left: 3px solid var(--chg, var(--ao-border)); border-radius: 10px; background: var(--ao-card2); padding: 10px 13px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
#aiopt-root .ao-chg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
#aiopt-root .ao-chg-goal { font-size: 12.5px; font-weight: 700; color: var(--ao-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#aiopt-root .ao-chg-tag { font-size: 10px; font-weight: 800; letter-spacing: .05em; white-space: nowrap; flex-shrink: 0; }
#aiopt-root .ao-chg-v { font-size: 13.5px; font-weight: 700; color: var(--ao-muted); white-space: nowrap; }
#aiopt-root .ao-chg-v i { font-size: 10px; opacity: .7; margin: 0 2px; }
#aiopt-root .ao-chg-v b { font-size: 14.5px; font-weight: 800; }
#aiopt-root .ao-chg-why { font-size: 11px; color: var(--ao-muted); line-height: 1.5; }
#aiopt-root .ao-folds { display: flex; flex-direction: column; gap: 12px; }
#aiopt-root .ao-fold { border: 1px solid var(--ao-border); border-radius: 14px; background: var(--ao-card); overflow: hidden; box-shadow: var(--ao-shadow, 0 1px 3px rgba(15,23,42,.05)); }
#aiopt-root .ao-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 13px 16px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ao-ink); user-select: none; }
#aiopt-root .ao-fold > summary::-webkit-details-marker { display: none; }
#aiopt-root .ao-fold > summary:hover { background: var(--ao-card2); }
#aiopt-root .ao-fold-sub { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 11.5px; color: var(--ao-muted); }
#aiopt-root .ao-fold-ch { margin-left: auto; color: var(--ao-muted); transition: transform .2s ease; }
#aiopt-root .ao-fold[open] > summary .ao-fold-ch { transform: rotate(180deg); }
#aiopt-root .ao-fold-body { padding: 2px 16px 16px; }
/* Inside a fold the card frame + its own title are redundant — the fold provides both. */
#aiopt-root .ao-fold .ao-card { border: none; background: transparent; box-shadow: none; padding: 0; }
#aiopt-root .ao-fold .ao-block-title { display: none; }
@keyframes aoShimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes aoPulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes aoBar { from { width: 0; } }
#aiopt-root .ao-in { animation: aoUp .4s cubic-bezier(.2,.7,.3,1) both; }

/* ── Generic card ───────────────────────────────────────────────────────────── */
#aiopt-root .ao-card {
  background: var(--ao-card); border: 1px solid var(--ao-border);
  border-radius: var(--ao-r); box-shadow: var(--ao-shadow);
  transition: box-shadow var(--ao-tr), transform var(--ao-tr), border-color var(--ao-tr);
}
#aiopt-root .ao-card.ao-hover:hover { box-shadow: var(--ao-shadow-lg); transform: translateY(-2px); border-color: var(--ao-border2); }
#aiopt-root .ao-sec { margin-top: 26px; }
#aiopt-root .ao-sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
#aiopt-root .ao-sec-title { font-size: 16px; font-weight: 800; color: var(--ao-ink); letter-spacing: -.01em; }
#aiopt-root .ao-sec-sub { font-size: 12px; color: var(--ao-muted); }

/* ── Pills / chips / badges ─────────────────────────────────────────────────── */
#aiopt-root .ao-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
#aiopt-root .ao-pill.p-purple { background: var(--ao-purple-bg); color: var(--ao-purple); }
#aiopt-root .ao-pill.p-green  { background: var(--ao-green-bg);  color: var(--ao-green); }
#aiopt-root .ao-pill.p-blue   { background: var(--ao-blue-bg);   color: var(--ao-blue); }
#aiopt-root .ao-pill.p-amber  { background: var(--ao-amber-bg);  color: var(--ao-amber); }
#aiopt-root .ao-pill.p-red    { background: var(--ao-red-bg);    color: var(--ao-red); }
#aiopt-root .ao-pill.p-grey   { background: var(--ao-grey-bg);   color: var(--ao-grey); }
#aiopt-root .ao-preview { border: 1px dashed var(--ao-purple); background: transparent; color: var(--ao-purple); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
#aiopt-root .ao-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--ao-border2); background: var(--ao-card);
  color: var(--ao-ink); font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: all var(--ao-tr); user-select: none;
}
#aiopt-root .ao-btn:hover { border-color: var(--ao-purple); color: var(--ao-purple); transform: translateY(-1px); }
#aiopt-root .ao-btn:active { transform: translateY(0); }
#aiopt-root .ao-btn.b-primary { background: linear-gradient(135deg, var(--ao-purple), var(--ao-purple-dk)); border: none; color: #fff; box-shadow: 0 4px 14px -4px rgba(124,92,252,.5); }
#aiopt-root .ao-btn.b-primary:hover { filter: brightness(1.07); color: #fff; }
#aiopt-root .ao-btn.b-green { background: var(--ao-green); border: none; color: #fff; }
#aiopt-root .ao-btn.b-green:hover { filter: brightness(1.08); color: #fff; }
#aiopt-root .ao-btn.b-ghost { background: transparent; }
#aiopt-root .ao-btn.b-sm { height: 28px; padding: 0 10px; font-size: 11.5px; border-radius: 8px; }
#aiopt-root .ao-btn.b-danger:hover { border-color: var(--ao-red); color: var(--ao-red); }
#aiopt-root .ao-kbd { font-size: 9.5px; background: var(--ao-grey-bg); color: var(--ao-muted); border-radius: 4px; padding: 1px 5px; margin-left: 4px; font-weight: 700; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
#aiopt-root .ao-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 22px; border-radius: var(--ao-r); background: linear-gradient(120deg, var(--ao-card) 55%, var(--ao-purple-bg)); border: 1px solid var(--ao-border); box-shadow: var(--ao-shadow); }
#aiopt-root .ao-logo { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--ao-purple), var(--ao-purple-dk)); color: #fff; font-size: 20px; box-shadow: 0 6px 18px -4px rgba(124,92,252,.55); }
#aiopt-root .ao-h-title { font-size: 19px; font-weight: 800; color: var(--ao-ink); letter-spacing: -.02em; }
#aiopt-root .ao-h-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
#aiopt-root .ao-h-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }
#aiopt-root .ao-health-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ao-green); animation: aoPulse 2.2s infinite; }

/* Preview banner */
#aiopt-root .ao-banner { display: flex; gap: 10px; align-items: center; margin-top: 14px; padding: 10px 16px; border-radius: var(--ao-r-sm); background: var(--ao-purple-bg); border: 1px dashed var(--ao-purple); color: var(--ao-body); font-size: 12px; }
#aiopt-root .ao-banner i { color: var(--ao-purple); }

/* ── KPI grid ───────────────────────────────────────────────────────────────── */
#aiopt-root .ao-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; }
#aiopt-root .ao-kpi { padding: 16px 18px; position: relative; overflow: hidden; }
#aiopt-root .ao-kpi-ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; margin-bottom: 10px; }
#aiopt-root .ao-kpi-v { font-size: 22px; font-weight: 800; color: var(--ao-ink); letter-spacing: -.02em; line-height: 1.1; }
#aiopt-root .ao-kpi-l { font-size: 11px; font-weight: 600; color: var(--ao-muted); margin-top: 4px; }
#aiopt-root .ao-kpi-s { font-size: 10.5px; margin-top: 6px; font-weight: 600; }

/* ── Sticky filter bar ──────────────────────────────────────────────────────── */
#aiopt-root .ao-filters { position: sticky; top: 60px; z-index: 30; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-top: 22px; border-radius: 14px; background: color-mix(in srgb, var(--ao-card) 88%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--ao-border); box-shadow: var(--ao-shadow); }
#aiopt-root .ao-search { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--ao-border2); background: var(--ao-card2); }
#aiopt-root .ao-search input { flex: 1; border: none; outline: none; background: transparent; color: var(--ao-ink); font-size: 12.5px; }
#aiopt-root .ao-seg { display: flex; background: var(--ao-grey-bg); border-radius: 10px; padding: 3px; }
#aiopt-root .ao-seg button { border: none; background: transparent; padding: 5px 12px; border-radius: 8px; font-size: 11.5px; font-weight: 700; color: var(--ao-muted); cursor: pointer; transition: all var(--ao-tr); }
#aiopt-root .ao-seg button.on { background: var(--ao-card); color: var(--ao-ink); box-shadow: 0 1px 4px rgba(16,24,40,.12); }

/* ── Priority queue ─────────────────────────────────────────────────────────── */
#aiopt-root .ao-queue { display: flex; flex-direction: column; gap: 12px; }
#aiopt-root .ao-q { padding: 16px 18px; cursor: pointer; }
#aiopt-root .ao-q-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#aiopt-root .ao-q-rank { width: 30px; height: 30px; border-radius: 9px; background: var(--ao-purple-bg); color: var(--ao-purple); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
#aiopt-root .ao-q-name { font-size: 14.5px; font-weight: 800; color: var(--ao-ink); }
/* Stats as tidy tiles (was loose floating text) — display-only cleanup */
#aiopt-root .ao-q-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin: 14px 0 10px;
}
#aiopt-root .ao-q-stat {
  background: var(--ao-bg, #f8f9fb); border: 1px solid var(--ao-border);
  border-radius: 10px; padding: 10px 12px; min-width: 0;
}
#aiopt-root .ao-q-stat b { display: block; font-size: 15px; color: var(--ao-ink); font-weight: 800; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#aiopt-root .ao-q-stat span { font-size: 10px; color: var(--ao-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
/* Why line in a highlighted panel instead of raw full-width text */
#aiopt-root .ao-q-why {
  font-size: 12.5px; color: var(--ao-body); margin-top: 4px; line-height: 1.55;
  background: var(--ao-purple-bg); border-left: 3px solid var(--ao-purple);
  border-radius: 8px; padding: 10px 14px;
}
#aiopt-root .ao-q-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
/* Client Benchmark strip — all Ret/ROAS bands from Administration, own row */
#aiopt-root .ao-bench { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 2px 0 8px; }
#aiopt-root .ao-bench-lbl { font-size: 9.5px; font-weight: 800; color: var(--ao-muted); letter-spacing: .05em; margin-right: 2px; }
#aiopt-root .ao-bench-chip {
  font-size: 11px; font-weight: 700; color: var(--ao-ink);
  background: var(--ao-card2, #fafbfe); border: 1px solid var(--ao-border);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
#aiopt-root .ao-bench-none { color: var(--ao-muted); font-weight: 600; font-style: italic; border-style: dashed; }
#aiopt-root .ao-bench-met  { background: var(--ao-green-bg, #ecfdf5); border-color: rgba(22,163,74,.35); color: var(--ao-green, #16a34a); }
#aiopt-root .ao-bench-miss { background: var(--ao-red-bg, #fef2f2);  border-color: rgba(220,38,38,.30);  color: var(--ao-red, #dc2626); }

/* ── "How is the margin calculated?" modal ─────────────────────────────────── */
#aiopt-root .ao-out-click { cursor: pointer; }
#aiopt-root .ao-out-click:hover { box-shadow: 0 0 0 2px var(--ao-purple-bg); }
.ao-mm-ov {
  position: fixed; inset: 0; z-index: 10000; background: rgba(15,18,25,.55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.ao-mm {
  background: #fff; color: #1c2330; border-radius: 16px; max-width: 780px; width: 100%;
  max-height: 86vh; overflow: auto; padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28); font-size: 13px; line-height: 1.5;
}
.ao-mm-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ao-mm-hd b { font-size: 16px; }
.ao-mm-hd span { color: #7c8494; font-weight: 600; }
.ao-mm-x { margin-left: auto; border: 1px solid #e3e6ec; background: #fff; border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; color: #7c8494; }
.ao-mm-x:hover { color: #1c2330; }
.ao-mm-sec { font-size: 11px; font-weight: 800; letter-spacing: .05em; color: #7c8494; margin: 16px 0 8px; }
.ao-mm-scroll { overflow-x: auto; }
.ao-mm-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ao-mm-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: #7c8494; padding: 7px 10px; border-bottom: 2px solid #e9ecf1; white-space: nowrap; }
.ao-mm-table td { padding: 7px 10px; border-bottom: 1px solid #f0f2f6; white-space: nowrap; }
.ao-mm-table th.n, .ao-mm-table td.n { text-align: right; }
.ao-mm-chg td { background: #f6f3ff; }
.ao-mm-chg .up { color: #16a34a; } .ao-mm-chg .dn { color: #dc2626; }
.ao-mm-total td { font-weight: 800; border-top: 2px solid #e9ecf1; background: #fafbfe; }
.ao-mm-delta { color: #d97706; font-weight: 700; }
.ao-mm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ao-mm-grid > div { border: 1px solid #e9ecf1; border-radius: 10px; padding: 10px 12px; }
.ao-mm-grid span { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: #7c8494; margin-bottom: 3px; }
.ao-mm-grid b { font-size: 15px; }
.ao-mm-grid i { display: block; font-size: 11px; color: #9aa2b1; font-style: normal; margin-top: 2px; }
.ao-mm-formula { border: 1px solid #e9ecf1; border-left: 3px solid var(--ao-purple, #7C5CFC);
  border-radius: 10px; padding: 12px 14px; background: #fafbfe; line-height: 1.9; }
.ao-mm-note { margin-top: 10px; font-size: 11.5px; color: #7c8494; }
/* Forecast outcome readout */
#aiopt-root .ao-fc-readout {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 6px 0 4px; padding: 9px 13px; font-size: 13px;
  background: var(--ao-card2, #fafbfe); border: 1px solid var(--ao-border); border-radius: 10px;
}
#aiopt-root .ao-conf { display: inline-flex; align-items: center; gap: 7px; }
#aiopt-root .ao-conf-track { width: 70px; height: 6px; border-radius: 4px; background: var(--ao-grey-bg); overflow: hidden; }
#aiopt-root .ao-conf-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--ao-purple), var(--ao-purple-dk)); animation: aoBar .8s ease both; }

/* ── Detail workspace ───────────────────────────────────────────────────────── */
#aiopt-root .ao-detail { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#aiopt-root .ao-wide { grid-column: 1 / -1; }
@media (max-width: 1100px) { #aiopt-root .ao-detail { grid-template-columns: 1fr; } }
#aiopt-root .ao-block { padding: 18px 20px; }
#aiopt-root .ao-block-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ao-muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
#aiopt-root .ao-block-title i { color: var(--ao-purple); }

/* (Config-diff styles removed 2026-08 — the diff view no longer exists in the JS.) */
#aiopt-root .ao-outcome { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
#aiopt-root .ao-out { border: 1px solid var(--ao-border); border-radius: var(--ao-r-sm); padding: 10px 12px; background: var(--ao-card2); }
#aiopt-root .ao-out b { display: block; font-size: 15px; color: var(--ao-ink); font-weight: 800; }
#aiopt-root .ao-out span { font-size: 10px; color: var(--ao-muted); font-weight: 700; text-transform: uppercase; }
#aiopt-root .ao-out i.rng { font-style: normal; display: block; font-size: 10.5px; color: var(--ao-muted); margin-top: 2px; }

/* ── Diagnosis ──────────────────────────────────────────────────────────────── */
#aiopt-root .ao-diag { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
#aiopt-root .ao-dg { padding: 14px 16px; cursor: pointer; }
#aiopt-root .ao-dg-top { display: flex; align-items: center; gap: 10px; }
#aiopt-root .ao-dg-ic { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 13px; }
#aiopt-root .ao-dg-name { font-weight: 800; color: var(--ao-ink); font-size: 13px; }
#aiopt-root .ao-dg-prob { margin-left: auto; font-weight: 800; font-size: 16px; }
#aiopt-root .ao-dg-track { height: 7px; border-radius: 5px; background: var(--ao-grey-bg); margin: 10px 0 8px; overflow: hidden; }
#aiopt-root .ao-dg-fill { height: 100%; border-radius: 5px; animation: aoBar 1s ease both; }
#aiopt-root .ao-dg-ev { font-size: 11.5px; color: var(--ao-muted); line-height: 1.5; display: none; margin-top: 6px; border-top: 1px dashed var(--ao-border); padding-top: 8px; }
#aiopt-root .ao-dg.open .ao-dg-ev { display: block; animation: aoUp .25s ease both; }

/* ── Funnel ─────────────────────────────────────────────────────────────────── */
#aiopt-root .ao-funnel { display: flex; flex-direction: column; gap: 7px; }
#aiopt-root .ao-f-row { display: grid; grid-template-columns: 130px 1fr 170px; gap: 12px; align-items: center; padding: 7px 10px; border-radius: 10px; cursor: pointer; transition: background var(--ao-tr); }
#aiopt-root .ao-f-row:hover { background: var(--ao-card2); }
#aiopt-root .ao-f-row.sel { background: var(--ao-purple-bg); }
#aiopt-root .ao-f-row.bottleneck { outline: 1.5px solid var(--ao-red); outline-offset: -1px; }
#aiopt-root .ao-f-row.bottleneck2 { outline: 1.5px dashed #d97706; outline-offset: -1px; }
#aiopt-root .ao-f-goal { font-size: 12px; font-weight: 700; color: var(--ao-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#aiopt-root .ao-f-fill { height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--ao-purple), #9F86FF); animation: aoBar .9s cubic-bezier(.2,.7,.3,1) both; }
/* (ao-f-bar / ao-f-pct / ao-f-meta removed 2026-08 — the funnel is now a table
   with inline layout; only ao-f-fill is still used for the bar fill.) */
#aiopt-root .ao-f-detail { border: 1px solid var(--ao-border); border-radius: var(--ao-r-sm); background: var(--ao-card2); padding: 12px 16px; margin-top: 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; animation: aoUp .25s ease both; }

/* ── Forecast ───────────────────────────────────────────────────────────────── */
#aiopt-root .ao-chips { display: flex; gap: 8px; flex-wrap: wrap; }
#aiopt-root .ao-chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--ao-border2); background: var(--ao-card); font-size: 11.5px; font-weight: 700; color: var(--ao-muted); cursor: pointer; transition: all var(--ao-tr); }
#aiopt-root .ao-chip.on { background: var(--ao-purple); border-color: var(--ao-purple); color: #fff; box-shadow: 0 4px 12px -4px rgba(124,92,252,.5); }
#aiopt-root .ao-plot { height: 300px; margin-top: 12px; }

/* ── Simulator ──────────────────────────────────────────────────────────────── */
#aiopt-root .ao-sim { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 1100px) { #aiopt-root .ao-sim { grid-template-columns: 1fr; } }
#aiopt-root .ao-sim-col { border: 1.5px solid var(--ao-border); border-radius: var(--ao-r-sm); padding: 14px 16px; background: var(--ao-card2); }
#aiopt-root .ao-sim-col.c-ai { border-color: var(--ao-purple); background: var(--ao-purple-bg); }
#aiopt-root .ao-sim-col.c-custom { border-color: var(--ao-blue); }
#aiopt-root .ao-sim-col h5 { margin: 0 0 10px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ao-ink); display: flex; gap: 8px; align-items: center; }
#aiopt-root .ao-sim-metric { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; font-size: 12.5px; border-bottom: 1px dashed var(--ao-border); }
#aiopt-root .ao-sim-metric:last-child { border-bottom: none; }
#aiopt-root .ao-sim-metric b { font-weight: 800; color: var(--ao-ink); }
#aiopt-root .ao-sim-input { width: 74px; height: 26px; border-radius: 7px; border: 1px solid var(--ao-border2); background: var(--ao-card); color: var(--ao-ink); font-size: 12px; padding: 0 8px; text-align: right; }
#aiopt-root .ao-sim-input:focus { outline: none; border-color: var(--ao-blue); }
#aiopt-root .ao-sim-goal { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 12px; color: var(--ao-body); }

/* (Heatmap styles removed 2026-08 — Portfolio Heatmap was dropped from the UI.) */

/* ── Timeline ───────────────────────────────────────────────────────────────── */
#aiopt-root .ao-tl { position: relative; padding-left: 26px; }
#aiopt-root .ao-tl::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--ao-border2); border-radius: 2px; }
#aiopt-root .ao-tl-item { position: relative; padding: 0 0 16px 8px; }
#aiopt-root .ao-tl-dot { position: absolute; left: -25px; top: 2px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--ao-card); box-shadow: 0 0 0 1.5px var(--ao-border2); }
#aiopt-root .ao-tl-t { font-size: 12.5px; font-weight: 800; color: var(--ao-ink); }
#aiopt-root .ao-tl-s { font-size: 11.5px; color: var(--ao-muted); margin-top: 2px; line-height: 1.45; }

/* ── Chat drawer ────────────────────────────────────────────────────────────── */
#aiopt-root .ao-chat-fab { position: fixed; right: 26px; bottom: 26px; z-index: 90; width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer; background: linear-gradient(135deg, var(--ao-purple), var(--ao-purple-dk)); color: #fff; font-size: 19px; box-shadow: 0 10px 28px -6px rgba(124,92,252,.65); transition: transform var(--ao-tr); }
#aiopt-root .ao-chat-fab:hover { transform: scale(1.08); }
#aiopt-root .ao-chat { position: fixed; top: 0; right: -420px; width: 400px; max-width: 92vw; height: 100vh; z-index: 95; background: var(--ao-card); border-left: 1px solid var(--ao-border); box-shadow: -12px 0 40px rgba(16,24,40,.18); display: flex; flex-direction: column; transition: right .28s cubic-bezier(.2,.7,.3,1); }
#aiopt-root .ao-chat.open { right: 0; }
#aiopt-root .ao-chat-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--ao-border); }
#aiopt-root .ao-chat-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
#aiopt-root .ao-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 12.5px; line-height: 1.55; animation: aoUp .25s ease both; white-space: pre-wrap; }
#aiopt-root .ao-msg.user { align-self: flex-end; background: var(--ao-purple); color: #fff; border-bottom-right-radius: 5px; }
#aiopt-root .ao-msg.bot { align-self: flex-start; background: var(--ao-card2); border: 1px solid var(--ao-border); color: var(--ao-body); border-bottom-left-radius: 5px; }
#aiopt-root .ao-chat-sugg { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 8px; }
#aiopt-root .ao-chat-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--ao-border); }
#aiopt-root .ao-chat-input input { flex: 1; height: 38px; border-radius: 11px; border: 1px solid var(--ao-border2); background: var(--ao-card2); padding: 0 13px; font-size: 12.5px; color: var(--ao-ink); }
#aiopt-root .ao-chat-input input:focus { outline: none; border-color: var(--ao-purple); }

/* ── XAI ────────────────────────────────────────────────────────────────────── */
#aiopt-root .ao-xai { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
#aiopt-root .ao-xai-item { border: 1px solid var(--ao-border); border-radius: var(--ao-r-sm); padding: 11px 13px; background: var(--ao-card2); font-size: 12px; line-height: 1.5; color: var(--ao-body); }
#aiopt-root .ao-xai-item h6 { margin: 0 0 5px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }

/* ── Skeleton / empty ───────────────────────────────────────────────────────── */
#aiopt-root .ao-skel { border-radius: var(--ao-r); background: linear-gradient(90deg, var(--ao-grey-bg) 25%, var(--ao-card2) 50%, var(--ao-grey-bg) 75%); background-size: 800px 100%; animation: aoShimmer 1.3s infinite linear; }
#aiopt-root .ao-empty { text-align: center; padding: 40px 20px; color: var(--ao-muted); }
#aiopt-root .ao-empty i { font-size: 30px; color: var(--ao-border2); margin-bottom: 10px; display: block; }

/* approval history rows */
#aiopt-root .ao-hist-row { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--ao-card2); border: 1px solid var(--ao-border); font-size: 12px; margin-bottom: 7px; }

@media (max-width: 860px) {
  #aiopt-root { padding: 16px 14px 60px; margin: -22px -14px -40px; }
  #aiopt-root .ao-h-actions { width: 100%; margin-left: 0; }
  #aiopt-root .ao-q-stats { gap: 14px; }
  #aiopt-root .ao-filters { top: 54px; }
}
