/* Castlance Quality v16 — final visual override for public site, portal and admin.
   Loaded after legacy layers. Visual/brand only; no billing, license or quota behavior. */

html[data-theme="light"]{
 --c16-bg:#f3f6fa;--c16-bg2:#eaf0f6;--c16-surface:#fff;--c16-surface2:#f7f9fc;--c16-surface3:#edf3f8;
 --c16-text:#102138;--c16-muted:#60748b;--c16-faint:#7f90a4;--c16-line:#d7e2ed;--c16-line2:#c8d6e5;
 --c16-brand:#2f67e8;--c16-cyan:#00aebe;--c16-shadow:0 12px 34px rgba(20,45,75,.075);color-scheme:light
}
html[data-theme="dark"]{
 --c16-bg:#07111f;--c16-bg2:#0a1625;--c16-surface:#0f1b2b;--c16-surface2:#132238;--c16-surface3:#182a42;
 --c16-text:#eef4fb;--c16-muted:#9baec3;--c16-faint:#7f93aa;--c16-line:#263a50;--c16-line2:#35506d;
 --c16-brand:#7aa1ff;--c16-cyan:#63e2ee;--c16-shadow:0 14px 38px rgba(0,0,0,.22);color-scheme:dark
}
html[data-admin-theme="light"]{
 --a16-bg:#f3f6fa;--a16-surface:#fff;--a16-surface2:#f7f9fc;--a16-surface3:#eef3f8;--a16-text:#102138;--a16-muted:#60748b;--a16-faint:#7f90a4;--a16-line:#d7e2ed;--a16-line2:#c8d6e5;--a16-brand:#2f67e8;--a16-shadow:0 10px 28px rgba(20,45,75,.065);color-scheme:light
}
html[data-admin-theme="dark"]{
 --a16-bg:#07111f;--a16-surface:#0f1b2b;--a16-surface2:#132238;--a16-surface3:#182a42;--a16-text:#eef4fb;--a16-muted:#9baec3;--a16-faint:#7f93aa;--a16-line:#263a50;--a16-line2:#35506d;--a16-brand:#7aa1ff;--a16-shadow:0 12px 34px rgba(0,0,0,.18);color-scheme:dark
}

