/* ── UX upgrade (Oct 2026 round 2) ── */
:root { --ux-track: #e6ecef; --ux-card: var(--panel); }
:root[data-theme="dark"] { --ux-track: #22333d; }
.profile-step[hidden] { display: none !important; }

/* 1. Onboarding wizard */
.profile-setup-card.pw-on > :not(#pwWizard) { display: none !important; }
#pwWizard { display: grid; gap: 14px; }
.pw-top { display: grid; gap: 8px; }
.pw-count { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--teal, #0e7c72); }
.pw-bar { height: 6px; border-radius: 999px; background: var(--ux-track); overflow: hidden; }
.pw-bar span { display: block; height: 100%; background: #0e7c72; border-radius: 999px; transition: width .3s ease; }
.pw-step { display: grid; gap: 12px; animation: pwIn .25s ease; }
@keyframes pwIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pw-step { animation: none; } }
.pw-title { margin: 4px 0 0; font-size: 24px; letter-spacing: -.02em; outline: none; }
.pw-sub { margin: 0 0 4px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.pw-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pw-field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.pw-field input { min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; font-weight: 400; background: var(--panel); color: var(--ink); }
.pw-field input:focus { outline: 2px solid #0e7c72; outline-offset: 1px; border-color: #0e7c72; }
.pw-label { margin: 6px 0 0; font-size: 13px; font-weight: 700; }
.pw-choices { display: grid; gap: 8px; }
.pw-grid { grid-template-columns: 1fr 1fr; }
.pw-inline { display: flex; flex-wrap: wrap; }
.pw-big { grid-template-columns: 1fr 1fr; }
.pw-choice { text-align: left; border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); padding: 12px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 48px; transition: border-color .15s, background .15s, box-shadow .15s; }
.pw-inline .pw-choice { min-height: 40px; padding: 8px 14px; border-radius: 999px; }
.pw-choice:hover { border-color: #5ec9ba; }
.pw-choice.on { border-color: #0e7c72; background: var(--teal-soft, #d0f4ee); box-shadow: 0 0 0 3px rgba(14,124,114,.15); }
.pw-big .pw-choice { display: grid; gap: 6px; padding: 18px; min-height: 140px; align-content: start; }
.pw-big .pw-choice strong { font-size: 17px; }
.pw-big .pw-choice span { font-weight: 400; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.pw-err { margin: 0; min-height: 1em; color: #a3261a; font-size: 13px; }
.pw-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pw-actions .login-button { width: auto; min-width: 180px; }
#pwPlanSlot .plan-select { margin: 0; }
@media (max-width: 640px) { .pw-row, .pw-grid, .pw-big { grid-template-columns: 1fr; } .pw-big .pw-choice { min-height: 0; } }
:root[data-theme="dark"] .pw-choice.on { background: #0f2f2c; }

/* 2. Product intake */
.ux-catalog { display: block !important; }
.ux-catalog .product-catalog { max-height: none; overflow: visible; padding: 14px 4px 4px; }
.ux-chiprow { margin: 12px 0 0; }
.ux-chips { display: flex !important; flex-wrap: wrap; gap: 8px; }
.ux-chips .filter-tab { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; min-height: 36px; background: var(--panel); font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.ux-chips .filter-tab:hover { border-color: #5ec9ba; }
.ux-chips .filter-tab.active { background: #0b1f44; border-color: #0b1f44; color: #fff; }
.ux-chips .filter-count { font-size: 11.5px; font-weight: 700; background: var(--ux-track); color: var(--ink); border-radius: 999px; padding: 0 7px; }
.ux-chips .filter-tab.active .filter-count { background: rgba(255,255,255,.18); color: #fff; }
.ux-catalog .product-group { padding-left: 0; gap: 10px; }
.ux-catalog .product-group::before { display: none; }
.ux-catalog .product-group h3 { font-size: 15px; color: var(--ink); }
.ux-catalog .product-subgroup h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ux-catalog .product-group { display: flex !important; flex-wrap: wrap; gap: 12px 18px; align-items: flex-start; }
.ux-catalog .product-group > h3 { flex-basis: 100%; }
.ux-catalog .product-subgroup { flex: 0 1 auto; max-width: 100%; }
.ux-catalog .product-tile-grid { display: flex !important; flex-wrap: wrap; gap: 10px; }
.ux-catalog .product-tile-grid .product-option { width: 196px; }
.intake-panel.ux-collapsed .catalog-search-row, .intake-panel.ux-collapsed .ux-chiprow, .intake-panel.ux-collapsed .catalog-layout { display: none !important; }
@media (max-width: 640px) { .ux-catalog .product-tile-grid .product-option { width: calc(50% - 5px); } }
.ux-catalog .product-option { border-radius: 12px; box-shadow: none; position: relative; }
.ux-catalog .product-option:hover { box-shadow: 0 8px 22px rgba(24,38,45,.12); }
.ux-catalog .product-visual { aspect-ratio: 2.4 / 1; }
.ux-catalog .product-tile-caption { min-height: 0; padding: 10px 12px 12px; background: var(--panel); color: var(--ink); border-top: 1px solid var(--line); }
.ux-catalog .product-tile-caption::before { display: none; }
.ux-catalog .product-tile-caption strong { font-size: 13.5px; }
.ux-catalog .product-tile-caption span { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ux-catalog .product-option.active { outline: 3px solid rgba(14,124,114,.25); border-color: #0e7c72; }
.ux-catalog .product-option.active::after { content: "✓ Selected"; position: absolute; top: 8px; right: 8px; background: #0e7c72; color: #fff; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.ux-selected { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0 0; padding: 12px 16px; border: 1px solid #0e7c72; border-radius: 12px; background: var(--teal-soft, #d0f4ee); }
.ux-selected strong { display: block; font-size: 15px; }
.ux-selected span { font-size: 13px; color: #33514d; }
.ux-selected .eyebrow { margin: 0; color: #0b5f58; }
.ux-confirm { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--surface); scroll-margin-top: 90px; }
.ux-confirm h3 { margin: 2px 0 4px; font-size: 17px; }
.ux-confirm p { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 760px; }
.ux-confirm-body .attribute-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 16px; margin: 14px 0; }
.ux-confirm-body .attribute-grid label { font-size: 13px; font-weight: 700; display: grid; gap: 4px; }
.ux-confirm-body .attribute-grid select { min-height: 40px; border-radius: 8px; }
.ux-confirm-body .check-row { display: flex !important; align-items: center; gap: 8px; font-weight: 600 !important; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--panel); min-height: 44px; }
.ux-confirm-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ux-class { font-size: 13px; color: var(--muted); }
.ux-gate-note { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: #fde7c7; color: #7a3d00; font-weight: 700; font-size: 13.5px; }
.ux-nudge { animation: uxNudge .5s ease 2; }
@keyframes uxNudge { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 4px rgba(245,158,11,.45); } }
.step-nav-btn.ux-locked { opacity: .45; cursor: not-allowed; }
.step-btn-next.ux-locked { opacity: .55; }
#regionProcess, #marketCards, #mdsapPanel { scroll-margin-top: 84px; }

/* 4. MDSAP */
.ux-mdsap { display: flex; gap: 14px; align-items: center; margin: 4px 0 14px; padding: 14px 16px; border-radius: 12px; border: 1px solid #5ec9ba; background: linear-gradient(90deg, rgba(94,201,186,.18), rgba(94,201,186,.04)); }
.ux-mdsap strong { font-size: 15px; }
.ux-mdsap p { margin: 4px 0 8px; font-size: 13.5px; line-height: 1.5; }
.ux-mdsap-icon { flex: none; width: 36px; height: 36px; border-radius: 50%; background: #0e7c72; color: #fff; display: grid; place-items: center; font-weight: 900; }
.ux-mdsap > div:nth-child(2) { flex: 1; }
.ux-mdsap-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ux-mdsap-chips span { font-size: 12px; font-weight: 700; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.ux-mdsap--slim { margin: 0 0 12px; }
.ux-mdsap--slim p { margin-bottom: 0; }
.ux-mdsap-badge { margin-left: 6px; font: inherit; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; color: #fff; background: #0e7c72; border: 0; border-radius: 999px; padding: 2px 8px; cursor: pointer; vertical-align: 2px; }
.ux-mdsap-mini { margin-top: 10px; border: 0; background: none; color: #0e7c72; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; padding: 0; text-align: left; }
.ux-flash { animation: uxNudge .6s ease 2; }
@media (max-width: 760px) { .ux-mdsap { flex-direction: column; align-items: flex-start; } }

/* 5. Dashboards — shadcn/ui-style */
.ux-dash { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 16px; margin: 4px 0 18px; }
.ux-dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ux-dash-head h3 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.ux-dash-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.ux-seg { display: inline-flex; background: var(--ux-track); border-radius: 10px; padding: 3px; gap: 2px; }
.ux-seg button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: #34444e; padding: 6px 12px; border-radius: 8px; cursor: pointer; min-height: 32px; }
.ux-seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.ux-cardx { background: var(--ux-card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-width: 0; }
.ux-card-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13.5px; }
.ux-card-h span { font-size: 12px; color: var(--muted); }
.ux-center { display: grid; place-items: center; align-content: center; text-align: center; }
.ux-grid-ov { display: grid; grid-template-columns: 170px 1fr; gap: 12px; }
.ux-grid-ov .ux-wide { grid-column: 1 / span 1; }
.ux-grid-ov > .ux-wide { grid-column: 1 / -1; }
.ux-grid-ov { grid-template-areas: "rad kpi" "act act" "dl dl"; }
.ux-grid-ov > :nth-child(1) { grid-area: rad; } .ux-grid-ov > :nth-child(2) { grid-area: kpi; } .ux-grid-ov > :nth-child(3) { grid-area: act; } .ux-grid-ov > :nth-child(4) { grid-area: dl; }
@media (min-width: 1100px) { .ux-grid-ov { grid-template-columns: 170px 1fr 300px; grid-template-areas: "rad kpi dl" "act act dl"; } }
.ux-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ux-kpis--4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
.ux-kpi { background: var(--ux-card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.ux-kpi-l { font-size: 12px; color: var(--muted); font-weight: 600; }
.ux-kpi strong { font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
.ux-kpi strong small { font-size: 15px; color: var(--muted); font-weight: 600; }
.ux-kpi-s { font-size: 12px; color: var(--muted); }
.ux-radial-arc { transition: stroke-dashoffset .6s ease; }
.ux-radial-v { font-size: 24px; font-weight: 800; fill: var(--ink); }
.ux-radial-l { font-size: 10.5px; fill: var(--muted); font-weight: 600; }
.ux-area { width: 100%; height: 150px; display: block; }
.ux-grid { stroke: var(--line); stroke-dasharray: 3 4; stroke-width: 1; }
.ux-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ux-bars li { display: grid; grid-template-columns: minmax(110px, 200px) 1fr 44px; align-items: center; gap: 10px; font-size: 13px; padding: 4px 6px; border-radius: 8px; }
.ux-bars li[role=button] { cursor: pointer; }
.ux-bars li[role=button]:hover, .ux-bars li[role=button]:focus-visible { background: var(--ux-track); outline: none; }
.ux-bar-l { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-bar-t { height: 10px; border-radius: 999px; background: var(--ux-track); overflow: hidden; }
.ux-bar-t span { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; min-width: 2px; }
.ux-bar-v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ux-dl { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ux-dl li { display: flex; gap: 12px; align-items: center; font-size: 13px; line-height: 1.35; }
.ux-dl-d { flex: none; width: 54px; height: 54px; border-radius: 12px; background: #0b1f44; color: #fff; display: grid; place-items: center; align-content: center; font-weight: 800; font-size: 18px; line-height: 1; }
.ux-dl-d small { font-size: 10px; font-weight: 600; opacity: .8; }
.ux-dl li > span:last-child small { display: block; color: var(--muted); font-size: 12px; }
.ux-empty, .ux-hint { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.ux-grid-pf { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.ux-grid-pf > .ux-wide { grid-column: 1 / -1; }
.ux-dash--profile { margin: 0 0 6px; }
.ux-tip { position: fixed; left: 0; top: 0; z-index: 3000; pointer-events: none; background: #0b1f44; color: #fff; font-size: 12px; line-height: 1.4; padding: 6px 9px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); opacity: 0; transition: opacity .1s; max-width: 260px; }
.ux-tip.on { opacity: 1; }
@media (max-width: 760px) { .ux-grid-ov, .ux-grid-pf { grid-template-columns: 1fr; grid-template-areas: none; } .ux-grid-ov > * { grid-area: auto !important; } .ux-kpis--4 { grid-template-columns: 1fr 1fr; } .ux-bars li { grid-template-columns: 90px 1fr 40px; } }
:root[data-theme="dark"] .ux-selected { background: #0f2f2c; } :root[data-theme="dark"] .ux-selected span { color: #b8d9d4; } :root[data-theme="dark"] .ux-selected .eyebrow { color: #8fe3d8; }
:root[data-theme="dark"] .ux-gate-note { background: #4a3214; color: #f8d6a3; }
:root[data-theme="dark"] .ux-chips .filter-tab.active { background: #5ec9ba; border-color: #5ec9ba; color: #0b1f44; }

/* Login: welcome-back card */
.ux-welcome { display: grid; gap: 12px; padding: 26px 24px; }
.ux-welcome h2 { margin: 0; font-size: 20px; }
.ux-welcome p { margin: 0; color: var(--muted); font-size: 14px; }
.ux-welcome .ux-acct { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.ux-welcome .ux-av { width: 40px; height: 40px; border-radius: 50%; background: #0b1f44; color: #fff; display: grid; place-items: center; font-weight: 800; }
.ux-welcome .ghost-button { justify-self: start; }

.ux-dl--row { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
:root[data-theme="dark"] .ux-seg button { color: #c5d3da; }
#uxPortfolioDash { margin: 0 0 18px; }

.ux-dashview { position: fixed; inset: 0; z-index: 1250; background: rgba(10,20,28,.5); display: grid; place-items: start center; overflow-y: auto; padding: 32px 16px; }
.ux-dashview-card { width: min(1100px, 100%); background: var(--panel); color: var(--ink); border-radius: 16px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.ux-dashview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.ux-dashview-id { display: flex; align-items: center; gap: 12px; }
.ux-dashview-id h2 { margin: 0; font-size: 20px; }
.ux-dashview-id p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.ux-dashview .ux-av { width: 44px; height: 44px; border-radius: 50%; background: #0b1f44; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.ux-dashview-actions { display: flex; gap: 8px; }
.ux-dashview .ux-dash { margin: 0; }
.ux-selected[hidden], .ux-confirm[hidden] { display: none !important; }

/* progress model */
.ux-measures { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.ux-meas { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12.5px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 10px; }
.ux-meas b { font-size: 13px; } .ux-meas small { color: var(--muted); font-size: 11px; }
.ux-meas--status { background: #fde7c7; border-color: #f0c88a; color: #7a3d00; font-weight: 700; }
.ux-meas--status.ok, .ux-status.ok { background: var(--teal-soft, #d0f4ee); border-color: #0e7c72; color: #0b5f58; }
.ux-status { display: inline-block; margin-top: 8px; font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #fde7c7; color: #7a3d00; text-align: center; }
:root[data-theme="dark"] .ux-meas--status, :root[data-theme="dark"] .ux-status { background: #4a3214; color: #f8d6a3; }

/* AI status + fallback labelling */
.gai-status { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--panel-2, #eef2f4); color: #34444e; }
.gai-status[data-state="up"] { background: #d0f4ee; color: #0b5f58; }
.gai-status[data-state="down"] { background: #fde7c7; color: #7a3d00; }
.gai-fallback { border-left: 3px solid #d98a1c; background: #fff6e8; color: #5b3200; padding: 8px 10px; border-radius: 6px; font-size: 13px; margin: 0 0 8px; }
:root[data-theme="dark"] .gai-fallback { background: #3a2a14; color: #f8d6a3; }

/* Narrow screens: 5 stages stacked icon-over-label so nothing clips */
@media (max-width: 600px) {
  .step-nav { height: 56px !important; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .step-nav::-webkit-scrollbar { display: none; }
  .step-nav-btn { flex: 1 1 0 !important; min-width: 0; flex-direction: column; gap: 2px !important; height: 52px !important; padding: 2px !important; }
  .step-nav .step-label::after { font-size: 10.5px !important; line-height: 1.1; white-space: nowrap; }
  .step-circle { width: 22px !important; height: 22px !important; flex: none; }
}

/* Searchable market list */
.ux-mlist { margin: 0 0 12px; }
.ux-mlist-search { display: grid; gap: 4px; font-weight: 700; font-size: 13px; }
.ux-mlist-search input { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font: inherit; font-weight: 400; background: var(--panel); color: inherit; }
.ux-mlist-hint { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.ux-mlist-items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; max-height: 220px; overflow: auto; }
.ux-mlist-items button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel); color: inherit; border-radius: 8px; padding: 6px 10px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; column-gap: 6px; font: inherit; font-size: 13px; }
.ux-mlist-items button small { grid-column: 2; color: var(--muted); font-size: 11.5px; }
.ux-mlist-items button.on, .ux-mlist-items button:hover { border-color: #0e7c72; box-shadow: 0 0 0 1px #0e7c72 inset; }
.ux-mlist-empty { font-size: 13px; color: var(--muted); }
.ux-demo-id { margin-left: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: #fde7c7; color: #7a3d00; border-radius: 999px; padding: 2px 6px; }
