/* Shared visual language. Functional page layouts and access rules stay page-owned. */
:root{--ui-bg:#f5f7fb;--ui-panel:#fff;--ui-soft:#edf2fa;--ui-text:#17243b;--ui-muted:#596b84;--ui-border:#dce4ef;--ui-accent:#245eea;--ui-shadow:0 8px 30px #14274708;--ink:var(--ui-text);--page:var(--ui-bg);--surface:var(--ui-panel);--border:var(--ui-border)}
:root[data-theme=dark]{color-scheme:dark;--ui-bg:#0c1320;--ui-panel:#141e2e;--ui-soft:#1c2b40;--ui-text:#edf3fd;--ui-muted:#a5b5cb;--ui-border:#2b3a50;--ui-accent:#91b3ff;--ui-shadow:0 8px 30px #0002;--muted:var(--ui-muted);--text:var(--ui-text);--navy:var(--ui-text);--line:var(--ui-border);--soft:var(--ui-soft)}
:root body{background:var(--ui-bg);color:var(--ui-text);font-family:Inter,'DM Sans',system-ui,-apple-system,'Segoe UI',sans-serif;text-rendering:optimizeLegibility}
:root body :is(button,input,select,textarea){font-family:inherit}
:root body :is(a,button,input,select,textarea,summary):focus-visible{outline:3px solid var(--ui-accent);outline-offset:4px}
:root body :is(.portal-list,.portal-card,.history-summary>div,.balance-bucket,.referral-card,.referral-stats article,.panel,.card,.auth-card,.wizard-card,.brief-panel,.workspace-panel,.history-panel,.model-card,.suggestion-card,.membership-dialog){background:var(--ui-panel);color:var(--ui-text);border-color:var(--ui-border);border-radius:18px;box-shadow:var(--ui-shadow)}
:root[data-theme=dark] body .balance-bucket-foot :is(b,strong){color:var(--ui-text)}
:root[data-theme=dark] body .balance-bucket-foot em{color:var(--ui-muted)}
:root[data-theme=dark] body .balance-bucket-foot .balance-countdown{color:var(--ui-accent)}
:root body :is(.sub-header,.checkout-nav,.app-header,.chat-topbar){background:var(--ui-panel);color:var(--ui-text);border-bottom:1px solid var(--ui-border)}
:root body :is(.sub-header h1,.section-label h2,.card-caption h2,.profile-hero h2,.brand,.panel-heading h2){color:var(--ui-text)}
:root body :is(.section-label span,.portal-empty,.card-caption p,.order-info small,.profile-hero p){color:var(--ui-muted)}
:root body :is(.profile-form input,.profile-form textarea,.profile-form select,.input-wrap,.brief-panel textarea,.form-control,.form-select){background:var(--ui-panel);color:var(--ui-text);border-color:var(--ui-border);border-radius:10px}
:root body :is(input,textarea)::placeholder{color:var(--ui-muted);opacity:1}
:root body :is(.input-wrap input){color:var(--ui-text)}
:root body :is(.bottom-nav){background:var(--ui-panel);border-color:var(--ui-border);box-shadow:0 -4px 24px #00000008}
:root body .bottom-nav a{color:var(--ui-muted)}
:root body .bottom-nav a.active{color:var(--ui-accent)}
:root body .portal-wrap{width:min(100% - 48px,1120px)}
:root body .sub-header .portal-wrap{min-height:76px}
:root body .section-label{gap:14px;margin-bottom:18px}
:root body .section-label h2{font-size:20px;letter-spacing:-.5px}
:root body .section-label :is(span,a){font-size:13px}
:root body .portal-list{padding:0 24px}
:root body .portal-order{padding:22px 0;text-decoration:none;color:var(--ui-text);border-color:var(--ui-border)}
:root body .order-info b{font-size:15px}
:root body .order-info small{font-size:12px}
:root body .order-value b{font-size:15px}
:root body .order-value small{font-size:11px}
:root body .help-card{background:var(--ui-soft);color:var(--ui-text);border:1px solid var(--ui-border);box-shadow:none}
:root[data-theme=dark] body .help-card :is(b,small){color:var(--ui-text)}
:root body .home-header.portal-header{width:min(100% - 48px,1120px);height:auto;min-height:94px;background:transparent;margin:20px auto 0;box-shadow:none}
:root body .home-header .compact-header{padding:10px 0;gap:20px;flex-wrap:wrap}
:root body .home-header .header-greeting h1{color:var(--ui-text);font-size:28px;letter-spacing:-1px;line-height:1.3}
:root body .home-header .header-greeting small{color:var(--ui-muted);font-size:11px;letter-spacing:1.5px}
:root body .home-main{padding-top:16px;padding-bottom:32px}
.dashboard-intro{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:24px}
.dashboard-intro p{color:var(--ui-muted);margin:0;max-width:550px;font-size:15px}
.workspace-link{display:inline-flex;align-items:center;gap:10px;padding:12px 18px;border-radius:12px;background:#245eea;color:#fff;text-decoration:none;font-size:14px;font-weight:650;white-space:nowrap}
:root body .wallet-card{padding:30px 32px;border-radius:22px;background:linear-gradient(120deg,#153977,#245eea);box-shadow:0 12px 30px #245eea18}
:root body .wallet-card small{font-size:11px;letter-spacing:1.5px}
:root body .wallet-card strong{font-size:38px;letter-spacing:-1.5px;margin:8px 0}
:root body .wallet-card span{font-size:12px!important}
:root body .service-section{margin-top:36px}
:root body .service-grid.service-grid-full{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
:root body .service-grid-full .service-menu{min-height:124px;display:flex;flex-direction:row;text-align:left;justify-content:flex-start;gap:16px;padding:22px;background:var(--ui-panel);color:var(--ui-text);border:1px solid var(--ui-border);border-radius:16px;box-shadow:var(--ui-shadow);transition:border-color .18s,transform .18s}
:root body .service-grid-full .service-menu:hover{border-color:var(--ui-accent);transform:translateY(-2px)}
:root body .service-grid-full .service-menu i{width:44px;min-width:44px;height:44px;background:var(--ui-soft);color:var(--ui-accent);border-radius:13px}
.ui-icon{display:block;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
:root body .service-grid-full .service-menu b{font-size:15px;line-height:1.4}
:root body .service-grid-full .service-menu small{display:block;font-size:12px;color:var(--ui-muted);line-height:1.5;margin-top:4px}
:root body .service-grid-full .service-menu.premium-locked{background:var(--ui-soft);color:var(--ui-muted);filter:grayscale(1);box-shadow:none;opacity:.85}
:root body .service-grid-full .service-menu.premium-locked i{background:var(--ui-border);color:var(--ui-muted)}
:root body .service-grid-full .service-menu.premium-locked:hover{transform:none}
:root body .recent-section{margin-top:36px}
:root body .auth-form-side{background:var(--ui-bg)}
:root body .auth-card{border:1px solid var(--ui-border);padding:32px}
:root body .auth-card :is(h2,label){color:var(--ui-text)}
:root body .auth-subtitle{color:var(--ui-muted)}
:root body .admin-sidebar{background:#132440}
:root body .main-area{background:var(--ui-bg)}
:root body .main-area .card{border:1px solid var(--ui-border)}
:root[data-theme=dark] body .main-area{--bs-body-bg:var(--ui-panel);--bs-body-color:var(--ui-text);--bs-secondary-color:var(--ui-muted);--bs-border-color:var(--ui-border);--bs-tertiary-bg:var(--ui-soft)}
:root[data-theme=dark] body .main-area :is(.bg-white,.bg-light,.table-light,.card-header){background:var(--ui-panel)!important;color:var(--ui-text)!important}
:root[data-theme=dark] body .main-area :is(.text-dark,.text-muted){color:var(--ui-muted)!important}
:root body .chat-sidebar{background:var(--ui-panel);border-color:var(--ui-border)}
:root body :is(.chat-main,.conversation){background:var(--ui-bg)}
:root body .composer{background:var(--ui-panel);border:1px solid var(--ui-border);box-shadow:var(--ui-shadow)}
:root body .composer textarea{color:var(--ui-text)}
:root body .composer-area{background:var(--ui-bg)}
:root body .prompt-grid button{background:var(--ui-panel);border-color:var(--ui-border);color:var(--ui-text)}
:root[data-theme=dark] body :is(.workspace-header,.panel-heading,.workspace-status,.project-history,.empty-workspace,.file-tabs,.file-tree,.code-toolbar,.builder-history){background:var(--ui-panel);color:var(--ui-text);border-color:var(--ui-border)}
:root[data-theme=dark] body .brief-panel :is(h2,label){color:var(--ui-text)}
:root body .output-panel{background:var(--ui-panel);border-color:var(--ui-border);border-radius:18px}
:root[data-theme=dark] body :is(.output-heading,.status-bar,.empty-state,.project-heading,.file-explorer,.source-toolbar,.history-item,.mini-editor,.mini-editor-bar,.instructions-section,.output-format,.balance-pill){background:var(--ui-panel);color:var(--ui-text);border-color:var(--ui-border)}
:root[data-theme=dark] body :is(.output-heading h2,.empty-state h3,.project-heading h3,.history-heading h3,.file-explorer h4){color:var(--ui-text)}
:root[data-theme=dark] body :is(.status-bar p,.prompt-meta,.history-empty,.project-summary,.file-list button){color:var(--ui-muted)}
:root[data-theme=dark] body .swal2-popup{background:var(--ui-panel);color:var(--ui-text)}
@media(max-width:700px){:root body .header-inner{flex-wrap:wrap;gap:14px}}
.design-theme-button{display:inline-flex;align-items:center;gap:8px;min-height:38px;padding:8px 12px;border:1px solid var(--ui-border);border-radius:10px;background:var(--ui-panel);color:var(--ui-text);cursor:pointer}
@media(min-width:900px){:root body.portal-page{padding-bottom:100px}:root body .bottom-nav{left:50%;transform:translateX(-50%);bottom:18px;width:480px;border:1px solid var(--ui-border);border-radius:18px;overflow:hidden}}
@media(max-width:700px){:root body .portal-wrap,:root body .home-header.portal-header{width:calc(100% - 32px)}:root body .home-header .header-greeting h1{font-size:23px}:root body .home-header .compact-header{gap:12px}.dashboard-intro{align-items:flex-start;flex-direction:column;gap:16px}:root body .wallet-card{padding:24px;gap:16px;flex-wrap:wrap}:root body .wallet-card strong{font-size:32px}:root body .service-grid.service-grid-full{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}:root body .service-grid-full .service-menu{flex-direction:column;align-items:flex-start;gap:12px;padding:17px;min-height:155px}:root body .service-grid-full .service-menu b{font-size:14px}:root body .section-label span{display:none}:root body .portal-list{padding:0 16px}:root body .order-value b{font-size:13px}:root body .auth-card{padding:24px}:root body .bottom-nav{padding-bottom:env(safe-area-inset-bottom)}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto!important}*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
