/* MESH V9.22 — consistent, accessible theme palettes.
   Loaded AFTER the existing v9/account/mesh styles on every page.
   Theme variants keep the original background artwork but retint UI surfaces.
   Matrix = blue/green; Ion = cyan/violet; Solar = gold/azure. */
:root, html[data-theme="matrix"] {
  color-scheme: dark;
  --a:#5dd3ff; --b:#4becb2; --c:#56f3b9; --warm:#81bfff;
  --mesh-primary-rgb:93 211 255;
  --mesh-secondary-rgb:75 236 178;
  --mesh-panel-rgb:7 23 32;
  --mesh-deep-rgb:4 13 20;
  --mesh-link:#b1ecff;
  --mesh-contrast:#effaff;
  --mesh-subtext:#bbd2dc;
  --mesh-gradient:linear-gradient(112deg,var(--a),var(--b));
  --acc:var(--a); --acc2:var(--b);
  --asoft:rgb(var(--mesh-primary-rgb) / .11);
  --bsoft:rgb(var(--mesh-secondary-rgb) / .07);
  --line:rgb(var(--mesh-primary-rgb) / .20);
  --line2:rgb(var(--mesh-primary-rgb) / .32);
}
html[data-theme="ion"] {
  --a:#70e6ff; --b:#aa8bff; --c:#bd9dff; --warm:#dbb5ff;
  --mesh-primary-rgb:112 230 255;
  --mesh-secondary-rgb:170 139 255;
  --mesh-panel-rgb:18 17 40;
  --mesh-deep-rgb:9 10 27;
  --mesh-link:#d1c2ff;
  --mesh-contrast:#f3efff;
  --mesh-subtext:#c6c1e0;
}
html[data-theme="solar"] {
  --a:#ffd079; --b:#76c5ff; --c:#ffd991; --warm:#ffab78;
  --mesh-primary-rgb:255 208 121;
  --mesh-secondary-rgb:118 197 255;
  --mesh-panel-rgb:31 23 17;
  --mesh-deep-rgb:18 15 13;
  --mesh-link:#ffe1a5;
  --mesh-contrast:#fff6e9;
  --mesh-subtext:#d9c9ae;
}
/* Surface and type — ensure changes are visible beyond the tiny theme dot. */
html[data-theme] body { color:var(--mesh-contrast); background:#03080f; }
html[data-theme="ion"] body { background:#07071a; }
html[data-theme="solar"] body { background:#100c08; }
html[data-theme] body::after {
  background:
    radial-gradient(ellipse at 78% 14%,rgb(var(--mesh-primary-rgb) / .13),transparent 53%),
    radial-gradient(ellipse at 12% 88%,rgb(var(--mesh-secondary-rgb) / .09),transparent 58%),
    linear-gradient(180deg,transparent 5%,rgb(var(--mesh-deep-rgb) / .44) 100%);
  opacity:1;
}
html[data-theme] .header-shell,
html[data-theme] .nav-panel,
html[data-theme] .v8-theme-popover,
html[data-theme] .v8-search-dialog {
  background:linear-gradient(155deg,rgb(var(--mesh-panel-rgb) / .99),rgb(var(--mesh-deep-rgb) / .99));
  border-color:rgb(var(--mesh-primary-rgb) / .32);
}
html[data-theme] .header-shell::after {
  background:linear-gradient(90deg,transparent,var(--a) 23%,var(--b) 75%,transparent);
}
html[data-theme] .brand img,
html[data-theme] .account-brand img,
html[data-theme] .dash-brand img {
  border-color:rgb(var(--mesh-primary-rgb) / .34);
  box-shadow:0 0 21px rgb(var(--mesh-primary-rgb) / .10);
}
/* Navigation, buttons, popovers, selections and focus rings. */
html[data-theme] .main-nav>a,
html[data-theme] .nav-menu-button { color:var(--mesh-subtext); }
html[data-theme] .main-nav>a:hover,
html[data-theme] .main-nav>a.active,
html[data-theme] .nav-menu.open-menu>.nav-menu-button,
html[data-theme] .nav-menu.contains-active>.nav-menu-button {
  color:var(--mesh-contrast);
  background:rgb(var(--mesh-primary-rgb) / .13);
  border-color:rgb(var(--mesh-primary-rgb) / .25);
}
html[data-theme] .nav-panel>a:hover,
html[data-theme] .nav-panel>a.active {
  border-color:rgb(var(--mesh-primary-rgb) / .36);
  background:linear-gradient(105deg,rgb(var(--mesh-primary-rgb) / .14),rgb(var(--mesh-secondary-rgb) / .06));
}
html[data-theme] .nav-panel>a>b,
html[data-theme] .mesh-resource-code,
html[data-theme] .download-icon {color:var(--mesh-link);border-color:rgb(var(--mesh-primary-rgb) / .34);background:rgb(var(--mesh-primary-rgb) / .08)}
html[data-theme] .nav-panel strong {color:var(--mesh-contrast)}
html[data-theme] .nav-panel small {color:var(--mesh-subtext)}
html[data-theme] .v8-search-trigger,
html[data-theme] .v8-theme-trigger,
html[data-theme] .header-cta,
html[data-theme] .account-cta,
html[data-theme] .v8-top {
  color:var(--mesh-contrast);
  border-color:rgb(var(--mesh-primary-rgb) / .33);
  background:rgb(var(--mesh-panel-rgb) / .95);
}
html[data-theme] .v8-search-trigger:hover,
html[data-theme] .v8-theme-trigger:hover,
html[data-theme] .header-cta:hover,
html[data-theme] .account-cta:hover,
html[data-theme] .v8-top:hover {
  border-color:var(--a);
  background:rgb(var(--mesh-primary-rgb) / .16);
}
html[data-theme] .theme-dot,
html[data-theme] .account-dot {background:var(--mesh-gradient);border-color:var(--b);box-shadow:0 0 13px rgb(var(--mesh-primary-rgb) / .17)}
html[data-theme] .v8-primary {
  color:#07121b;
  background:var(--mesh-gradient);
  box-shadow:0 12px 30px rgb(var(--mesh-primary-rgb) / .19);
}
html[data-theme] .v8-primary:hover {box-shadow:0 15px 36px rgb(var(--mesh-primary-rgb) / .31)}
html[data-theme] .v8-secondary {color:var(--mesh-contrast);border-color:rgb(var(--mesh-primary-rgb) / .34);background:rgb(var(--mesh-panel-rgb) / .84)}
html[data-theme] .v8-secondary:hover {background:rgb(var(--mesh-primary-rgb) / .14);border-color:var(--a)}
html[data-theme] :is(a,button,summary,input,textarea,select):focus-visible,
html[data-theme] :is(.account-page,.dashboard-page) :is(a,button,input,summary):focus-visible {
  outline:2px solid var(--a);
  outline-offset:3px;
  box-shadow:0 0 0 5px rgb(var(--mesh-primary-rgb) / .18);
}
/* Theme picker — consistent selected state; swatches retain their palette colours. */
html[data-theme] .v8-theme-popover {z-index:130}
html[data-theme] .v8-theme-popover button {color:var(--mesh-subtext);border-color:transparent}
html[data-theme] .v8-theme-popover button:hover,
html[data-theme] .v8-theme-popover button.active {
  color:var(--mesh-contrast);
  border-color:rgb(var(--mesh-primary-rgb) / .45);
  background:rgb(var(--mesh-primary-rgb) / .15);
}
html[data-theme] .v8-theme-popover button.active {box-shadow:inset 3px 0 var(--a)}
html[data-theme] .v8-theme-popover button b {color:var(--mesh-subtext)}
html[data-theme] .v8-theme-popover button[data-theme="matrix"] i,
html[data-theme] .mesh-mobile-theme-picker button[data-theme="matrix"] i {background:linear-gradient(135deg,#5dd3ff,#4becb2)}
html[data-theme] .v8-theme-popover button[data-theme="ion"] i,
html[data-theme] .mesh-mobile-theme-picker button[data-theme="ion"] i {background:linear-gradient(135deg,#70e6ff,#aa8bff)}
html[data-theme] .v8-theme-popover button[data-theme="solar"] i,
html[data-theme] .mesh-mobile-theme-picker button[data-theme="solar"] i {background:linear-gradient(135deg,#ffd079,#76c5ff)}
.mesh-mobile-theme-picker {display:none}
/* Main visual system: cards, important accents, headings and highlighted content. */
html[data-theme] .v8-hero-copy::before,
html[data-theme] .v4-hero::before {
  border-color:rgb(var(--mesh-primary-rgb) / .22);
  background:linear-gradient(90deg,rgb(var(--mesh-deep-rgb) / .95),rgb(var(--mesh-deep-rgb) / .70) 65%,rgb(var(--mesh-panel-rgb) / .24));
}
html[data-theme] .v8-hero h1 em,
html[data-theme] .v4-hero h1 em,
html[data-theme] .login-copy h1 em {
  background-image:linear-gradient(105deg,#fff 5%,var(--a) 52%,var(--b) 100%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
html[data-theme] .v8-kicker,
html[data-theme] .signal-pill,
html[data-theme] .eyebrow,
html[data-theme] .v8-section-head>div>span {
  color:var(--mesh-link);
  border-color:rgb(var(--mesh-primary-rgb) / .32);
}
html[data-theme] .eyebrow {color:var(--mesh-link) !important}
html[data-theme] .signal-pill {background:rgb(var(--mesh-primary-rgb) / .09)}
html[data-theme] .v8-trust span:first-child,
html[data-theme] .mesh-route-head>span {color:var(--mesh-subtext)}
html[data-theme] .mesh-hero-routes,
html[data-theme] .v8-quickbar,
html[data-theme] .mesh-launch,
html[data-theme] .mesh-founders,
html[data-theme] .mesh-resources .v8-section-head,
html[data-theme] .v8-reviews {
  background:linear-gradient(140deg,rgb(var(--mesh-panel-rgb) / .96),rgb(var(--mesh-deep-rgb) / .97));
  border-color:rgb(var(--mesh-primary-rgb) / .31);
}
html[data-theme] .mesh-launch::before,
html[data-theme] .mesh-founders::before {
  background:radial-gradient(ellipse at 85% 10%,rgb(var(--mesh-secondary-rgb) / .20),transparent 65%);
}
html[data-theme] .mesh-launch-kicker,
html[data-theme] .mesh-founders-grid b {color:var(--mesh-link)}
html[data-theme] .mesh-launch h2 em,
html[data-theme] .mesh-founders h2 em {color:var(--b)}
html[data-theme] .mesh-launch-aside>a,
html[data-theme] .mesh-founders-foot>a {
  color:var(--mesh-contrast);
  border-color:rgb(var(--mesh-secondary-rgb) / .60);
  background:linear-gradient(100deg,rgb(var(--mesh-primary-rgb) / .13),rgb(var(--mesh-secondary-rgb) / .19));
}
html[data-theme] .mesh-launch-aside>a:hover,
html[data-theme] .mesh-founders-foot>a:hover {border-color:var(--b)}
html[data-theme] .mesh-launch-tags span,
html[data-theme] .mesh-founders-grid>div,
html[data-theme] .mesh-launch-details span {border-color:rgb(var(--mesh-primary-rgb) / .24);background:rgb(var(--mesh-primary-rgb) / .07)}
html[data-theme] .mesh-founders-grid strong,
html[data-theme] .mesh-launch-content>p strong {color:var(--mesh-contrast)}
html[data-theme] .mesh-route-list>a:hover,
html[data-theme] .v8-quickbar>a:hover {border-color:rgb(var(--mesh-primary-rgb) / .30);background:rgb(var(--mesh-primary-rgb) / .12)}
html[data-theme] .mesh-route-list>a>b,
html[data-theme] .v8-quickbar>a>span {color:var(--mesh-link);border-color:rgb(var(--mesh-primary-rgb) / .26)}
html[data-theme] .mesh-route-foot,
html[data-theme] .mesh-route-head {border-color:rgb(var(--mesh-primary-rgb) / .20)}
html[data-theme] .mesh-product-grid[data-view="grid"] .v8-product-card,
html[data-theme] .mesh-product-grid[data-view="list"] .v8-product-card,
html[data-theme] .v8-product-card,
html[data-theme] .v8-showcase-card,
html[data-theme] .v8-review-grid>*,
html[data-theme] .mesh-resource-card,
html[data-theme] .v4-card,
html[data-theme] .roadmap-card,
html[data-theme] .download-card,
html[data-theme] .plan-card,
html[data-theme] .v4-row,
html[data-theme] .v4-details details,
html[data-theme] .mf-plan-card,
html[data-theme] .mf-business-quote,
html[data-theme] .mf-price-notice,
html[data-theme] .mf-business-help-panel,
html[data-theme] .mf-pricing-terms {
  border-color:rgb(var(--mesh-primary-rgb) / .26);
  background:linear-gradient(148deg,rgb(var(--mesh-panel-rgb) / .96),rgb(var(--mesh-deep-rgb) / .98));
}
html[data-theme] .v8-product-card.featured,
html[data-theme] .mf-plan-card-featured {
  border-color:rgb(var(--mesh-secondary-rgb) / .72);
  background:linear-gradient(150deg,rgb(var(--mesh-secondary-rgb) / .17),rgb(var(--mesh-panel-rgb) / .99) 56%,rgb(var(--mesh-deep-rgb) / .98));
}
html[data-theme] .mesh-resource-card:hover,
html[data-theme] .v8-product-card:hover,
html[data-theme] .v4-card:hover {
  border-color:var(--a);
  background:linear-gradient(150deg,rgb(var(--mesh-primary-rgb) / .14),rgb(var(--mesh-deep-rgb) / .97));
}
html[data-theme] .mesh-resource-card h3,
html[data-theme] .v4-card h2,
html[data-theme] .mf-plan-card h3 {color:var(--mesh-contrast)}
html[data-theme] .text-link,
html[data-theme] .v8-product-card>em,
html[data-theme] .v8-showcase-copy>a,
html[data-theme] .v4-links>a:hover {color:var(--mesh-link)}
html[data-theme] .v4-badge,
html[data-theme] .card-meta,
html[data-theme] .mf-plan-chip,
html[data-theme] .mf-plan-top>span:first-child {
  color:var(--mesh-link);
  background:rgb(var(--mesh-primary-rgb) / .08);
  border-color:rgb(var(--mesh-primary-rgb) / .25);
}
html[data-theme] .mf-plan-chip-featured,
html[data-theme] .mf-plan-promo {
  color:var(--mesh-contrast);
  border-color:rgb(var(--mesh-secondary-rgb) / .42);
  background:rgb(var(--mesh-secondary-rgb) / .15);
}
html[data-theme] .mf-plan-promo strong,
html[data-theme] .mf-plan-features li::before,
html[data-theme] .mf-business-overline,
html[data-theme] .mf-price-notice strong,
html[data-theme] .mf-plan-gst {color:var(--mesh-link)}
html[data-theme] .mf-plan-promo-neutral {color:var(--mesh-subtext);border-color:rgb(var(--mesh-primary-rgb) / .26);background:rgb(var(--mesh-primary-rgb) / .07)}
html[data-theme] .mf-business-emblem,
html[data-theme] .mf-business-tags span {color:var(--mesh-link);background:rgb(var(--mesh-primary-rgb) / .08);border-color:rgb(var(--mesh-primary-rgb) / .28)}
html[data-theme] .mf-business-link {
  color:var(--mesh-contrast);
  border-color:rgb(var(--mesh-secondary-rgb) / .57);
  background:rgb(var(--mesh-secondary-rgb) / .15);
}
html[data-theme] .mf-business-link:hover {border-color:var(--b)}
html[data-theme] .mf-plan-description,
html[data-theme] .mf-business-copy>p:not(.mf-business-overline),
html[data-theme] .mf-pricing-terms p {color:var(--mesh-subtext)}
html[data-theme] .v4-links,
html[data-theme] .v4-links>a,
html[data-theme] .v8-search-overlay,
html[data-theme] .site-footer {border-color:rgb(var(--mesh-primary-rgb) / .20);background:rgb(var(--mesh-deep-rgb) / .97)}
html[data-theme] .v4-links>a:hover {border-color:rgb(var(--mesh-primary-rgb) / .42);background:rgb(var(--mesh-primary-rgb) / .11)}
html[data-theme] .v4-details details[open],
html[data-theme] .faq-page .v4-details details[open] {
  border-color:rgb(var(--mesh-primary-rgb) / .56);
  box-shadow:inset 3px 0 var(--a),0 10px 25px rgb(var(--mesh-primary-rgb) / .08);
}
html[data-theme] .v4-details summary::after,
html[data-theme] .faq-page .v4-details summary::after {color:var(--mesh-link);border-color:rgb(var(--mesh-primary-rgb) / .38);background:rgb(var(--mesh-primary-rgb) / .09)}
html[data-theme] .v8-result:hover,
html[data-theme] .v8-result.active {border-color:var(--a);background:rgb(var(--mesh-primary-rgb) / .14)}
html[data-theme] .v8-result>span {color:var(--mesh-link);border-color:rgb(var(--mesh-primary-rgb) / .28)}
html[data-theme] .v8-progress {background:var(--mesh-gradient)}
html[data-theme] .footer-groups a:hover {color:var(--a)}
html[data-theme] .dev-build {color:var(--mesh-link);border-color:rgb(var(--mesh-primary-rgb) / .65);background:rgb(var(--mesh-deep-rgb) / .97)}
html[data-theme] .dev-build::before,
html[data-theme] .footer-online i,
html[data-theme] .mesh-launch-kicker::before {background:var(--b);box-shadow:0 0 10px rgb(var(--mesh-secondary-rgb) / .40)}
/* Login and dashboard were not reading the saved theme at all. */
html[data-theme] .account-page,
html[data-theme] .dashboard-page {color:var(--mesh-contrast)}
html[data-theme] .login-card,
html[data-theme] .login-point,
html[data-theme] .dash-rail,
html[data-theme] .dash-top,
html[data-theme] .dash-card,
html[data-theme] .metric,
html[data-theme] .server-card,
html[data-theme] .module-card,
html[data-theme] .module-card-v2,
html[data-theme] .settings-row,
html[data-theme] .module-toolbar,
html[data-theme] .active-bot-strip,
html[data-theme] .module-search,
html[data-theme] .module-summary {
  border-color:rgb(var(--mesh-primary-rgb) / .28);
  background:linear-gradient(150deg,rgb(var(--mesh-panel-rgb) / .95),rgb(var(--mesh-deep-rgb) / .98));
}
html[data-theme] .login-card::before {background:var(--mesh-gradient)}
html[data-theme] .login-orb,
html[data-theme] .module-code,
html[data-theme] .server-icon {border-color:rgb(var(--mesh-primary-rgb) / .38);background:rgb(var(--mesh-primary-rgb) / .10);color:var(--mesh-link)}
html[data-theme] .login-point b,
html[data-theme] .dash-head span,
html[data-theme] .module-group-head span,
html[data-theme] .dash-card-head button,
html[data-theme] .dash-card-head a {color:var(--mesh-link)}
html[data-theme] .dash-nav button:hover,
html[data-theme] .dash-nav button.active,
html[data-theme] .module-filters button:hover,
html[data-theme] .module-filters button.active,
html[data-theme] .module-expand:hover,
html[data-theme] .module-card-v2[open] {
  color:var(--mesh-contrast);
  border-color:rgb(var(--mesh-primary-rgb) / .44);
  background:rgb(var(--mesh-primary-rgb) / .13);
}
html[data-theme] .module-filters button,
html[data-theme] .module-expand,
html[data-theme] .dash-refresh,
html[data-theme] .dash-home,
html[data-theme] .settings-row button,
html[data-theme] .server-actions button,
html[data-theme] .server-actions a,
html[data-theme] .account-back,
html[data-theme] .login-secondary {
  color:var(--mesh-subtext);
  border-color:rgb(var(--mesh-primary-rgb) / .30);
  background:rgb(var(--mesh-deep-rgb) / .85);
}
html[data-theme] .module-filters button.active,
html[data-theme] .server-actions a:hover,
html[data-theme] .server-actions button:hover {color:var(--mesh-contrast)}
html[data-theme] .discord-login {border-color:rgb(var(--mesh-primary-rgb) / .43);background:linear-gradient(100deg,rgb(var(--mesh-secondary-rgb) / .22),rgb(var(--mesh-primary-rgb) / .12))}
html[data-theme] .dash-rail-status,
html[data-theme] .preview-banner {border-color:rgb(var(--mesh-primary-rgb) / .28)}
/* At tablet/phone widths the header theme control would crowd the logo.
   Put a proper theme selector in the hamburger navigation instead. */
@media (max-width:1150px) {
  .mesh-mobile-theme-picker {
    display:block;
    width:100%;
    padding:14px 10px 8px;
    margin-top:7px;
    border-top:1px solid rgb(var(--mesh-primary-rgb) / .25);
  }
  .mesh-mobile-theme-picker>strong {display:block;color:var(--mesh-subtext);font-size:.8rem;letter-spacing:.075em;text-transform:uppercase;margin-bottom:11px}
  .mesh-mobile-theme-choices {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .mesh-mobile-theme-picker button {
    display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
    min-width:0;min-height:66px;padding:9px 5px;
    border:1px solid rgb(var(--mesh-primary-rgb) / .25);
    border-radius:12px;color:var(--mesh-subtext);
    background:rgb(var(--mesh-panel-rgb) / .95);
    cursor:pointer;font-size:.81rem;font-weight:700;line-height:1.25;
  }
  .mesh-mobile-theme-picker button i {display:block;width:26px;height:9px;border-radius:12px}
  .mesh-mobile-theme-picker button:hover,
  .mesh-mobile-theme-picker button.active {
    color:var(--mesh-contrast);
    border-color:var(--a);
    background:rgb(var(--mesh-primary-rgb) / .18);
  }
  .mesh-mobile-theme-picker button.active {box-shadow:inset 0 3px var(--a)}
}

/* Account colour controls are real, persisted selections, not preview-only UI. */
html[data-theme] .mesh-account-theme-select {
  display:flex;align-items:center;gap:9px;flex-wrap:wrap;
  color:var(--mesh-subtext);font-size:.83rem;font-weight:700;
}
html[data-theme] .mesh-account-theme-select select {
  flex:0 0 auto;min-width:112px;min-height:44px;padding:9px 28px 9px 12px;
  color:var(--mesh-contrast);
  background:rgb(var(--mesh-panel-rgb) / .99);
  border:1px solid rgb(var(--mesh-primary-rgb) / .41);
  border-radius:10px;
  font:700 .87rem Inter,system-ui,sans-serif;cursor:pointer;
}
html[data-theme] .mesh-account-theme-select option {background:rgb(var(--mesh-panel-rgb));color:var(--mesh-contrast)}
html[data-theme] .account-page .mesh-account-theme-select {
  justify-content:space-between;
  margin-top:18px;padding:13px 15px;
  border:1px solid rgb(var(--mesh-primary-rgb) / .25);
  border-radius:11px;
  background:rgb(var(--mesh-primary-rgb) / .06);
}
html[data-theme] .dashboard-page .dash-top-actions {
  display:flex;align-items:center;gap:9px;flex-wrap:wrap;
}
html[data-theme] .dashboard-page .dash-top-actions .mesh-account-theme-select {margin-right:4px}
/* Legacy .metric styles are shared with the homepage and used flex display.
   Scope dashboard KPI cards to a vertical layout so narrow labels do not
   force the document horizontally off-screen at phone/desktop widths. */
html[data-theme] .dashboard-page .metric-grid {grid-template-columns:repeat(4,minmax(0,1fr))}
html[data-theme] .dashboard-page .metric {
  display:block;min-width:0;overflow-wrap:break-word;
}
html[data-theme] .dashboard-page .metric strong {
  display:block;margin:17px 0 0;line-height:1.23;
  overflow-wrap:anywhere;
}
html[data-theme] .dashboard-page .metric p {
  display:block;margin:7px 0 0;
  max-width:100%;overflow-wrap:break-word;white-space:normal;
}
@media(max-width:1100px) {
  html[data-theme] .dashboard-page .metric-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:600px) {
  html[data-theme] .dashboard-page .metric-grid {grid-template-columns:minmax(0,1fr)}
}