/* Brand assets from the supplied Castlance brand sheet. */
html[data-theme] body.castlance-public-v8 .brand-mark{
 width:40px!important;height:40px!important;min-width:40px!important;border-radius:11px!important;font-size:0!important;color:transparent!important;
 background:transparent url('/assets/brand/castlance-c.svg?v=100028') center/contain no-repeat!important;box-shadow:none!important
}
html[data-theme] body.castlance-public-v8 .brand-img{max-height:42px!important;max-width:180px!important;object-fit:contain!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .side .mark,
body.usage-policy-page .admin-mark{
 background:transparent url('/assets/brand/castlance-c.svg?v=100028') center/contain no-repeat!important;color:transparent!important;font-size:0!important;box-shadow:none!important
}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .side .mark{width:40px!important;height:40px!important;border-radius:11px!important}
body.usage-policy-page .admin-mark{width:36px!important;height:36px!important;min-width:36px!important}
html[data-theme] body.castlance-portal-v8 .topbar .brand,
html[data-theme] body.castlance-portal-v8 .login-brand{position:relative!important;padding-left:46px!important;min-height:38px!important;display:flex!important;flex-direction:column!important;justify-content:center!important}
html[data-theme] body.castlance-portal-v8 .topbar .brand::before,
html[data-theme] body.castlance-portal-v8 .login-brand::before{content:"";position:absolute;left:0;top:50%;transform:translateY(-50%);width:36px;height:36px;background:url('/assets/brand/castlance-c.svg?v=100028') center/contain no-repeat}
body.usage-test-page .brand{position:relative!important;padding-left:46px!important;min-height:38px!important}
body.usage-test-page .brand::before{content:"";position:absolute;left:0;top:0;width:36px;height:36px;background:url('/assets/brand/castlance-c.svg?v=100028') center/contain no-repeat}

/* ================= PUBLIC SITE ================= */
html[data-theme] body.castlance-public-v8,
html[data-theme] body.castlance-public-v8 main{background:var(--c16-bg)!important;background-color:var(--c16-bg)!important;color:var(--c16-text)!important}
html[data-theme] body.castlance-public-v8 main>section,
html[data-theme] body.castlance-public-v8 .section{color:var(--c16-text)!important}
html[data-theme] body.castlance-public-v8 :is(h1,h2,h3,h4,h5,h6,b,strong,label,summary){color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important}
html[data-theme] body.castlance-public-v8 :is(p,small,.muted,.subtitle,.description,.hint,.help){color:var(--c16-muted)!important;-webkit-text-fill-color:var(--c16-muted)!important}
html[data-theme] body.castlance-public-v8 .eyebrow{color:var(--c16-brand)!important;-webkit-text-fill-color:var(--c16-brand)!important}
html[data-theme="light"] body.castlance-public-v8 .site-header{background:rgba(255,255,255,.96)!important;border-color:var(--c16-line)!important}
html[data-theme="dark"] body.castlance-public-v8 .site-header{background:rgba(7,17,31,.96)!important;border-color:var(--c16-line)!important}
html[data-theme] body.castlance-public-v8 .site-header :is(a,b){color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important}
html[data-theme] body.castlance-public-v8 .site-header small{color:var(--c16-muted)!important;-webkit-text-fill-color:var(--c16-muted)!important}

/* Real light hero instead of dark background + dark text collisions. */
html[data-theme="light"] body.castlance-public-v8 :is(.premium-hero,.download-premium-hero,.download-hero,.subhero-v5){
 background:radial-gradient(circle at 84% 10%,rgba(43,103,232,.12),transparent 31%),linear-gradient(180deg,#f8fbff 0%,#f3f6fa 100%)!important;color:#102138!important
}
html[data-theme="light"] body.castlance-public-v8 :is(.premium-hero,.download-premium-hero,.download-hero,.subhero-v5) :is(h1,h2,h3,h4,b,strong){color:#102138!important;-webkit-text-fill-color:#102138!important}
html[data-theme="light"] body.castlance-public-v8 :is(.premium-hero,.download-premium-hero,.download-hero,.subhero-v5) :is(p,small,.hero-lead,span){color:#60748b!important;-webkit-text-fill-color:#60748b!important}
html[data-theme="light"] body.castlance-public-v8 :is(.premium-hero,.download-premium-hero,.download-hero,.subhero-v5) .eyebrow{color:#2f67e8!important;-webkit-text-fill-color:#2f67e8!important}
html[data-theme="dark"] body.castlance-public-v8 :is(.premium-hero,.download-premium-hero,.download-hero,.subhero-v5){
 background:radial-gradient(circle at 80% 10%,rgba(46,116,255,.22),transparent 32%),linear-gradient(145deg,#061426,#0a2039 62%,#1d1745)!important;color:#f5f8fc!important
}
html[data-theme="dark"] body.castlance-public-v8 :is(.premium-hero,.download-premium-hero,.download-hero,.subhero-v5) :is(h1,h2,h3,h4,b,strong){color:#f5f8fc!important;-webkit-text-fill-color:#f5f8fc!important}
html[data-theme="dark"] body.castlance-public-v8 :is(.premium-hero,.download-premium-hero,.download-hero,.subhero-v5) :is(p,small,.hero-lead,span){color:#b5c7d9!important;-webkit-text-fill-color:#b5c7d9!important}
html[data-theme="dark"] body.castlance-public-v8 :is(.premium-hero,.download-premium-hero,.download-hero,.subhero-v5) .eyebrow{color:#63e2ee!important;-webkit-text-fill-color:#63e2ee!important}
html[data-theme="light"] body.castlance-public-v8 .section.soft{background:#eaf0f6!important}
html[data-theme="dark"] body.castlance-public-v8 .section.soft{background:#0a1625!important}

/* Generic cards/surfaces. */
html[data-theme] body.castlance-public-v8 :is(
 .card,.panel,.box,.checkout-card,.upgrade-current,.topup-summary,.opt,.notice,.blog-card-v5,.article-shell-v5,.article-content-v5,.article-side-v5,
 .pricing-card-v43,.pricing-hero-card,.pricing-compare-v43,.pricing-demo-box,.faq-content-v43,.faq-sidebar-v43,.faq-support-card,.faq-bottom-help,.faq-accordion-v43 details,
 .download-platform,.release-card,.requirements-grid>article,.os-detect,.release-meta>span,.release-v5,.release-side-v5,.release-summary-grid,.subhero-badge,
 .cast-video-card,.cast-review-card,.empty-state
){background:var(--c16-surface)!important;background-color:var(--c16-surface)!important;border-color:var(--c16-line)!important;color:var(--c16-text)!important;box-shadow:var(--c16-shadow)!important}
html[data-theme] body.castlance-public-v8 :is(.release-v5,.release-side-v5,.release-card,.download-platform,.requirements-grid>article,.subhero-badge,.empty-state) :is(h1,h2,h3,h4,b,strong){color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important}
html[data-theme] body.castlance-public-v8 :is(.release-v5,.release-side-v5,.release-card,.download-platform,.requirements-grid>article,.subhero-badge,.empty-state) :is(p,small,span){color:var(--c16-muted)!important;-webkit-text-fill-color:var(--c16-muted)!important}
html[data-theme] body.castlance-public-v8 .release-summary-grid>div{border-color:var(--c16-line)!important}
html[data-theme] body.castlance-public-v8 .release-foot-v5{border-color:var(--c16-line)!important;color:var(--c16-muted)!important}
html[data-theme] body.castlance-public-v8 .release-foot-v5 a{color:var(--c16-brand)!important;-webkit-text-fill-color:var(--c16-brand)!important}
html[data-theme] body.castlance-public-v8 .release-side-v5{position:sticky!important;top:95px!important}
html[data-theme] body.castlance-public-v8 .release-side-v5>span{color:var(--c16-cyan)!important;-webkit-text-fill-color:var(--c16-cyan)!important}
html[data-theme] body.castlance-public-v8 .download-platform .release-meta>span{background:var(--c16-surface2)!important;border-color:var(--c16-line)!important}
html[data-theme] body.castlance-public-v8 .download-platform .release-meta b{color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important}

/* Labs / Roadmap — theme aware, readable in both modes. */
html[data-theme="light"] body.castlance-public-v8 main>section.labs,
html[data-theme="light"] body.castlance-public-v8 .section.labs{background:#eef3f8!important;color:#102138!important}
html[data-theme="dark"] body.castlance-public-v8 main>section.labs,
html[data-theme="dark"] body.castlance-public-v8 .section.labs{background:#061426!important;color:#eef4fb!important}
html[data-theme] body.castlance-public-v8 .labs .lab{background:var(--c16-surface)!important;border:1px solid var(--c16-line)!important;color:var(--c16-text)!important;box-shadow:var(--c16-shadow)!important}
html[data-theme] body.castlance-public-v8 .labs .lab :is(h3,b,strong){color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important}
html[data-theme] body.castlance-public-v8 .labs .lab p{color:var(--c16-muted)!important;-webkit-text-fill-color:var(--c16-muted)!important}
html[data-theme] body.castlance-public-v8 .labs .lab>div{background:#143e6a!important;color:#85e5f6!important;-webkit-text-fill-color:#85e5f6!important}
html[data-theme] body.castlance-public-v8 .labs .lab>small{display:block!important;background:#12466b!important;color:#c9e7f3!important;-webkit-text-fill-color:#c9e7f3!important}
html[data-theme] body.castlance-public-v8 .labs .lab.live>small{background:#0b5545!important;color:#c9f5e8!important;-webkit-text-fill-color:#c9f5e8!important}
html[data-theme] body.castlance-public-v8 .labs .lab.planned>small{background:#20384f!important;color:#c9d7e6!important;-webkit-text-fill-color:#c9d7e6!important}
html[data-theme="light"] body.castlance-public-v8 .labs :is(.labs-top h2,.labs-top h3){color:#102138!important;-webkit-text-fill-color:#102138!important}
html[data-theme="light"] body.castlance-public-v8 .labs .labs-top p{color:#60748b!important;-webkit-text-fill-color:#60748b!important}
html[data-theme="dark"] body.castlance-public-v8 .labs :is(.labs-top h2,.labs-top h3){color:#f5f8fc!important;-webkit-text-fill-color:#f5f8fc!important}
html[data-theme="dark"] body.castlance-public-v8 .labs .labs-top p{color:#b4c6d9!important;-webkit-text-fill-color:#b4c6d9!important}
html[data-theme="light"] body.castlance-public-v8 .roadmap{background:#fff!important;border-color:#ccd9e6!important;color:#405b75!important;-webkit-text-fill-color:#405b75!important}
html[data-theme="dark"] body.castlance-public-v8 .roadmap{background:#10243b!important;border-color:#294761!important;color:#a9bdd2!important;-webkit-text-fill-color:#a9bdd2!important}

/* Deliberate gradient CTA panels remain readable. */
html[data-theme] body.castlance-public-v8 :is(.try-card,.release-callout-box,.final-box){background:linear-gradient(135deg,#071426,#123d79 60%,#6527c7)!important;color:#fff!important;border-color:transparent!important}
html[data-theme] body.castlance-public-v8 :is(.try-card,.release-callout-box,.final-box) :is(h1,h2,h3,h4,b,strong){color:#fff!important;-webkit-text-fill-color:#fff!important}
html[data-theme] body.castlance-public-v8 :is(.try-card,.release-callout-box,.final-box) :is(p,small){color:#c9daeb!important;-webkit-text-fill-color:#c9daeb!important}
html[data-theme] body.castlance-public-v8 :is(.try-card,.release-callout-box,.final-box) .eyebrow{color:#66ddf0!important;-webkit-text-fill-color:#66ddf0!important}

/* Footer is one continuous dark system in BOTH themes. */
html[data-theme] body.castlance-public-v8 .site-footer{background:#061426!important;background-color:#061426!important;color:#eef4fb!important}
html[data-theme] body.castlance-public-v8 .site-footer :is(h1,h2,h3,h4,b,strong){color:#eef4fb!important;-webkit-text-fill-color:#eef4fb!important}
html[data-theme] body.castlance-public-v8 .site-footer :is(p,small,span,a){color:#a9bdd4!important;-webkit-text-fill-color:#a9bdd4!important}
html[data-theme] body.castlance-public-v8 .site-footer a:hover{color:#7aa1ff!important;-webkit-text-fill-color:#7aa1ff!important}
html[data-theme] body.castlance-public-v8 .footer-payments,
html[data-theme] body.castlance-public-v8 .footer-bottom{background:transparent!important;background-color:transparent!important;border-color:#20364c!important;color:#9fb2c6!important;box-shadow:none!important}
html[data-theme] body.castlance-public-v8 .footer-pay-head{color:#eef4fb!important}
html[data-theme] body.castlance-public-v8 .payment-logo{background:#0d1c2f!important;border:1px solid #263d55!important;color:#c8d6e5!important;box-shadow:none!important}
html[data-theme] body.castlance-public-v8 .payment-logo img{background:#fff!important;border-radius:8px!important;padding:5px!important;max-height:46px!important;object-fit:contain!important}

/* Customer references = small square logos, continuous auto rail. */
html[data-theme] body.castlance-public-v8 .cast-reference-section{overflow:hidden!important;background:var(--c16-bg)!important;background-color:var(--c16-bg)!important}
html[data-theme] body.castlance-public-v8 .cast-reference-section .cast-section-heading{text-align:center!important;max-width:780px!important;margin:0 auto 18px!important}
html[data-theme] body.castlance-public-v8 .cast-logo-marquee{position:relative;overflow:hidden;width:100%;padding:14px 0 10px;mask-image:linear-gradient(90deg,transparent,#000 7%,#000 93%,transparent);-webkit-mask-image:linear-gradient(90deg,transparent,#000 7%,#000 93%,transparent)}
html[data-theme] body.castlance-public-v8 .cast-logo-track{display:flex;align-items:center;gap:18px;width:max-content;padding:8px 18px;animation:castLogoRail var(--cast-logo-duration,24s) linear infinite;will-change:transform}
html[data-theme] body.castlance-public-v8 .cast-logo-marquee:hover .cast-logo-track{animation-play-state:paused}
html[data-theme] body.castlance-public-v8 .cast-logo-track:not(.is-ready){animation-play-state:paused}
html[data-theme] body.castlance-public-v8 .cast-logo-item{flex:0 0 132px;width:132px;height:132px;display:grid;grid-template-rows:78px auto;align-content:center;justify-items:center;gap:7px;padding:13px;border-radius:22px;background:var(--c16-surface)!important;border:1px solid var(--c16-line)!important;box-shadow:var(--c16-shadow)!important;color:var(--c16-text)!important}
html[data-theme] body.castlance-public-v8 .cast-logo-item>a{display:grid;width:100%;height:100%;grid-template-rows:78px auto;align-content:center;justify-items:center;gap:7px;text-decoration:none!important}
html[data-theme] body.castlance-public-v8 .cast-logo-image{display:grid;place-items:center;width:78px;height:78px;min-width:78px;min-height:78px}
html[data-theme] body.castlance-public-v8 .cast-logo-item img{display:block;width:100%;height:100%;object-fit:contain;border-radius:12px!important;background:transparent!important}
html[data-theme] body.castlance-public-v8 .cast-logo-name{max-width:108px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;font-size:11px!important;line-height:1.2!important;font-weight:800!important;color:var(--c16-muted)!important;-webkit-text-fill-color:var(--c16-muted)!important}
@keyframes castLogoRail{from{transform:translate3d(0,0,0)}to{transform:translate3d(var(--cast-logo-shift,-300px),0,0)}}
@media(prefers-reduced-motion:reduce){html[data-theme] body.castlance-public-v8 .cast-logo-track{animation:none!important}}

/* ================= CUSTOMER PORTAL ================= */
html[data-theme] body.castlance-portal-v8{background:var(--c16-bg)!important;background-color:var(--c16-bg)!important;color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 :is(.wrap,.shell,.content,.portal-main){color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 :is(.card,.stat,.saas-card,.panel,.release-center,.download-card,.portal-v64-title,.portal-v64-quick,.portal-pop,.portal-accordion,.portal-new-ticket,.profile-collapse,.profile-collapse-body,.setup-guide,.setup-step,.quota-overview,.premium-quota,.table-wrap,.portal-invoice-row,.portal-invoice-summary>div){background:var(--c16-surface)!important;background-color:var(--c16-surface)!important;border-color:var(--c16-line)!important;color:var(--c16-text)!important;box-shadow:var(--c16-shadow)!important}
html[data-theme] body.castlance-portal-v8 :is(.row,.release-meta>div,.quota-saas-grid>div,.portal-accordion-body,.portal-chat,.portal-pop a,.portal-new-ticket form){background:var(--c16-surface2)!important;background-color:var(--c16-surface2)!important;border-color:var(--c16-line)!important;color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 :is(h1,h2,h3,h4,h5,h6,b,strong,label,summary,code,td){color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 :is(p,small,.muted,.subtitle,.description,.hint,.help,th){color:var(--c16-muted)!important;-webkit-text-fill-color:var(--c16-muted)!important}
html[data-theme] body.castlance-portal-v8 .eyebrow{color:var(--c16-brand)!important;-webkit-text-fill-color:var(--c16-brand)!important}
html[data-theme="light"] body.castlance-portal-v8 .topbar{background:rgba(255,255,255,.96)!important;border-bottom-color:var(--c16-line)!important}
html[data-theme="dark"] body.castlance-portal-v8 .topbar{background:rgba(7,17,31,.96)!important;border-bottom-color:var(--c16-line)!important}
html[data-theme] body.castlance-portal-v8 .topbar :is(.brand,b,a,button){color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 :is(.langs,.portal-bell summary,.portal-theme-toggle,.portal-menu-btn){background:var(--c16-surface2)!important;border-color:var(--c16-line)!important;color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 .portal-mobile-nav,
html[data-theme] body.castlance-portal-v8 .portal-mobile-head{background:var(--c16-surface)!important;border-color:var(--c16-line)!important;color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 .portal-mobile-group{background:var(--c16-surface2)!important;border-color:var(--c16-line)!important}
html[data-theme] body.castlance-portal-v8 .portal-mobile-group a{color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 .stats{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:12px!important;margin:14px 0 18px!important}
html[data-theme] body.castlance-portal-v8 .stats>.stat,
html[data-theme] body.castlance-portal-v8 .stats>div{min-height:112px!important;padding:17px!important;display:flex!important;flex-direction:column!important;justify-content:flex-start!important;gap:6px!important;background:var(--c16-surface)!important;border:1px solid var(--c16-line)!important;border-radius:15px!important;box-shadow:var(--c16-shadow)!important;color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 .stats>div b{display:block!important;margin-top:4px!important;font-size:18px!important;line-height:1.25!important;color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important;white-space:normal!important;overflow-wrap:anywhere}
html[data-theme] body.castlance-portal-v8 .stats>div :is(small,span){color:var(--c16-muted)!important;-webkit-text-fill-color:var(--c16-muted)!important}
html[data-theme] body.castlance-portal-v8 :is(input:not([type="radio"]):not([type="checkbox"]),select,textarea){background:var(--c16-surface2)!important;color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important;border:1px solid var(--c16-line2)!important}
html[data-theme] body.castlance-portal-v8 :is(input,textarea)::placeholder{color:var(--c16-faint)!important;-webkit-text-fill-color:var(--c16-faint)!important;opacity:1!important}
html[data-theme] body.castlance-portal-v8 .table-wrap{width:100%!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;border:1px solid var(--c16-line)!important;border-radius:14px!important;scrollbar-gutter:stable}
html[data-theme] body.castlance-portal-v8 .table-wrap table{width:100%!important;border-collapse:separate!important;border-spacing:0!important;color:var(--c16-text)!important}
html[data-theme] body.castlance-portal-v8 .table-wrap th{background:var(--c16-surface2)!important;color:var(--c16-muted)!important;-webkit-text-fill-color:var(--c16-muted)!important;padding:12px 14px!important;white-space:nowrap!important;text-align:left!important}
html[data-theme] body.castlance-portal-v8 .table-wrap td{background:var(--c16-surface)!important;color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important;padding:13px 14px!important;vertical-align:middle!important;line-height:1.4!important}
html[data-theme] body.castlance-portal-v8 .table-wrap th+th,
html[data-theme] body.castlance-portal-v8 .table-wrap td+td{border-left:1px solid var(--c16-line)!important}
html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap table{min-width:920px!important;table-layout:auto!important}
html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap th:nth-child(1),html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap td:nth-child(1){min-width:220px!important}
html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap th:nth-child(2),html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap td:nth-child(2){min-width:110px!important}
html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap th:nth-child(3),html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap td:nth-child(3){min-width:105px!important}
html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap th:nth-child(4),html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap td:nth-child(4){min-width:205px!important}
html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap th:nth-child(5),html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap td:nth-child(5){min-width:150px!important}

/* ================= ADMIN CONTROL CENTER ================= */
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2{background:var(--a16-bg)!important;background-color:var(--a16-bg)!important;color:var(--a16-text)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .main{background:var(--a16-bg)!important;background-color:var(--a16-bg)!important;color:var(--a16-text)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .side{background:var(--a16-surface)!important;border-color:var(--a16-line)!important;color:var(--a16-text)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 :is(.section,.card,.saas-card,.kpi,.an-card,.an-kpi,.finance-kpi,.health,.table,.table-wrap,.panel,.box){background:var(--a16-surface)!important;background-color:var(--a16-surface)!important;border-color:var(--a16-line)!important;color:var(--a16-text)!important;box-shadow:var(--a16-shadow)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 :is(.mini,.an-row,.ticket-item,.lang-block,.section-note,.review-admin-card,.experience-preview,.lic-box,.lic-more,.quick-card,.subcard){background:var(--a16-surface2)!important;background-color:var(--a16-surface2)!important;border-color:var(--a16-line)!important;color:var(--a16-text)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 :is(h1,h2,h3,h4,h5,h6,b,strong,label,summary,td){color:var(--a16-text)!important;-webkit-text-fill-color:var(--a16-text)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 :is(p,small,.muted,.subtitle,.lang-note,.section-note,th){color:var(--a16-muted)!important;-webkit-text-fill-color:var(--a16-muted)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .table,
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .table-wrap{width:100%!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;border-radius:14px!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 table{width:100%!important;border-collapse:separate!important;border-spacing:0!important;color:var(--a16-text)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 th{background:var(--a16-surface2)!important;padding:11px 13px!important;white-space:nowrap!important;text-align:left!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 td{background:var(--a16-surface)!important;padding:12px 13px!important;vertical-align:middle!important;line-height:1.4!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 th+th,
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 td+td{border-left:1px solid var(--a16-line)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){background:var(--a16-surface2)!important;border-color:var(--a16-line2)!important;color:var(--a16-text)!important;-webkit-text-fill-color:var(--a16-text)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 :is(input,textarea)::placeholder{color:var(--a16-faint)!important;-webkit-text-fill-color:var(--a16-faint)!important;opacity:1!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .btn:not(.primary):not(.red){background:var(--a16-surface2)!important;border-color:var(--a16-line2)!important;color:var(--a16-text)!important;-webkit-text-fill-color:var(--a16-text)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .btn.primary{background:linear-gradient(135deg,#2f67e8,#6d4ee8)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;border-color:transparent!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .v10-accordion{background:var(--a16-surface)!important;border-color:var(--a16-line)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .v10-accordion>summary{background:var(--a16-surface2)!important;color:var(--a16-text)!important;-webkit-text-fill-color:var(--a16-text)!important}
@media(min-width:761px){html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .v10-accordion{display:contents!important}}

/* Standalone Planlar & Kullanım and QA console now follow the SAME admin theme. */
html[data-admin-theme] body.usage-policy-page,
html[data-admin-theme] body.usage-test-page{background:var(--a16-bg)!important;background-color:var(--a16-bg)!important;color:var(--a16-text)!important}
html[data-admin-theme] body.usage-policy-page :is(.admin-side,.card),
html[data-admin-theme] body.usage-test-page :is(.side,.card,.metric,.action){background:var(--a16-surface)!important;background-color:var(--a16-surface)!important;border-color:var(--a16-line)!important;color:var(--a16-text)!important;box-shadow:var(--a16-shadow)!important}
html[data-admin-theme] body.usage-policy-page .admin-side,
html[data-admin-theme] body.usage-test-page .side{background:var(--a16-surface)!important;border-color:var(--a16-line)!important}
html[data-admin-theme] body.usage-policy-page :is(h1,h2,h3,b,strong,label),
html[data-admin-theme] body.usage-test-page :is(h1,h2,h3,b,strong,label){color:var(--a16-text)!important;-webkit-text-fill-color:var(--a16-text)!important}
html[data-admin-theme] body.usage-policy-page :is(.muted,.small,.theme-note,.nav-title),
html[data-admin-theme] body.usage-test-page :is(.muted,.note,.eyebrow){color:var(--a16-muted)!important;-webkit-text-fill-color:var(--a16-muted)!important}
html[data-admin-theme] body.usage-policy-page .admin-nav a,
html[data-admin-theme] body.usage-test-page .side a{color:var(--a16-muted)!important;-webkit-text-fill-color:var(--a16-muted)!important}
html[data-admin-theme] body.usage-policy-page .admin-nav a:hover,
html[data-admin-theme] body.usage-policy-page .admin-nav a.active,
html[data-admin-theme] body.usage-test-page .side a:hover,
html[data-admin-theme] body.usage-test-page .side a.active{background:var(--a16-surface2)!important;color:var(--a16-text)!important;-webkit-text-fill-color:var(--a16-text)!important}
html[data-admin-theme] body.usage-policy-page :is(.field input,.field select),
html[data-admin-theme] body.usage-test-page :is(.field input,.field select){background:var(--a16-surface2)!important;border-color:var(--a16-line2)!important;color:var(--a16-text)!important;-webkit-text-fill-color:var(--a16-text)!important}
html[data-admin-theme] body.usage-policy-page .plan{border-color:var(--a16-line)!important}
.usage-theme-toggle{display:inline-flex;align-items:center;gap:7px;min-height:38px;padding:0 12px;border:1px solid var(--a16-line2)!important;border-radius:10px;background:var(--a16-surface2)!important;color:var(--a16-text)!important;font:800 12px/1 inherit;cursor:pointer}

/* ================= RESPONSIVE ================= */
@media(max-width:1050px){
 html[data-theme] body.castlance-portal-v8 .stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:900px){
 html[data-theme] body.castlance-public-v8 .releases-layout-v5{grid-template-columns:1fr!important}
 html[data-theme] body.castlance-public-v8 .release-side-v5{position:static!important}
 html[data-admin-theme] body.usage-policy-page .admin-shell{display:block!important}
 html[data-admin-theme] body.usage-policy-page .admin-side{position:relative!important;height:auto!important}
}
@media(max-width:760px){
 html[data-theme] body.castlance-public-v8 .container{width:min(100% - 22px,1180px)!important}
 html[data-theme] body.castlance-public-v8 .labs-grid{grid-template-columns:1fr!important}
 html[data-theme] body.castlance-public-v8 .cast-logo-item{flex-basis:104px;width:104px;height:104px;padding:10px;border-radius:18px;grid-template-rows:58px auto;gap:5px}
 html[data-theme] body.castlance-public-v8 .cast-logo-item>a{grid-template-rows:58px auto;gap:5px}
 html[data-theme] body.castlance-public-v8 .cast-logo-image{width:58px;height:58px;min-width:58px;min-height:58px}
 html[data-theme] body.castlance-public-v8 .cast-logo-name{max-width:86px;font-size:10px!important}
 html[data-theme] body.castlance-public-v8 .cast-logo-track{gap:12px;padding-inline:12px;animation-duration:22s}
 html[data-theme] body.castlance-public-v8 .release-summary-grid{grid-template-columns:1fr 1fr!important}
 html[data-theme] body.castlance-public-v8 .footer-grid{grid-template-columns:1fr 1fr!important}
 html[data-theme] body.castlance-public-v8 .footer-pay-head{display:grid!important;gap:10px!important}
 html[data-theme] body.castlance-public-v8 .payment-logos{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
 html[data-theme] body.castlance-public-v8 .payment-logo{min-width:0!important}
 html[data-theme] body.castlance-portal-v8 .table-wrap{margin-inline:0!important}
 html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .table,
 html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .table-wrap{border-radius:12px!important}
}
@media(max-width:560px){
 html[data-theme] body.castlance-public-v8 .footer-grid{grid-template-columns:1fr!important}
 html[data-theme] body.castlance-public-v8 .footer-bottom{display:grid!important;gap:6px!important}
 html[data-theme] body.castlance-public-v8 .payment-logos{grid-template-columns:1fr!important}
 html[data-theme] body.castlance-portal-v8 .stats{grid-template-columns:1fr!important}
 html[data-theme] body.castlance-portal-v8 .stats>.stat,html[data-theme] body.castlance-portal-v8 .stats>div{min-height:92px!important}
 html[data-theme] body.castlance-portal-v8 #portal-topups .table-wrap table{min-width:820px!important}
}

/* Final small geometry fixes discovered in visual QA. */
html[data-theme] body.castlance-public-v8,html[data-theme] body.castlance-portal-v8{overflow-x:hidden!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2{overflow-x:hidden!important}
html[data-theme="light"] body.castlance-public-v8 .site-nav.mobile-open{background:#fff!important;border-color:var(--c16-line)!important;box-shadow:0 18px 50px rgba(20,45,75,.16)!important}
html[data-theme="dark"] body.castlance-public-v8 .site-nav.mobile-open{background:#0b1828!important;border-color:var(--c16-line)!important}
html[data-theme] body.castlance-public-v8 .site-nav.mobile-open a{color:var(--c16-text)!important;-webkit-text-fill-color:var(--c16-text)!important}
html[data-theme="light"] body.castlance-public-v8 .mobile-overlay.show{background:rgba(24,43,65,.28)!important}
html[data-theme="dark"] body.castlance-public-v8 .mobile-overlay.show{background:rgba(3,10,20,.72)!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .experience-preview img:not(.admin-media-thumb){width:72px!important;height:72px!important;object-fit:contain!important;border-radius:13px!important;background:var(--a16-surface)!important;border:1px solid var(--a16-line)!important;padding:5px!important}
html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .experience-preview{grid-template-columns:72px minmax(0,1fr)!important}
@media(max-width:560px){
 html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .main{padding-left:12px!important;padding-right:12px!important}
 html[data-admin-theme] body.castlance-admin-v8.cast-ui-v2 .top{background:color-mix(in srgb,var(--a16-bg) 94%,transparent)!important;border-color:var(--a16-line)!important}
 body.usage-policy-page .wrap,body.usage-test-page .wrap{padding-left:12px!important;padding-right:12px!important}
 body.usage-policy-page .top,body.usage-test-page .top{gap:12px!important}
}
