/* MalGuard AI — pro chat UI layer (loads last). Night = deep space, Day = bright sky. */
body.mg-pro{
 --p-bg:#07080c;--p-side:rgba(14,15,20,.92);--p-surface:rgba(24,26,33,.86);--p-raised:#1b1d25;--p-hover:rgba(255,255,255,.07);
 --p-border:rgba(255,255,255,.10);--p-text:#f2f3f6;--p-muted:#9ea3b0;--p-accent:#7cc4ff;--p-accent-ink:#06131f;
 --p-user:#22252f;--p-shadow:0 18px 50px rgba(0,0,0,.45);--p-radius:16px;
 font-family:Inter,"Vazirmatn",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:var(--p-text);
}
html.theme-light body.mg-pro,html[data-theme=light] body.mg-pro{
 --p-bg:#e9f4fc;--p-side:rgba(255,255,255,.78);--p-surface:rgba(255,255,255,.92);--p-raised:#ffffff;--p-hover:rgba(10,40,70,.06);
 --p-border:rgba(15,40,70,.13);--p-text:#0f1b2a;--p-muted:#4d5d70;--p-accent:#0a6fd1;--p-accent-ink:#fff;
 --p-user:#dcecf9;--p-shadow:0 18px 44px rgba(20,60,110,.16);
 background:linear-gradient(180deg,#8ec8ec 0%,#bfe0f6 30%,#e8f4fc 70%,#f6fafd 100%) fixed!important;color:var(--p-text)!important;
}
body.mg-pro .pro-native{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;overflow:hidden!important;clip:rect(0 0 0 0)!important}

/* Sidebar */
body.mg-pro #navigation{background:var(--p-side)!important;backdrop-filter:blur(18px);border-inline-end:1px solid var(--p-border)!important;color:var(--p-text)!important;padding:10px!important;gap:4px}
body.mg-pro #navigation :is(button,a){color:var(--p-text)!important}
body.mg-pro .navigation-new{display:flex!important;align-items:center;gap:10px;width:100%;min-height:40px;padding:8px 12px!important;border-radius:12px!important;border:1px solid var(--p-border)!important;background:var(--p-surface)!important;font-weight:600;font-size:14px}
body.mg-pro .navigation-new:hover,body.mg-pro .navigation-shortcut:hover,body.mg-pro .history-open:hover{background:var(--p-hover)!important}
body.mg-pro .navigation-shortcut{border-radius:10px!important;min-height:36px;padding:6px 10px!important;font-size:14px;background:transparent!important;border:0!important}
body.mg-pro .navigation-shortcut[aria-pressed=true]{background:var(--p-hover)!important;font-weight:600}
body.mg-pro .navigation-shortcuts-label,body.mg-pro .navigation-label,body.mg-pro .history-group{color:var(--p-muted)!important;font-size:11.5px!important;font-weight:600;letter-spacing:.04em;text-transform:none;margin:14px 10px 4px!important}
body.mg-pro #chat-search{width:100%;min-height:36px;border-radius:10px!important;border:1px solid var(--p-border)!important;background:var(--p-surface)!important;color:var(--p-text)!important;padding:6px 12px!important;background-image:none!important;font-size:13.5px}
body.mg-pro .history-row{display:flex;align-items:center;border-radius:10px;position:relative}
body.mg-pro .history-open{flex:1;text-align:start;min-height:34px;padding:6px 10px!important;border-radius:10px!important;background:transparent!important;border:0!important;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.mg-pro .history-open[aria-current=true]{background:var(--p-hover)!important;font-weight:600}
body.mg-pro .history-more{opacity:0;width:28px;height:28px;border-radius:8px;border:0;background:transparent;color:var(--p-muted)!important}
body.mg-pro .history-row:hover .history-more,body.mg-pro .history-more[aria-expanded=true]{opacity:1}
body.mg-pro .history-more svg{width:16px;height:16px}
body.mg-pro .history-menu{position:absolute;inset-inline-end:4px;top:34px;z-index:50;min-width:160px;padding:6px;border-radius:12px;background:var(--p-raised);border:1px solid var(--p-border);box-shadow:var(--p-shadow);display:grid}
body.mg-pro .history-menu[hidden]{display:none}
body.mg-pro .history-menu button{text-align:start;padding:8px 10px;border-radius:8px;border:0;background:transparent;font-size:13.5px}
body.mg-pro .history-menu button:hover{background:var(--p-hover)}
body.mg-pro .history-menu .danger{color:#ff6b6b!important}
body.mg-pro .navigation-note{color:var(--p-muted)!important;font-size:12px}
body.mg-pro .navigation-footer{border-top:1px solid var(--p-border)!important;padding-top:8px}
body.mg-pro .navigation-footer a{display:block;padding:7px 10px;border-radius:10px;font-size:13.5px;text-decoration:none}
body.mg-pro .navigation-footer a:hover{background:var(--p-hover)}

/* Header */
body.mg-pro .site-header{background:transparent!important;border:0!important;backdrop-filter:none!important;gap:8px;min-height:56px}
body.mg-pro .experience-tabs{background:var(--p-surface)!important;border:1px solid var(--p-border)!important;border-radius:12px!important;padding:3px!important}
body.mg-pro .experience-tab{border-radius:9px!important;color:var(--p-muted)!important;background:transparent!important;border:0!important}
body.mg-pro .experience-tab[aria-pressed=true]{background:var(--p-hover)!important;color:var(--p-text)!important}
body.mg-pro .experience-current{display:none!important}
body.mg-pro .header-actions{display:flex;align-items:center;gap:6px}
body.mg-pro .header-actions>:is(a,button):not(.pro-theme),body.mg-pro .pro-help-link{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:6px 12px;border-radius:10px!important;border:1px solid var(--p-border)!important;background:var(--p-surface)!important;color:var(--p-text)!important;font-size:13px;font-weight:600;text-decoration:none}
body.mg-pro .header-actions>:is(a,button):hover{background:var(--p-hover)!important}
body.mg-pro #account{background:var(--p-text)!important;color:var(--p-bg)!important;border-color:transparent!important}
body.mg-pro .mg-theme-toggle.pro-theme{position:static!important;width:36px!important;height:36px!important;border-radius:10px!important;box-shadow:none!important;background:var(--p-surface)!important;border:1px solid var(--p-border)!important;color:var(--p-text)!important}
body.mg-pro .pro-lang{font-family:inherit;min-width:40px}

/* Custom select */
body.mg-pro .pro-select{position:relative;display:inline-flex}
body.mg-pro .pro-select[hidden]{display:none}
body.mg-pro .pro-select-button{display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:6px 10px 6px 12px;border-radius:10px;border:1px solid var(--p-border);background:var(--p-surface);color:var(--p-text);font:inherit;font-size:13.5px;font-weight:600;cursor:pointer;max-width:100%}
body.mg-pro .pro-select-button:hover{background:var(--p-hover)}
body.mg-pro .pro-select-button:disabled{opacity:.55;cursor:default}
body.mg-pro .pro-select-button:focus-visible,body.mg-pro .pro-option.is-active{outline:2px solid color-mix(in srgb,var(--p-accent) 55%,transparent);outline-offset:1px}
body.mg-pro .pro-select-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.mg-pro .pro-select-sub{color:var(--p-muted);font-weight:500;white-space:nowrap}
body.mg-pro .pro-select-sub:empty{display:none}
body.mg-pro .pro-chev{width:16px;height:16px;flex:none;color:var(--p-muted);transition:transform .15s}
body.mg-pro .pro-select.is-open .pro-chev{transform:rotate(180deg)}
body.mg-pro .pro-select-model .pro-select-button{border-color:transparent;background:transparent;font-size:16px;padding-inline:10px}
body.mg-pro .pro-select-model .pro-select-button:hover{background:var(--p-hover)}
body.mg-pro .pro-select-list{position:absolute;top:calc(100% + 6px);inset-inline-start:0;z-index:2000;min-width:280px;max-width:min(380px,92vw);max-height:min(420px,70vh);overflow:auto;padding:6px;border-radius:14px;background:var(--p-raised);border:1px solid var(--p-border);box-shadow:var(--p-shadow);color:var(--p-text)}
body.mg-pro .pro-select-list:focus{outline:none}
body.mg-pro .pro-group{padding:10px 10px 4px;font-size:11.5px;font-weight:600;color:var(--p-muted)}
body.mg-pro .pro-option{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:10px;cursor:pointer;font-size:14px}
body.mg-pro .pro-option:hover,body.mg-pro .pro-option.is-active{background:var(--p-hover);outline:none}
body.mg-pro .pro-option[aria-disabled=true]{opacity:.45;cursor:not-allowed}
body.mg-pro .pro-option-text{display:grid;flex:1;min-width:0}
body.mg-pro .pro-option-title{font-weight:600}
body.mg-pro .pro-option-sub{font-size:12.5px;color:var(--p-muted)}
body.mg-pro .pro-check{visibility:hidden;color:var(--p-accent);font-weight:700}
body.mg-pro .pro-option[aria-selected=true] .pro-check{visibility:visible}
body.mg-pro .pro-new{font-size:10px;font-weight:700;letter-spacing:.04em;padding:2px 6px;border-radius:999px;background:#22c55e22;color:#22c55e;border:1px solid #22c55e55}
body.mg-pro .pro-new[hidden]{display:none}
body.mg-pro .model-select-wrap,body.mg-pro #composer-model-new,body.mg-pro #workspace-model-new{display:none!important}

/* Main column */
body.mg-pro .workspace{max-width:none!important}
body.mg-pro .conversation,body.mg-pro .composer-area,body.mg-pro .intro,body.mg-pro .build-panel{width:min(780px,calc(100% - 32px))!important;margin-inline:auto!important}
body.mg-pro .intro h1{font-size:clamp(26px,3.4vw,34px)!important;font-weight:650!important;letter-spacing:-.02em;color:var(--p-text)!important}
body.mg-pro .experience-eyebrow{color:var(--p-muted)!important}
body.mg-pro .quick-suggestions{display:flex!important;flex-wrap:wrap;justify-content:center;gap:8px}
body.mg-pro .quick-suggestion{border-radius:999px!important;border:1px solid var(--p-border)!important;background:var(--p-surface)!important;color:var(--p-text)!important;padding:8px 14px!important;min-height:38px;font-size:13.5px;box-shadow:none!important}
body.mg-pro .quick-suggestion:hover{background:var(--p-hover)!important}
body.mg-pro .quick-suggestion svg{width:16px;height:16px;color:var(--p-muted)}

/* Messages */
body.mg-pro .conversation .bubble{background:var(--p-user)!important;color:var(--p-text)!important;border:0!important;border-radius:20px!important;padding:10px 16px!important;max-width:78%;margin-inline-start:auto;box-shadow:none!important;font-size:15px;line-height:1.55}
body.mg-pro .conversation .assistant-message,body.mg-pro .conversation .result{background:transparent!important;border:0!important;box-shadow:none!important;padding:4px 0!important;color:var(--p-text)!important}
body.mg-pro .conversation .result:not(.assistant-message){background:var(--p-surface)!important;border:1px solid var(--p-border)!important;border-radius:var(--p-radius)!important;padding:14px 16px!important}
body.mg-pro .answer{font-size:15.5px;line-height:1.7;color:var(--p-text)!important}
body.mg-pro .answer :is(h3,h4,h5,h6){margin:18px 0 6px;font-weight:650}
body.mg-pro .answer .md-list{padding-inline-start:22px;margin:6px 0}
body.mg-pro .answer .md-quote{border-inline-start:3px solid var(--p-border);padding-inline-start:12px;color:var(--p-muted);margin:8px 0}
body.mg-pro .answer .md-inline-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.88em;padding:1px 6px;border-radius:6px;background:var(--p-hover)}
body.mg-pro .answer a{color:var(--p-accent)}
body.mg-pro .code-block{border-radius:12px!important;overflow:hidden;border:1px solid var(--p-border)!important;background:#0d0f14!important;margin:10px 0}
body.mg-pro .code-block-header{display:flex;justify-content:space-between;align-items:center;padding:6px 12px!important;background:#161922!important;color:#aab0bd!important;font-size:12px}
body.mg-pro .code-block pre{color:#e6e8ee!important;padding:12px 14px!important;margin:0;font-size:13px;overflow:auto}
body.mg-pro .code-copy{border:0!important;background:transparent!important;color:#aab0bd!important;font-size:12px;cursor:pointer}
body.mg-pro .response-actions{display:flex;gap:4px;margin-top:6px}
body.mg-pro .response-actions :is(button,summary){width:30px;height:30px;border-radius:8px;display:inline-grid;place-items:center;color:var(--p-muted)!important;background:transparent!important;border:0!important}
body.mg-pro .response-actions :is(button,summary):hover{background:var(--p-hover)!important;color:var(--p-text)!important}

/* Composer */
body.mg-pro .composer-shell{background:var(--p-surface)!important;border:1px solid var(--p-border)!important;border-radius:24px!important;box-shadow:var(--p-shadow)!important;padding:10px 10px 8px 14px!important;backdrop-filter:blur(14px)}
body.mg-pro .composer-shell:focus-within{border-color:color-mix(in srgb,var(--p-accent) 45%,var(--p-border))!important}
body.mg-pro #message{background:transparent!important;color:var(--p-text)!important;border:0!important;box-shadow:none!important;font-size:15.5px!important;line-height:1.5;min-height:28px;max-height:240px;resize:none;padding:6px 4px!important;outline:none!important}
body.mg-pro #message::placeholder{color:var(--p-muted)}
body.mg-pro .composer-footer{display:flex;align-items:center;justify-content:space-between;gap:6px}
body.mg-pro .composer-actions{display:flex;align-items:center;gap:6px}
body.mg-pro #attach-toggle,body.mg-pro #thinking-toggle,body.mg-pro #web-search-toggle{min-height:34px;border-radius:999px!important;border:1px solid var(--p-border)!important;background:transparent!important;color:var(--p-text)!important;padding:4px 10px!important;display:inline-flex;align-items:center;gap:6px;font-size:13px}
body.mg-pro #attach-toggle{width:34px;padding:0!important;justify-content:center}
body.mg-pro :is(#thinking-toggle,#web-search-toggle)[aria-pressed=true]{background:color-mix(in srgb,var(--p-accent) 16%,transparent)!important;color:var(--p-accent)!important;border-color:color-mix(in srgb,var(--p-accent) 40%,transparent)!important}
body.mg-pro #send{width:36px!important;height:36px!important;border-radius:999px!important;border:0!important;background:var(--p-text)!important;color:var(--p-bg)!important;display:grid;place-items:center}
body.mg-pro #send:disabled{opacity:.35}
body.mg-pro #attach-options{position:absolute;bottom:calc(100% + 8px);inset-inline-start:0;z-index:60;min-width:240px;padding:6px;border-radius:14px;background:var(--p-raised)!important;border:1px solid var(--p-border)!important;box-shadow:var(--p-shadow);display:grid;gap:2px}
body.mg-pro #attach-options[hidden]{display:none}
body.mg-pro .attach-menu{position:relative}
body.mg-pro #attach-options>button,body.mg-pro .ai-menu-capabilities>*{justify-content:flex-start;text-align:start;padding:9px 10px!important;border-radius:10px!important;border:0!important;background:transparent!important;color:var(--p-text)!important;font-size:14px;width:100%}
body.mg-pro #attach-options>button:hover{background:var(--p-hover)!important}
body.mg-pro .composer-hints,body.mg-pro .footer-note,body.mg-pro .web-search-hint{color:var(--p-muted)!important;font-size:12px!important;text-align:center}
body.mg-pro .download-entry{color:var(--p-muted)!important;background:transparent!important;border:0!important;font-size:12.5px}
body.mg-pro .workspace-panel{background:var(--p-surface)!important;border:1px solid var(--p-border)!important;border-radius:var(--p-radius)!important;padding:10px 14px!important;margin-bottom:8px}
body.mg-pro .workspace-options{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
body.mg-pro .pro-model-slot{display:flex;align-items:center}

/* Settings & dialogs */
body.mg-pro .settings-content,body.mg-pro dialog{background:var(--p-raised)!important;color:var(--p-text)!important;border:1px solid var(--p-border)!important;border-radius:18px!important;box-shadow:var(--p-shadow)!important}
body.mg-pro dialog::backdrop{background:rgba(0,0,0,.45);backdrop-filter:blur(4px)}
body.mg-pro :is(.settings-content,dialog) button{border-radius:10px!important}
body.mg-pro .primary-action{background:var(--p-text)!important;color:var(--p-bg)!important;border:0!important}

/* Day readability */
html.theme-light body.mg-pro :is(h1,h2,h3,h4,p,span,label,strong,li,summary){color:inherit}
html.theme-light body.mg-pro .code-block{background:#0f1720!important}

/* RTL */
html[dir=rtl] body.mg-pro .conversation .bubble{margin-inline-start:auto}
html[dir=rtl] body.mg-pro{font-family:"Vazirmatn",Tahoma,system-ui,sans-serif}

/* Mobile */
@media (max-width:760px){
 body.mg-pro .experience-tabs{display:none!important}
 body.mg-pro .pro-help-link,body.mg-pro #sign-up{display:none!important}
 body.mg-pro .pro-select-model .pro-select-sub{display:none}
 body.mg-pro .conversation,body.mg-pro .composer-area,body.mg-pro .intro{width:calc(100% - 20px)!important}
 body.mg-pro .conversation .bubble{max-width:88%}
 body.mg-pro .pro-select-list{position:fixed;inset-inline:8px;top:60px;max-width:none}
 /* Overlay the drawer; do not shift the page 270px (that squeezed the header and overflowed at 360px). */
 body.mg-pro.mg-ai-v2:not(.navigation-closed):not(.auth-required),
 body.mg-pro.mg-ai-v2:not(.navigation-closed){padding-left:0!important;padding-right:0!important}
 body.mg-pro .account-entry{max-width:56px!important}
 body.mg-pro .pro-lang{min-width:32px;padding-inline:6px}
}
@media (max-width:400px){
 /* Language remains in Settings; the compact header must fit a signed-in name. */
 body.mg-pro .pro-lang{display:none!important}
 body.mg-pro .account-entry{max-width:64px!important}
}
/* Contain header chrome at all widths, including 768px with the 270px sidebar. */
body.mg-pro .site-header{max-width:100%;min-width:0;overflow:hidden;box-sizing:border-box}
body.mg-pro .pro-model-slot,body.mg-pro .pro-select-model{min-width:0;flex:1 1 auto;max-width:100%;overflow:hidden}
body.mg-pro .header-actions{min-width:0;flex:0 1 auto;max-width:100%}
html.theme-light body.mg-pro::before,html.theme-light body.mg-pro::after{background:none!important;opacity:0!important}
html.theme-light body.mg-pro :is(main,.workspace,.site-header){background:transparent!important}
html.theme-light:has(body.mg-pro){background:#bfe0f6!important}

/* Pass 2: day sky (beats experience-v2/mg-theme body paints) */
html.theme-light body.mg-pro.mg-ai-v2.mg-deep-space,html[data-theme=light] body.mg-pro.mg-ai-v2.mg-deep-space{
 background-color:#bfe0f6!important;
 background-image:radial-gradient(120% 60% at 80% -10%,rgba(255,244,214,.85) 0%,rgba(255,244,214,0) 45%),linear-gradient(180deg,#6fb6e6 0%,#9fd1f1 28%,#cde8f8 60%,#eef7fd 100%)!important;
 background-attachment:fixed!important;color:#0f1b2a!important}
html.theme-light body.mg-pro.mg-ai-v2.mg-deep-space::before,html.theme-light body.mg-pro.mg-ai-v2.mg-deep-space::after,
html[data-theme=light] body.mg-pro.mg-ai-v2.mg-deep-space::before,html[data-theme=light] body.mg-pro.mg-ai-v2.mg-deep-space::after{background:none!important;opacity:0!important;display:none!important}
html.theme-light body.mg-pro.mg-ai-v2 #navigation{background:rgba(255,255,255,.62)!important}
html.theme-light body.mg-pro.mg-ai-v2 :is(.intro h1,.answer,.bubble,#message,.history-open,.navigation-new){color:#0f1b2a!important}
html.theme-light body.mg-pro.mg-ai-v2 :is(.composer-hints,.footer-note,.download-entry,.experience-eyebrow,.navigation-note){color:#33475e!important}

/* Pass 2: RTL shell mirroring */
html[dir=rtl] body.mg-pro{direction:rtl}
html[dir=rtl] body.mg-pro.mg-ai-v2 #navigation{left:auto!important;right:0!important;direction:rtl;border-right:0!important;border-left:1px solid var(--p-border)!important}
html[dir=rtl] body.mg-pro.mg-ai-v2:not(.navigation-closed):not(.auth-required){padding-left:0!important;padding-right:270px!important}
html[dir=rtl] body.mg-pro.mg-ai-v2.navigation-closed{padding-right:0!important}
html[dir=rtl] body.mg-pro .site-header{direction:rtl}
html[dir=rtl] body.mg-pro .pro-select-model,html[dir=rtl] body.mg-pro .experience-tabs{direction:rtl}
html[dir=rtl] body.mg-pro .navigation-heading #mode-toggle{direction:ltr}
html[dir=rtl] body.mg-pro .history-open{text-align:right}
@media (max-width:760px){html[dir=rtl] body.mg-pro.mg-ai-v2:not(.navigation-closed):not(.auth-required){padding-right:0!important}}
.pro-demo-badge{position:fixed;bottom:10px;inset-inline-end:12px;z-index:3000;font-size:12px;font-weight:600;padding:5px 10px;border-radius:999px;background:#f59e0b;color:#1a1200;box-shadow:0 6px 18px #0004;pointer-events:none}
/* Pass 2 fixes */
body.mg-pro .pro-model-slot:not([data-mode=worker]) .pro-work-picker{display:none!important}
body.mg-pro .pro-model-slot[data-mode=worker] .pro-select:not(.pro-work-picker){display:none!important}
body.mg-pro .site-header{position:sticky;top:0;z-index:40;background:color-mix(in srgb,var(--p-bg) 72%,transparent)!important;backdrop-filter:blur(14px)!important;-webkit-backdrop-filter:blur(14px)!important}
html.theme-light body.mg-pro .site-header{background:rgba(160,210,240,.55)!important}
body.mg-pro .answer code.md-inline-code{display:inline!important;white-space:normal;width:auto!important;margin:0!important}
body.mg-pro .answer li{margin:3px 0}
body.mg-pro .md-table-wrap{overflow-x:auto;margin:10px 0;border:1px solid var(--p-border);border-radius:12px}
body.mg-pro .md-table{border-collapse:collapse;width:100%;font-size:14px}
body.mg-pro .md-table :is(th,td){padding:8px 12px;border-bottom:1px solid var(--p-border);text-align:start}
body.mg-pro .md-table th{background:var(--p-hover);font-weight:650}
body.mg-pro .md-table tr:last-child td{border-bottom:0}
html.theme-light body.mg-pro.mg-ai-v2 #navigation{background:rgba(255,255,255,.55)!important}
html.theme-light body.mg-pro.mg-ai-v2 .composer-shell{background:rgba(255,255,255,.9)!important}
html.theme-light body.mg-pro .composer-area{background:linear-gradient(180deg,transparent,rgba(220,238,250,.85) 40%)!important}

/* Day: white mono orbit marks are invisible on the bright sky. Recolor to day ink/navy. Night is unchanged. */
html.theme-light body.mg-pro :is(.ai-product-mark,.entry-mark,.account-product-mark),
html[data-theme=light] body.mg-pro :is(.ai-product-mark,.entry-mark,.account-product-mark){
  filter:invert(1) brightness(.18) sepia(1) saturate(2.8) hue-rotate(180deg);
}
html.theme-light body.mg-pro .entry-brand,
html[data-theme=light] body.mg-pro .entry-brand{color:#0f1b2a!important}

/* Hide the old settings dropdown; the pro modal replaces it. */
body.mg-pro #settings-panel>.settings-content{display:none!important}
body.mg-pro .navigation-footer .settings-panel>summary{width:100%;height:auto;min-height:44px;justify-content:flex-start;gap:10px;border-radius:10px!important;padding:8px 10px!important;color:var(--p-text)!important}

/* Settings modal */
body.mg-pro #pro-settings{width:min(720px,calc(100vw - 24px));max-height:min(760px,calc(100svh - 24px));padding:0;border:1px solid var(--p-border);border-radius:22px;background:var(--p-raised);color:var(--p-text);box-shadow:var(--p-shadow);overflow:hidden;display:flex;flex-direction:column}
body.mg-pro #pro-settings:not([open]){display:none}
.pro-settings-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 18px 8px}
.pro-settings-title{margin:0;font-size:22px;font-weight:700;letter-spacing:-.02em;color:var(--p-text)!important}
.pro-settings-close{width:40px;height:40px;border:0!important;border-radius:12px!important;background:transparent!important;color:var(--p-text)!important;display:grid;place-items:center;flex:none}
.pro-settings-close:hover{background:var(--p-hover)!important}
.pro-settings-tabs{display:flex;gap:4px;padding:4px 12px 0;overflow:auto;scrollbar-width:thin;border-bottom:1px solid var(--p-border)}
.pro-settings-tab{flex:none;min-height:44px;padding:8px 14px!important;border:0!important;border-radius:0!important;background:transparent!important;color:var(--p-muted)!important;font-weight:600;font-size:14px;box-shadow:none!important;border-bottom:2px solid transparent!important}
.pro-settings-tab.is-active{color:var(--p-text)!important;border-bottom-color:var(--p-accent)!important}
.pro-settings-tab:hover{background:var(--p-hover)!important}
.pro-settings-body{padding:16px 20px 22px;overflow:auto;min-height:0}
.pro-settings-pane{display:grid;gap:14px}
.pro-settings-pane[hidden]{display:none!important}
.pro-set-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 0;border-bottom:1px solid var(--p-border)}
.pro-set-meta{min-width:0;flex:1}
.pro-set-label{font-weight:650;font-size:15px}
.pro-set-hint{margin:4px 0 0;color:var(--p-muted)!important;font-size:13px;line-height:1.55}
.pro-seg{display:inline-flex;flex:none;padding:3px;border-radius:12px;background:var(--p-hover);border:1px solid var(--p-border);gap:2px}
.pro-seg-btn{min-height:36px;min-width:64px;padding:6px 12px!important;border:0!important;border-radius:10px!important;background:transparent!important;color:var(--p-muted)!important;font-weight:600;font-size:13px}
.pro-seg-btn.is-active{background:var(--p-raised)!important;color:var(--p-text)!important;box-shadow:0 1px 4px rgba(0,0,0,.12)}
.pro-set-actions{display:flex;flex-wrap:wrap;gap:8px}
.pro-set-btn,body.mg-pro #pro-settings .pro-set-btn{min-height:44px;padding:8px 14px!important;border-radius:12px!important;border:1px solid var(--p-border)!important;background:var(--p-surface)!important;color:var(--p-text)!important;font-weight:600}
.pro-set-btn:hover{background:var(--p-hover)!important}
.pro-set-btn.danger,body.mg-pro #pro-settings .pro-set-btn.danger{color:#e35d5d!important;border-color:#e35d5d55!important}
body.mg-pro #pro-settings .composer-controls{display:grid;gap:8px;grid-template-columns:1fr}
body.mg-pro #pro-settings .composer-controls label{font-weight:650}
body.mg-pro #pro-settings :is(#device-note,#connection,#mode-hint,#model-status,#local-status,.notice,.footer-note){color:var(--p-muted)!important;font-size:13px;margin:0}
body.mg-pro #pro-settings .privacy-link{color:var(--p-accent)!important;font-weight:600}
body.mg-pro #pro-settings :is(.toolbox,.plugins-panel,.desktop-setup){border:1px solid var(--p-border);border-radius:14px;padding:8px 12px;background:var(--p-surface)}
body.mg-pro #pro-settings details>summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:650;list-style:none}
body.mg-pro #pro-settings details>summary::-webkit-details-marker{display:none}

/* Custom switches (no browser-default checkboxes) */
body.mg-pro .pro-switch{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin:10px 0;cursor:pointer;color:var(--p-text)}
body.mg-pro .pro-switch span{flex:1;font-size:13.5px;line-height:1.55}
body.mg-pro .pro-switch input[type=checkbox]{-webkit-appearance:none;appearance:none;width:44px;height:26px;flex:none;margin:2px 0 0;border:0;border-radius:999px;background:color-mix(in srgb,var(--p-muted) 45%,transparent);position:relative;cursor:pointer;transition:background .15s}
body.mg-pro .pro-switch input[type=checkbox]::after{content:"";position:absolute;top:3px;inset-inline-start:3px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:transform .15s}
body.mg-pro .pro-switch input[type=checkbox]:checked{background:var(--p-accent)}
body.mg-pro .pro-switch input[type=checkbox]:checked::after{transform:translateX(18px)}
html[dir=rtl] body.mg-pro .pro-switch input[type=checkbox]:checked::after{transform:translateX(-18px)}
body.mg-pro .pro-switch input[type=checkbox]:focus-visible{outline:2px solid var(--p-accent);outline-offset:3px}
@media (prefers-reduced-motion:reduce){body.mg-pro .pro-switch input[type=checkbox],body.mg-pro .pro-switch input[type=checkbox]::after{transition:none}}

/* Pro dialogs: account, consent, downloads, memory */
body.mg-pro dialog{width:min(520px,calc(100vw - 24px));max-height:min(88svh,820px);padding:22px 22px 18px;overflow:auto;color:var(--p-text)}
body.mg-pro dialog#pro-settings{width:min(720px,calc(100vw - 24px))}
body.mg-pro dialog h2{margin:0 0 12px;font-size:22px;font-weight:700;color:var(--p-text)!important}
body.mg-pro dialog p,body.mg-pro dialog label{color:var(--p-text)}
body.mg-pro dialog .muted,body.mg-pro dialog .account-note{color:var(--p-muted)!important}
body.mg-pro dialog :is(input:not([type=checkbox]):not([type=file]):not([type=radio]),textarea,select){width:100%;min-height:44px;border-radius:12px!important;border:1px solid var(--p-border)!important;background:var(--p-surface)!important;color:var(--p-text)!important;padding:10px 12px;font:inherit}
body.mg-pro dialog textarea{min-height:90px}
body.mg-pro dialog .download-actions,body.mg-pro .ai-account .account-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;margin-top:16px}
body.mg-pro dialog .download-actions button,body.mg-pro dialog .primary-action,body.mg-pro .ai-account button{min-height:44px;border-radius:12px!important;border:1px solid var(--p-border)!important;background:var(--p-surface)!important;color:var(--p-text)!important;padding:8px 14px;font-weight:600}
body.mg-pro dialog .primary-action,body.mg-pro .ai-account .account-submit{background:var(--p-text)!important;color:var(--p-bg)!important;border-color:transparent!important}
body.mg-pro .ai-account{width:min(460px,calc(100vw - 24px))}
body.mg-pro .ai-account .account-close{margin-inline-start:auto;display:block}
body.mg-pro dialog .download-route{display:grid;gap:4px;width:100%;text-align:start;margin:8px 0;padding:14px!important;border-radius:14px!important;border:1px solid var(--p-border)!important;background:var(--p-surface)!important;color:var(--p-text)!important}
body.mg-pro dialog .download-route:hover{background:var(--p-hover)!important}
body.mg-pro dialog .desktop-compat-form{display:grid;gap:10px;margin:12px 0}
body.mg-pro #desktop-command,body.mg-pro dialog pre{background:#0d0f14;color:#e6e8ee;border-radius:12px;padding:12px;overflow:auto;direction:ltr;text-align:left}
body.mg-pro .history-rename{width:100%;min-height:32px;border-radius:8px;border:1px solid var(--p-border);background:var(--p-surface);color:var(--p-text);padding:4px 8px}
html.theme-light body.mg-pro dialog,html[data-theme=light] body.mg-pro dialog{background:var(--p-raised)}
html.theme-light body.mg-pro #desktop-command,html.theme-light body.mg-pro dialog pre{background:#0f1720}

@media (max-width:760px){
 .pro-settings-tab{padding:8px 10px!important;font-size:13px}
 body.mg-pro #pro-settings{width:calc(100vw - 12px);max-height:calc(100svh - 12px);border-radius:18px}
 .pro-set-row{flex-direction:column;align-items:stretch}
 .pro-seg{width:100%;display:flex}
 .pro-seg-btn{flex:1}
 .pro-settings-tabs{padding-inline:8px}
}

/* ===== Mobile polish 2026-11-11: floating pickers, bottom sheets, ordered "+" menu ===== */
@keyframes pro-sheet-up{from{transform:translateY(100%)}to{transform:none}}
@keyframes pro-fade{from{opacity:0}to{opacity:1}}
/* Picker lists are moved to <body> (or their dialog) while open so the header's overflow/blur can't clip them. */
body.mg-pro .pro-select-list.pro-floating{position:fixed;z-index:2147482000;min-width:0;max-width:none;margin:0;overscroll-behavior:contain}
body.mg-pro .pro-select-list.pro-sheet{position:fixed!important;left:0!important;right:0!important;bottom:0!important;top:auto!important;width:auto!important;max-width:none!important;min-width:0!important;max-height:min(80dvh,640px)!important;padding:0 10px calc(12px + env(safe-area-inset-bottom))!important;border-radius:22px 22px 0 0!important;border-bottom:0!important;z-index:2147483001;animation:pro-sheet-up .22s cubic-bezier(.2,.8,.2,1)}
body.mg-pro .pro-sheet-head{position:sticky;top:0;z-index:1;display:grid;justify-items:center;gap:8px;padding:8px 6px 10px;background:var(--p-raised)}
body.mg-pro .pro-sheet-grip{width:38px;height:4px;border-radius:99px;background:color-mix(in srgb,var(--p-muted) 55%,transparent)}
body.mg-pro .pro-sheet-title{justify-self:stretch;text-align:center;font-weight:700;font-size:16px;color:var(--p-text)}
body.mg-pro .pro-sheet .pro-option{min-height:52px;padding:10px 12px;font-size:15px;border-radius:12px}
body.mg-pro .pro-sheet .pro-option-sub{font-size:13px}
body.mg-pro .pro-sheet .pro-group{padding:12px 12px 6px;font-size:12px}
body.mg-pro .pro-sheet .pro-check{font-size:17px}
.pro-sheet-backdrop{position:fixed;inset:0;z-index:2147483000;background:rgba(0,0,0,.48);animation:pro-fade .18s ease-out;-webkit-tap-highlight-color:transparent}
html.pro-sheet-open,html.pro-attach-open{overflow:hidden}

/* "+" menu: one clean column, icon + label, toggles with switches, fixed order */
body.mg-pro #attach-options.pro-attach{display:flex;flex-direction:column;gap:2px}
body.mg-pro #attach-options.pro-attach[hidden]{display:none!important}
body.mg-pro .pro-attach-head{display:none;order:0}
body.mg-pro #attach-file{order:1}
body.mg-pro #attach-media-analyze{order:2}
body.mg-pro #attach-media-generate{order:3}
body.mg-pro #attach-options .ai-menu-capabilities{order:4;display:flex;flex-direction:column;gap:2px;margin:4px 0;padding:4px 0;border-top:1px solid var(--p-border);border-bottom:1px solid var(--p-border)}
body.mg-pro #attach-chat{order:5}
body.mg-pro #attach-inspect{order:6}
body.mg-pro #attach-web{order:7}
body.mg-pro #attach-options .web-search-controls{display:flex;flex-direction:column;align-items:stretch;gap:4px;width:100%;margin:0!important;padding:0!important;border:0!important;background:transparent!important}
body.mg-pro #attach-options .pro-menu-row{display:flex!important;align-items:center;justify-content:flex-start;gap:12px;width:100%;min-height:46px;margin:0;padding:10px 12px!important;border-radius:12px!important;border:0!important;background:transparent!important;color:var(--p-text)!important;font-size:14.5px;font-weight:500;line-height:1.35;text-align:start;box-shadow:none!important;flex:none}
body.mg-pro #attach-options .pro-menu-row[hidden]{display:none!important}
body.mg-pro #attach-options .pro-menu-row:hover:not(:disabled),body.mg-pro #attach-options .pro-menu-row:active:not(:disabled){background:var(--p-hover)!important}
body.mg-pro #attach-options .pro-menu-row:disabled{opacity:.5}
body.mg-pro #attach-options .pro-menu-row::before{content:"";flex:none;width:20px;height:20px;background:currentColor;-webkit-mask:var(--pro-icon) center/contain no-repeat;mask:var(--pro-icon) center/contain no-repeat;opacity:.88}
body.mg-pro #attach-options .pro-menu-row>svg,body.mg-pro #attach-options .pro-menu-row .thinking-glyph{display:none!important}
body.mg-pro #attach-options .pro-menu-row>span{flex:1;min-width:0;color:inherit!important}
body.mg-pro [data-icon=clip]{--pro-icon:url(./icons/clip.svg)}
body.mg-pro [data-icon=image]{--pro-icon:url(./icons/image.svg)}
body.mg-pro [data-icon=wand]{--pro-icon:url(./icons/wand.svg)}
body.mg-pro [data-icon=chat]{--pro-icon:url(./icons/chat.svg)}
body.mg-pro [data-icon=shield]{--pro-icon:url(./icons/shield.svg)}
body.mg-pro [data-icon=globe]{--pro-icon:url(./icons/globe.svg)}
body.mg-pro [data-icon=spark]{--pro-icon:url(./icons/spark.svg)}
/* Toggle rows: a switch at the end instead of a coloured pill */
body.mg-pro #attach-options .pro-menu-switch[aria-pressed]{color:var(--p-text)!important}
body.mg-pro #attach-options .pro-menu-switch::after{content:"";flex:none;margin-inline-start:auto;width:40px;height:24px;border-radius:999px;background:radial-gradient(circle,#fff 0 8.5px,transparent 9.5px) no-repeat left 1px center/22px 22px,color-mix(in srgb,var(--p-muted) 42%,transparent);transition:background-position .15s,background-color .15s}
body.mg-pro #attach-options .pro-menu-switch[aria-pressed=true]::after{background:radial-gradient(circle,#fff 0 8.5px,transparent 9.5px) no-repeat right 1px center/22px 22px,var(--p-accent)}
html[dir=rtl] body.mg-pro #attach-options .pro-menu-switch::after{background-position:right 1px center,0 0}
html[dir=rtl] body.mg-pro #attach-options .pro-menu-switch[aria-pressed=true]::after{background-position:left 1px center,0 0}
body.mg-pro #attach-options .pro-depth-seg{display:flex;margin:0 12px 6px;margin-inline-start:44px}
body.mg-pro #attach-options .pro-depth-seg[hidden]{display:none}
body.mg-pro #attach-options .pro-depth-seg .pro-seg-btn{flex:1;min-height:36px}
.pro-attach-backdrop{display:none}
@media (prefers-reduced-motion:reduce){body.mg-pro .pro-select-list.pro-sheet,.pro-sheet-backdrop,body.mg-pro #attach-options{animation:none!important}body.mg-pro #attach-options .pro-menu-switch::after{transition:none}}

@media (max-width:760px){
 /* "+" menu becomes a bottom sheet. The composer's blur would trap position:fixed, so drop it on phones. */
 body.mg-pro .composer-shell{backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
 body.mg-pro #attach-options.pro-attach{position:fixed!important;left:0!important;right:0!important;bottom:0!important;top:auto!important;width:auto!important;min-width:0!important;max-width:none!important;max-height:min(84dvh,660px)!important;overflow-y:auto;overscroll-behavior:contain;margin:0;padding:0 10px calc(12px + env(safe-area-inset-bottom))!important;border-radius:22px 22px 0 0!important;border-bottom:0!important;z-index:2!important;animation:pro-sheet-up .22s cubic-bezier(.2,.8,.2,1)}
 body.mg-pro #attach-options.pro-attach:not(.pro-attach-sheet){left:8px!important;right:8px!important;bottom:var(--pro-attach-bottom,8px)!important;max-height:calc(100dvh - var(--pro-attach-bottom,8px) - 12px)!important;padding:0 8px 8px!important;border-radius:20px!important;border-bottom:1px solid var(--p-border)!important;animation:pro-fade .16s ease-out}
 body.mg-pro #attach-options.pro-attach:not(.pro-attach-sheet) .pro-sheet-grip{display:none}
 body.mg-pro .pro-attach-head{display:grid}
 html.pro-attach-open body.mg-pro #attach-toggle{position:relative;z-index:3;background:var(--p-raised)!important}
 body.mg-pro #attach-toggle svg{transition:transform .18s}
 body.mg-pro #attach-toggle[aria-expanded=true] svg{transform:rotate(45deg)}
 html.pro-attach-open body.mg-pro .pro-attach-backdrop{display:block;position:fixed;inset:0;z-index:1;background:rgba(0,0,0,.48);animation:pro-fade .18s ease-out;-webkit-tap-highlight-color:transparent}
 html.pro-attach-open body.mg-pro .composer-area{z-index:2147482500!important}
 html.pro-attach-open body.mg-pro .composer-area:not([style*=position]){position:relative}
 body.mg-pro #attach-options .pro-menu-row{min-height:52px;font-size:15.5px}
 body.mg-pro #attach-options .pro-menu-row::before{width:22px;height:22px}
 body.mg-pro #attach-options .pro-depth-seg{margin-inline-start:46px}
 /* Tap targets >= 44px */
 body.mg-pro #navigation-toggle{min-width:44px!important;min-height:44px!important;width:44px;height:44px;display:inline-grid;place-items:center;padding:0!important}
 body.mg-pro .mg-theme-toggle.pro-theme{width:44px!important;height:44px!important}
 body.mg-pro .header-actions>:is(a,button):not(.pro-theme){min-height:44px}
 body.mg-pro .pro-select-model .pro-select-button{min-height:44px}
 body.mg-pro .pro-lang{min-width:44px!important}
 body.mg-pro #attach-toggle{width:44px!important;height:44px!important;min-height:44px!important}
 body.mg-pro .attach-menu{width:44px;height:44px}
 body.mg-pro #send{width:44px!important;height:44px!important}
 body.mg-pro .response-actions :is(button,summary){width:40px;height:40px}
 /* The open drawer's dimmer covers the sticky header too. */
 body.mg-pro:not(.navigation-closed) #navigation-backdrop{z-index:45!important}
 body.mg-pro #navigation{z-index:46!important}
 /* Demo badge must never sit on top of drawers or sheets. */
 body.mg-pro:not(.navigation-closed) .pro-demo-badge,html:is(.pro-sheet-open,.pro-attach-open) .pro-demo-badge{display:none}
 .pro-demo-badge{bottom:auto;top:calc(64px + env(safe-area-inset-top));font-size:11px;padding:3px 8px;opacity:.92}
}
/* Latin model names inside RTL: truncate at the end, not the start */
body.mg-pro .pro-select-label,body.mg-pro .pro-option-title{unicode-bidi:plaintext}
/* Account: profile card + avatar (all widths), bottom sheet + avatar header button on phones */
body.mg-pro .ai-account .account-close{position:absolute;top:12px;inset-inline-end:12px;margin:0!important;width:40px;height:40px;min-height:40px!important;padding:0!important;border-radius:999px!important;font-size:0!important;display:grid!important;place-items:center}
body.mg-pro .ai-account .account-close::before{content:"✕";font-size:16px;line-height:40px;width:40px;text-align:center;color:var(--p-text)}
body.mg-pro .ai-account{position:fixed}
body.mg-pro .ai-account.pro-acct-profile .account-product-mark{width:32px;height:32px}
body.mg-pro .ai-account.pro-acct-profile h2{font-size:20px;margin:8px 0 14px}
body.mg-pro .ai-account .pro-acct-name,body.mg-pro .ai-account .pro-acct-email{position:relative;margin:0;padding-inline:68px 16px;background:var(--p-surface);border:1px solid var(--p-border);overflow-wrap:anywhere}
body.mg-pro .ai-account .pro-acct-name{z-index:1;overflow:visible!important;padding-top:14px;padding-bottom:2px;border-bottom:0;border-radius:16px 16px 0 0;font-weight:700;font-size:16px;color:var(--p-text)}
body.mg-pro .ai-account .pro-acct-email{padding-top:0;padding-bottom:14px;border-top:0;border-radius:0 0 16px 16px;font-size:13.5px;color:var(--p-muted)!important;direction:ltr;text-align:start}
html[dir=rtl] body.mg-pro .ai-account .pro-acct-email,body.mg-pro .ai-account[dir=rtl] .pro-acct-email{text-align:right}
body.mg-pro .ai-account .pro-acct-name::before{content:attr(data-initial);position:absolute;inset-inline-start:14px;top:13px;width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:var(--p-accent);color:var(--p-accent-ink);font-weight:700;font-size:17px}
body.mg-pro .ai-account.pro-acct-profile .account-note{margin:14px 0 0;font-size:12.5px;line-height:1.7}
body.mg-pro .ai-account.pro-acct-profile>button:not(.account-close){margin-top:14px;color:#e35d5d!important;border-color:#e35d5d55!important;background:transparent!important}
@media (max-width:760px){
 body.mg-pro #account.pro-avatar{width:40px!important;min-width:40px!important;max-width:40px!important;height:40px!important;min-height:40px!important;padding:0!important;border-radius:50%!important;font-size:0!important;display:inline-grid!important;place-items:center;background:var(--p-accent)!important;color:var(--p-accent-ink)!important;border:2px solid color-mix(in srgb,var(--p-text) 18%,transparent)!important;box-sizing:content-box}
 body.mg-pro #account.pro-avatar::before{content:attr(data-initial);font-size:16px;font-weight:700;line-height:1}
 body.mg-pro .ai-account{inset:auto 0 0 0!important;margin:0!important;width:100%!important;max-width:none!important;max-height:min(88dvh,760px)!important;border-radius:22px 22px 0 0!important;border-bottom:0!important;padding:22px 18px calc(18px + env(safe-area-inset-bottom))!important;animation:pro-sheet-up .22s cubic-bezier(.2,.8,.2,1)}
}
@media (prefers-reduced-motion:reduce){body.mg-pro .ai-account{animation:none!important}}
