/* Castlance Quality v20 — navigation, theme parity, marquee reliability */
.admin-home-link,.portal-home-link,.admin-brand,.footer-brand{text-decoration:none!important}

/* Pure CSS customer-reference rail. Does not depend on JS or hover state. */
body.castlance-public-v8 .cast-logo-marquee-v20{overflow:hidden!important;width:100%!important;padding:14px 0 10px!important;mask-image:linear-gradient(90deg,transparent,#000 5%,#000 95%,transparent);-webkit-mask-image:linear-gradient(90deg,transparent,#000 5%,#000 95%,transparent)}
body.castlance-public-v8 .cast-logo-track-v20{display:flex!important;align-items:center!important;gap:16px!important;width:max-content!important;padding:8px 0!important;animation:castLogoRailV20 28s linear infinite!important;will-change:transform!important}
body.castlance-public-v8 .cast-logo-track-v20 .cast-logo-set{display:flex!important;align-items:center!important;gap:16px!important;flex:0 0 auto!important}
body.castlance-public-v8 .cast-logo-track-v20:not(.is-ready){animation:castLogoRailV20 28s linear infinite!important}
body.castlance-public-v8 .cast-logo-marquee-v20:hover .cast-logo-track-v20{animation-play-state:running!important}
@keyframes castLogoRailV20{from{transform:translate3d(0,0,0)}to{transform:translate3d(calc(-50% - 8px),0,0)}}
@media(prefers-reduced-motion:reduce){body.castlance-public-v8 .cast-logo-track-v20{animation:castLogoRailV20 42s linear infinite!important}}
@media(max-width:640px){body.castlance-public-v8 .cast-logo-track-v20{animation-duration:23s!important}body.castlance-public-v8 .cast-logo-item{flex-basis:112px!important;width:112px!important;height:112px!important;padding:10px!important;grid-template-rows:66px auto!important}body.castlance-public-v8 .cast-logo-image{width:66px!important;height:66px!important;min-width:66px!important;min-height:66px!important}}

/* Usage Policies now follows the exact admin light/dark preference. */
html[data-admin-theme="light"] body.usage-policy-page{--up-bg:#f3f6fa;--up-s:#fff;--up-s2:#f7f9fc;--up-text:#142238;--up-muted:#66788d;--up-line:#d8e3ee;--up-input:#fff;--up-side:#fff;--up-side-text:#31465d}
html[data-admin-theme="dark"] body.usage-policy-page{--up-bg:#08111d;--up-s:#101b29;--up-s2:#142233;--up-text:#edf4fb;--up-muted:#9fb0c4;--up-line:#2a3d51;--up-input:#0c1724;--up-side:#0b1420;--up-side-text:#c9d7e5}
body.usage-policy-page{background:var(--up-bg)!important;color:var(--up-text)!important}
body.usage-policy-page :is(.admin-main,.wrap){background:var(--up-bg)!important;color:var(--up-text)!important}
body.usage-policy-page :is(.card,.plan){background:var(--up-s)!important;color:var(--up-text)!important;border-color:var(--up-line)!important}
body.usage-policy-page :is(.row,.tag){color:var(--up-text)!important;border-color:var(--up-line)!important}
body.usage-policy-page :is(h1,h2,h3,b,strong,label){color:var(--up-text)!important;-webkit-text-fill-color:var(--up-text)!important}
body.usage-policy-page :is(.muted,.small){color:var(--up-muted)!important;-webkit-text-fill-color:var(--up-muted)!important}
body.usage-policy-page :is(input,select,textarea){background:var(--up-input)!important;color:var(--up-text)!important;-webkit-text-fill-color:var(--up-text)!important;border-color:var(--up-line)!important}
body.usage-policy-page .admin-side{background:var(--up-side)!important;border-color:var(--up-line)!important;color:var(--up-side-text)!important}
body.usage-policy-page .admin-brand,body.usage-policy-page .admin-nav a{color:var(--up-side-text)!important;-webkit-text-fill-color:var(--up-side-text)!important}
html[data-admin-theme="light"] body.usage-policy-page .admin-nav a:hover,html[data-admin-theme="light"] body.usage-policy-page .admin-nav a.active{background:#edf3fa!important;color:#17395f!important;-webkit-text-fill-color:#17395f!important}
body.usage-policy-page .usage-theme-toggle,body.usage-policy-page .btn{border-color:var(--up-line)!important}

/* Portal light/dark details and helper cleanup. */
body.castlance-portal-v8 .portal-v64-title small{display:none!important}
body.castlance-portal-v8 .portal-home-link{display:block!important;color:inherit!important;-webkit-text-fill-color:inherit!important}
body.castlance-portal-v8 .portal-section-anchor{scroll-margin-top:90px!important}
html[data-theme="light"] body.castlance-portal-v8 :is(.portal-pop,.portal-accordion,.portal-new-ticket,.portal-chat,.chat-bubble){background:#fff!important;color:#142238!important;border-color:#d9e3ee!important}
html[data-theme="light"] body.castlance-portal-v8 :is(.portal-pop a,.portal-accordion-body,.portal-new-ticket form,.chat-bubble.customer){background:#f5f8fc!important;color:#142238!important;border-color:#d9e3ee!important}

/* Keep tables/cards legible on phone without stretching the whole page. */
@media(max-width:720px){body.castlance-portal-v8 .table-wrap,body.castlance-portal-v8 .table{max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important}body.castlance-portal-v8 table{min-width:680px}body.castlance-portal-v8 .stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:460px){body.castlance-portal-v8 .stats{grid-template-columns:1fr!important}}
