/* v4.9.0 console kit: unified type, page heads, segmented views, data tables, drawer, confirm, empty and loading states, mobile bar */
:root{--fs-xs:11px;--fs-sm:12px;--fs-md:13px;--fs-lg:15px;--fs-xl:20px;--ease:cubic-bezier(.2,.7,.2,1)}

/* Type: sentence-case labels, no decorative arrows */
.caps{text-transform:none!important;letter-spacing:0!important;font-size:var(--fs-sm)!important;font-weight:600;color:var(--muted)!important}
.ai-out h4{text-transform:none;letter-spacing:0;font-size:var(--fs-md);color:var(--text)}
.todo-list button.link::after{content:none}
.card h2{font-size:var(--fs-lg);margin:0 0 6px;letter-spacing:-.01em}
.btn.icon{min-width:36px;padding:6px}.btn svg,.btn.icon svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.btn.danger-ghost{border-color:transparent;color:#ffb3bd}.btn.danger-ghost:hover:not(:disabled){background:#3a1d27;border-color:#8a4757}

/* Navigation grouped by job */
.nav{display:grid}
.nav-group{margin:16px 11px 6px;font-size:var(--fs-xs);font-weight:650;color:#6f7d95}
.nav-group:first-child{margin-top:0}
.nav button{display:flex;align-items:center;gap:10px;font-size:var(--fs-md);font-weight:600}
.nav button svg,.bottom-nav svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;opacity:.85}
.nav button.active svg{opacity:1;color:var(--cyan)}

/* Page head and context bar */
.page-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16px 24px;flex-wrap:wrap;margin:2px 0 18px}
.page-head h2{margin:0 0 4px;font-size:var(--fs-xl);letter-spacing:-.02em}
.page-head p{margin:0;max-width:68ch;font-size:var(--fs-md)}
.page-actions{display:flex;gap:8px;flex-wrap:wrap}
.context-bar{display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.context-bar label{display:grid;gap:6px;min-width:min(320px,100%)}
#tab-seo .page-head,#tab-affiliate .page-head,#tab-team .page-head{display:flex}
.panel{padding:0;overflow:visible}
.panel>h2{padding:18px 20px 0}
.panel>[data-seg-panel],.panel>#memberTable{padding:16px 20px 18px}

/* Segmented views */
.seg-tabs{display:flex;gap:2px;border-bottom:1px solid var(--line);margin-bottom:14px;overflow-x:auto;scrollbar-width:none}
.seg-tabs::-webkit-scrollbar{display:none}
.seg-tabs button{background:none;border:0;border-bottom:2px solid transparent;color:var(--muted);font-weight:650;font-size:var(--fs-md);padding:10px 14px;margin-bottom:-1px;white-space:nowrap;border-radius:0}
.seg-tabs button:hover{color:var(--text)}
.seg-tabs button.active{color:var(--text);border-bottom-color:var(--violet)}

/* Data table */
.ui-dt-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:12px}
.ui-dt-tools input[type=search]{flex:1 1 240px;min-width:0}
.ui-dt-tools select{width:auto;min-width:150px}
.ui-dt-count{margin-left:auto;color:var(--muted);font-size:var(--fs-sm);white-space:nowrap}
.ui-dt-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:12px}
table.ui-dt{width:100%;border-collapse:collapse;font-size:var(--fs-md)}
.ui-dt th{text-align:left;font-size:var(--fs-sm);font-weight:600;color:var(--muted);padding:10px 14px;background:#0d1524;border-bottom:1px solid var(--line);white-space:nowrap}
.ui-dt td{padding:12px 14px;border-bottom:1px solid #1c2739;vertical-align:middle;overflow-wrap:anywhere}
.ui-dt tbody tr:last-child td{border-bottom:0}
.ui-dt tbody tr:hover td{background:#131d2d}
.ui-dt td strong{font-weight:650;color:var(--text)}
.ui-dt .cell-sub{display:block;color:var(--muted);font-size:var(--fs-sm);margin-top:2px}
.ui-dt .num{text-align:right;font-variant-numeric:tabular-nums}
.ui-dt th.ui-dt-actions{width:1%}
.ui-dt td.ui-dt-actions{white-space:nowrap;text-align:right}
.ui-dt td.ui-dt-actions>*{vertical-align:middle;margin-left:6px}
.ui-dt td.ui-dt-actions .row-actions{display:inline-flex;gap:6px;align-items:center}
.ui-dt select[data-task]{min-height:34px;padding:5px 8px;font-size:var(--fs-sm);width:auto}
.ui-dt .bar.thin{height:5px;margin-top:6px;max-width:220px}
.ui-dt-none{text-align:center;color:var(--muted);padding:26px!important}
.ui-dt-pager{display:flex;justify-content:flex-end;align-items:center;gap:10px;margin-top:12px;font-size:var(--fs-sm);color:var(--muted)}
.ui-dt-more{display:flex;justify-content:center;margin-top:12px}
.avatar{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:50%;background:#252050;color:#d9cfff;font-weight:700;font-size:var(--fs-sm);margin-right:10px;vertical-align:middle;flex:none}
.who{display:inline-block;vertical-align:middle;max-width:calc(100% - 44px)}
.pill[data-status=pending]{color:#fbd78f;border-color:#82663a;background:#372b24}
.pill[data-status=revoked]{color:#f9a6b0;border-color:#854b5e;background:#39202a}
.pill[data-status=p-critical]{color:#ffb3bd;border-color:#8a4757;background:#2a1820}
.pill[data-status=p-high]{color:#ffce93;border-color:#91693e;background:#3a2b20}
.pill[data-status=p-low]{color:#aab6ca}

/* Empty and loading states */
.ui-empty{display:grid;justify-items:center;gap:8px;padding:36px 20px;border:1px dashed #3a4862;border-radius:14px;text-align:center;background:#0d1524}
.ui-empty svg{width:44px;height:44px;fill:none;stroke:#5d6b86;stroke-width:2;stroke-linecap:round}
.ui-empty h3{margin:4px 0 0;font-size:var(--fs-lg);letter-spacing:-.01em}
.ui-empty p{margin:0;max-width:52ch;font-size:var(--fs-md)}
.ui-empty .btn{margin-top:8px}
.ui-skeleton{display:grid;gap:10px;background:none!important;animation:none!important;min-height:0}
.ui-skeleton span{display:block;height:44px;border-radius:10px;background:linear-gradient(90deg,#141e2e,#1f2a3e,#141e2e);background-size:200% 100%;animation:ui-shimmer 1.4s ease-in-out infinite}
.ui-skeleton span:nth-child(2n){opacity:.7}
@media(prefers-reduced-motion:reduce){.ui-skeleton span{animation:none}}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Drawer (forms) and confirm dialog */
dialog.ui-drawer{margin:0 0 0 auto;height:100dvh;max-height:100dvh;width:min(480px,100vw);max-width:100vw;padding:0;border:0;border-left:1px solid #485474;background:var(--panel);color:var(--text);box-shadow:-30px 0 80px #000a}
dialog.ui-drawer[open]{display:flex;flex-direction:column;animation:ui-drawer-in .22s var(--ease)}
@keyframes ui-drawer-in{from{transform:translateX(40px);opacity:0}}
.ui-drawer-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--line)}
.ui-drawer-head h2{margin:0;font-size:var(--fs-lg)}
.ui-drawer-body{padding:20px;overflow:auto;flex:1}
.ui-drawer-body form{display:grid;gap:14px}
.ui-drawer-body label{display:grid;gap:6px}
.ui-drawer-body input:not([type=checkbox]),.ui-drawer-body select,.ui-drawer-body textarea{width:100%}
.ui-drawer-body form>.btn.primary,.ui-drawer-body form>button:last-child{justify-self:start}
.ui-drawer-body .cols{display:grid;grid-template-columns:1fr 1fr;gap:10px}
dialog.ui-confirm{width:min(420px,calc(100vw - 32px));padding:22px;border-radius:16px;border:1px solid #485474;background:var(--panel);color:var(--text);box-shadow:0 26px 92px #000c}
dialog.ui-confirm[open]{animation:ui-pop .16s var(--ease)}
@keyframes ui-pop{from{transform:scale(.97);opacity:0}}
.ui-confirm h2{margin:0 0 8px;font-size:var(--fs-lg);overflow-wrap:anywhere}
.ui-confirm p{margin:0;font-size:var(--fs-md)}
.ui-confirm-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}
@media(prefers-reduced-motion:reduce){dialog.ui-drawer[open],dialog.ui-confirm[open]{animation:none}}

/* Team */
.team-grid{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(280px,1fr);gap:16px;align-items:start}
.team-side{display:grid;gap:16px}
.flow{list-style:none;counter-reset:f;margin:10px 0 16px;padding:0;display:grid;gap:8px}
.flow li{counter-increment:f;display:flex;align-items:center;gap:10px;font-size:var(--fs-md);color:#c9d4e6}
.flow li::before{content:counter(f);display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#1c2738;border:1px solid var(--line);font-size:var(--fs-xs);font-weight:700;color:var(--text);flex:none}
.flow li.flow-review::before{background:#252050;border-color:#5f52b0}
.perm-list{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}
.perm{display:inline-flex;flex-direction:column;padding:6px 10px;border-radius:10px;background:var(--panel2);border:1px solid var(--line);font-size:var(--fs-sm);font-weight:650}
.perm small{font-size:var(--fs-xs);font-weight:500}
#teamMessage:empty{display:none}
#onceKey{max-width:720px;margin:16px auto!important;border-color:#7d6ee0;background:linear-gradient(160deg,#1d1940,var(--panel) 60%)}
#onceKey h2{font-size:var(--fs-lg)}
#onceKey pre{font-size:var(--fs-md);padding:12px;border-radius:10px;background:#0c1523;border:1px solid var(--line);white-space:pre-wrap;word-break:break-all;user-select:all}

/* Mobile: bottom bar, stacked table cards */
.bottom-nav{display:none}
@media(max-width:1000px){.team-grid{grid-template-columns:1fr}}
@media(max-width:750px){
 .bottom-nav{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;left:0;right:0;bottom:0;z-index:40;background:#0d1422f2;backdrop-filter:blur(10px);border-top:1px solid var(--line);padding:4px 4px calc(4px + env(safe-area-inset-bottom))}
 body.is-guest .bottom-nav{display:none}
 .bottom-nav button{display:grid;justify-items:center;gap:3px;background:none;border:0;color:var(--muted);font-size:10px;font-weight:650;padding:7px 2px;border-radius:10px;min-height:48px}
 .bottom-nav button.active{color:var(--text);background:#1b2038}
 .bottom-nav button.active svg{color:var(--cyan)}
 .main{padding-bottom:96px!important}
 .ui-toast{bottom:76px}
 .page-head{align-items:stretch}
 .page-actions{width:100%}
 .page-actions .btn{flex:1 1 auto}
 .panel>[data-seg-panel],.panel>#memberTable{padding:12px}
 .ui-dt-wrap{border:0;overflow:visible}
 table.ui-dt,.ui-dt tbody,.ui-dt tr,.ui-dt td{display:block;width:100%}
 .ui-dt thead{display:none}
 .ui-dt tbody{display:grid;gap:10px}
 .ui-dt tbody tr{border:1px solid var(--line);border-radius:12px;background:var(--panel2);padding:10px 12px}
 .ui-dt tbody tr:hover td{background:none}
 .ui-dt td{border:0;padding:5px 0;display:flex;justify-content:space-between;gap:12px;text-align:right}
 .ui-dt td::before{content:attr(data-label);color:var(--muted);font-size:var(--fs-sm);text-align:left;flex:none}
 .ui-dt td:first-child{display:block;text-align:left;padding-bottom:8px;border-bottom:1px solid var(--line);margin-bottom:4px}
 .ui-dt td:first-child::before{content:none}
 .ui-dt td.ui-dt-actions{justify-content:flex-end;padding-top:8px}
 .ui-dt td.ui-dt-actions::before{content:none}
 .ui-dt td.ui-dt-none{display:block;text-align:center}
 .ui-dt td.ui-dt-none::before{content:none}
 .ui-dt-count{margin-left:0;width:100%}
 .ui-dt-tools select{flex:1 1 140px}
 .ui-drawer-body .cols{grid-template-columns:1fr}
 dialog.ui-drawer{width:100vw;border-left:0}
}

/* v4.9.0 polish after local review */
@media(min-width:751px){.page-head h2{display:none}.page-head{align-items:center}}
.ui-dt-tools input[type=search],.ui-dt-tools select{font-size:var(--fs-md);min-height:38px;padding:7px 12px}
.ui-dt td{overflow-wrap:break-word}
.ui-dt td:first-child{min-width:200px}
.ui-dt td.ui-dt-actions .row-actions{display:inline-flex!important;flex-direction:row!important;flex-wrap:nowrap;gap:6px;margin:0}
.who{max-width:none}
.member{display:flex;align-items:center;gap:0}
#memberTable td:first-child{min-width:230px}
@media(max-width:750px){.ui-dt td:first-child{min-width:0}}
#memberTable td:nth-child(2),#memberTable td:nth-child(3){white-space:nowrap}
#memberTable td:first-child{min-width:200px}
header select{font-size:var(--fs-md);min-height:38px}
@media(max-width:750px){
 header select{min-height:36px;padding:6px 8px}
 #mobileBrandSlot{min-width:0;gap:6px}
 #mobileBrandSlot #brandSelect{min-width:0;width:auto;max-width:42vw}
 .context-bar{flex-wrap:nowrap}
 .context-bar label{flex:1;min-width:0}
 #memberTable td:nth-child(2),#memberTable td:nth-child(3){white-space:normal}
}
.team-grid{grid-template-columns:minmax(0,2.2fr) minmax(280px,1fr)}
#memberTable td:nth-child(3){white-space:normal}
@media(max-width:750px){#locale{width:62px;flex:none}#mobileBrandSlot #brandSelect{min-width:96px;flex:1 1 auto}}
@media(max-width:420px){#mobileBrandSlot .brandMini{font-size:14px}#mobileBrandSlot .brandMini b{display:none}#mobileBrandSlot #brandSelect{max-width:none;min-width:84px}}

/* v5.0 overview: prompt hero with a live dot grid, insight cards, rolling KPIs */
.ov-hero{position:relative;overflow:hidden;border:1px solid var(--line);border-radius:20px;background:radial-gradient(120% 140% at 100% 0%,#1d1940 0%,transparent 55%),var(--panel);padding:26px 28px 22px;margin-bottom:14px;display:grid;gap:12px}
.ov-pulse{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;-webkit-mask-image:linear-gradient(90deg,transparent 0%,#000 55%,#000 100%);mask-image:linear-gradient(90deg,transparent 0%,#000 55%,#000 100%)}
.ov-pulse circle{fill:#3a4a68;opacity:.55;animation:ov-breathe 2.8s ease-in-out infinite}
.ov-pulse circle.lit{fill:var(--cyan);opacity:1;animation:none;transition:fill .3s}
.ov-pulse circle.ripple{fill:none;stroke:var(--cyan);stroke-width:1.2;opacity:0;animation:ov-ripple 1.3s ease-out forwards;transform-box:fill-box;transform-origin:center}
@keyframes ov-breathe{50%{opacity:.18}}
@keyframes ov-ripple{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(9)}}
.ov-hero-body{position:relative;max-width:720px;display:grid;gap:14px}
.ov-hero h2{margin:0;font-size:clamp(22px,2.6vw,30px);letter-spacing:-.025em;line-height:1.15;text-wrap:balance}
#growForm{display:grid;gap:12px}
.grow-goals{display:flex;flex-wrap:wrap;gap:6px}
.grow-goals button{border:1px solid #45526b;background:transparent;color:#c3cfe3;border-radius:99px;padding:7px 14px;font-size:var(--fs-md);font-weight:650;min-height:34px}
.grow-goals button[aria-pressed=true]{background:#2a2456;border-color:#7d6ee0;color:#efe9ff}
.grow-input{display:flex;gap:8px;padding:6px;border-radius:14px;background:#0c1523;border:1px solid #46546d}
.grow-input:focus-within{border-color:var(--violet);box-shadow:0 0 0 3px #8069ef29}
.grow-input input{flex:1;min-width:0;border:0!important;box-shadow:none!important;background:transparent!important;font-size:15px;min-height:42px}
.grow-input .btn{min-height:42px;padding:8px 18px;white-space:nowrap}
#growHint{margin:0;font-size:var(--fs-sm);max-width:68ch}
.ov-live{position:relative;margin:0;display:inline-flex;align-items:center;gap:8px;justify-self:end;font-size:var(--fs-sm);color:#9fe6df}
.ov-live .live-dot{width:7px;height:7px;border-radius:50%;background:var(--green);box-shadow:0 0 0 0 #38d3a466;animation:ov-ping 2.2s ease-out infinite}
@keyframes ov-ping{70%{box-shadow:0 0 0 8px #38d3a400}100%{box-shadow:0 0 0 0 #38d3a400}}
.insights{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px;margin-bottom:14px}
.insights:empty{display:none}
.insight{display:grid;grid-template-columns:28px minmax(0,1fr);gap:12px;padding:16px;border-radius:16px;border:1px solid var(--line);background:var(--panel);animation:ov-in .45s cubic-bezier(.2,.8,.2,1) both}
.insight svg{width:22px;height:22px;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;margin-top:2px}
.insight[data-tone=good] svg{stroke:var(--green)}.insight[data-tone=warn] svg{stroke:var(--gold)}.insight[data-tone=info] svg{stroke:var(--cyan)}
.insight[data-tone=warn]{border-color:#5a4a2e}.insight[data-tone=good]{border-color:#2f5a4e}
.insight h3{margin:0 0 4px;font-size:var(--fs-lg);letter-spacing:-.01em;overflow-wrap:anywhere}
.insight p{margin:0 0 8px;font-size:var(--fs-md)}
.insight-empty{grid-column:1/-1;margin:0;padding:12px 16px;border:1px dashed #3a4862;border-radius:14px;font-size:var(--fs-md)}
@keyframes ov-in{from{opacity:0;transform:translateY(6px)}}
.kpi{position:relative}
.kpi b{font-variant-numeric:tabular-nums}
.kpi-chip{position:absolute;right:14px;top:12px;font-size:var(--fs-sm);font-weight:750;color:var(--green);animation:ov-chip 1.4s ease-out forwards;pointer-events:none}
@keyframes ov-chip{0%{opacity:0;transform:translateY(6px)}20%{opacity:1}100%{opacity:0;transform:translateY(-14px)}}
@media(max-width:750px){.ov-hero{padding:18px 16px}.grow-input{flex-wrap:wrap}.grow-input .btn{width:100%}.ov-live{justify-self:start}.ov-pulse{-webkit-mask-image:linear-gradient(180deg,#000,transparent 70%);mask-image:linear-gradient(180deg,#000,transparent 70%)}}
@media(prefers-reduced-motion:reduce){.ov-pulse circle,.ov-live .live-dot,.insight,.kpi-chip{animation:none!important}}
.insight .link{font-size:var(--fs-md);font-weight:650}

/* v5.3 survey results in the participants view */
.survey-result{margin:12px 0;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--panel2)}
.survey-result h3{margin:0 0 2px;font-size:var(--fs-md)}
.survey-bar{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,2fr) auto;gap:10px;align-items:center;margin-top:8px;font-size:var(--fs-sm)}
.survey-bar b{font-variant-numeric:tabular-nums;white-space:nowrap}

/* v5.5 share & embed panel */
.share-panel{display:grid;gap:18px}
.share-panel section{display:grid;gap:8px}
.share-panel h3{margin:0;font-size:var(--fs-lg)}
.share-panel h4{margin:6px 0 0;font-size:var(--fs-md);color:var(--muted)}
.share-panel .helper{margin:0}
.share-row{display:flex;gap:8px}.share-row input{flex:1;min-width:0}
.share-qr{display:grid;grid-template-columns:168px minmax(0,1fr);gap:14px;align-items:start}
.share-qr img{width:168px;height:168px;border-radius:10px;background:#fff;padding:6px;image-rendering:pixelated}
.share-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.share-preview{padding:14px;border-radius:12px;background:#f4f6fb;overflow:auto}
.share-panel textarea{font:12px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace;width:100%}
@media(max-width:480px){.share-qr{grid-template-columns:1fr}}
