/* Theme adapter v1. Opt-in scope; real PHP shell, form and page hooks stay intact. */
body.royal-balanced-theme {
 --royal-title:'Great Vibes',Georgia,serif;
 --royal-ui:'Plus Jakarta Sans',system-ui,sans-serif;
 --pp-nav-font:var(--royal-ui);
 --royal-prose:'Raleway','Manrope',system-ui,sans-serif;
 --royal-surface:#13283f; --royal-surface2:#19324b; --royal-border:#38546e;
 --royal-ink:#eef3f9; --royal-muted:#b9c8d8; --royal-field:#0c1e31;
 --royal-gold:#e0bd73; --royal-shadow:#04101d80;
 color:var(--royal-ink); font-family:var(--royal-ui);font-weight:500;font-synthesis:none;
 background:radial-gradient(ellipse at 86% 0,#26466755,transparent 65%),linear-gradient(160deg,#10243a,#091929 70%);
}
:root[data-theme=light] body.royal-balanced-theme {
 --royal-surface:#fffdf9; --royal-surface2:#f1ede5; --royal-border:#c7bfb0;
 --royal-ink:#20334a; --royal-muted:#4e6277; --royal-field:#fffdfa;
 --royal-gold:#876022; --royal-shadow:#20365121;
 color:var(--royal-ink); background:radial-gradient(ellipse at 90% 0,#fbefd4,transparent 60%),linear-gradient(160deg,#f8f6f0,#edeae3);
}
body.royal-balanced-theme::before {background:none}
body.royal-balanced-theme :is(.admin-main>h1,.ptitle) {
 font:400 clamp(44px,4.6vw,64px)/1.4 var(--royal-title); letter-spacing:0;
 color:var(--royal-ink); text-shadow:none; overflow-wrap:anywhere; margin-bottom:14px;
}
html:is(:lang(ar),:lang(ja),:lang(zh),:lang(ko),:lang(ru),:lang(uk)) body.royal-balanced-theme {
 --royal-title:system-ui,sans-serif; --royal-prose:system-ui,sans-serif; --royal-ui:system-ui,sans-serif;
}
html:is(:lang(ar),:lang(ja),:lang(zh),:lang(ko),:lang(ru),:lang(uk)) body.royal-balanced-theme :is(.admin-main>h1,.ptitle) {
 font-size:clamp(30px,3.6vw,48px); font-weight:500; line-height:1.5;
}
body.royal-balanced-theme :is(.fixture-lead,.fixture-note,.fixture-status,.fixture-card>p) {
 font-family:var(--royal-prose); font-weight:350; font-synthesis:none; color:var(--royal-muted); text-shadow:none; line-height:1.65;
}
body.royal-balanced-theme p.fixture-lead {font-size:19px;font-weight:300;max-width:880px;margin:0 0 27px}
/* Chosen UI family uses the locally available real 500/600 weights. */
body.royal-balanced-theme:is(.portal-admin,.portal-customer,.portal-login) :is(button,input,select,textarea) {font-family:var(--royal-ui);font-synthesis:none}
body.royal-balanced-theme :is(h2,h3) {font-family:var(--royal-ui)}
body.royal-balanced-theme :is(input,select,textarea) {font-weight:500}
body.royal-balanced-theme :is(button,.btn,strong,b,h2,h3,.langbar a,.lbox label,.admin-avatar) {font-weight:600}
body.royal-balanced-theme :is(code,pre,kbd,samp,.code) {font-family:Consolas,ui-monospace,monospace}
body.royal-balanced-theme.portal-admin .admin-rail {
 background:linear-gradient(145deg,#152c43,#0d1e30 75%);border-color:#39516a;
 box-shadow:inset -1px 0 #9bb8d422,5px 0 26px #06111e22;
}
:root[data-theme=light] body.royal-balanced-theme.portal-admin .admin-rail {
 background:linear-gradient(145deg,#fbf7ee,#e8e2d6);border-color:#c1b6a4;
}
body.royal-balanced-theme.portal-admin :is(.admin-brand,.admin-avatar) {background:linear-gradient(160deg,#27435a,#172d42);border-color:#5e7483;color:#f5e6c4}
body.royal-balanced-theme.portal-admin .admin-brand strong {color:#f7efdf;font-family:var(--royal-ui)}
body.royal-balanced-theme.portal-admin .admin-brand small {color:#c1ccd8}
:root[data-theme=light] body.royal-balanced-theme.portal-admin .admin-brand strong {color:#f7efdf}
:root[data-theme=light] body.royal-balanced-theme.portal-admin .admin-brand small {color:#c1ccd8!important}
body.royal-balanced-theme.portal-admin .admin-brand img {object-fit:contain}
body.royal-balanced-theme.portal-admin {min-width:0}
body.royal-balanced-theme.portal-admin .admin-brand>span {min-width:0;overflow-wrap:anywhere}
body.royal-balanced-theme.portal-admin .admin-brand img {flex-shrink:0}
body.royal-balanced-theme.portal-admin .rail-nav {background:none;border:0;box-shadow:none;overflow:visible;display:grid;gap:9px;padding:0 3px 4px}
body.royal-balanced-theme.portal-admin .rail-label {color:#c6b98f;font-family:var(--royal-prose);font-weight:500}
:root[data-theme=light] body.royal-balanced-theme.portal-admin .rail-label {color:#6e5b37}
:root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a,.portal-signout) {
 border:1px solid #567793;border-top-color:#89a9c1;border-radius:8px;
 background:linear-gradient(180deg,#31536f,#243f5a 45%,#172d43);
 color:#fff!important;font:600 14px/1.35 var(--royal-ui);text-shadow:none!important;
 min-height:46px;padding:9px 12px;gap:11px;
 box-shadow:inset 0 1px #e1f2ff40,inset 0 -1px #07152580,0 3px #0a1c2e,0 5px 9px #00101b35;
 transition:transform .12s,box-shadow .12s;
}
:root[data-theme] body.royal-balanced-theme.portal-admin .rail-nav a:nth-child(even):not(.on) {background:linear-gradient(180deg,#31536f,#243f5a 45%,#172d43)}
:root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a,.portal-signout):hover {
 background:linear-gradient(180deg,#3b607e,#2a4965 45%,#1c354d);border-top-color:#a5c1d4;
 box-shadow:inset 0 1px #e1f2ff40,inset 0 -1px #07152580,0 3px #0a1c2e,0 6px 12px #00101b35;
}
:root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a).on {
 background:linear-gradient(180deg,#886430,#6f4e24 42%,#50391c);border-color:#b99350;border-top-color:#f4dca3;
 box-shadow:inset 0 1px #ffe8ac80,inset 0 -1px #33220c80,0 3px #35240e,0 5px 9px #00101b35;
}
:root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a,.portal-signout):active {transform:translateY(2px);box-shadow:inset 0 1px 3px #00101b70,0 1px #0a1c2e}
body.royal-balanced-theme :is(a,button,input,select,textarea):focus-visible {outline:2px solid var(--royal-gold);outline-offset:3px}
body.royal-balanced-theme.portal-admin .nav-icon {width:25px;height:25px;flex-basis:25px}
body.royal-balanced-theme svg.royal-material-icon {stroke:none;overflow:visible;flex-shrink:0;filter:none;width:25px;height:25px}
body.royal-balanced-theme.portal-admin .nav-icon svg.royal-material-icon {width:25px;height:25px}
body.royal-balanced-theme.portal-admin .admin-topbar {background:#10273ddd;border-color:#3a526b}
:root[data-theme=light] body.royal-balanced-theme.portal-admin .admin-topbar {background:#faf7efee;border-color:#c8bdab}
body.royal-balanced-theme.portal-admin .admin-main {max-width:1450px;padding-top:25px}
body.royal-balanced-theme.portal-customer .customer-topbar {background:#11283eee;border-color:#54718b;box-shadow:inset 0 1px #ffffff22,0 6px 24px #06132140}
:root[data-theme=light] body.royal-balanced-theme.portal-customer .customer-topbar {background:#fbf8f0ee;border-color:#c8bdab;box-shadow:0 6px 24px #20365116}
body.royal-balanced-theme.portal-customer .tbin {max-width:1500px;flex-wrap:wrap;gap:18px;padding:15px 25px}
body.royal-balanced-theme.portal-customer .pills {display:flex;gap:9px;flex-wrap:wrap;overflow:visible;justify-content:flex-start}
body.royal-balanced-theme.portal-customer .pills a {display:flex;align-items:center;flex-shrink:0}
body.royal-balanced-theme.portal-customer .pills a span {display:inline}
body.royal-balanced-theme.portal-customer :is(.who,.who b) {color:var(--royal-ink)}
body.royal-balanced-theme.portal-customer .topright {flex-wrap:wrap;min-width:0}
body.royal-balanced-theme .fixture-banner {
 position:relative;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;
 padding:9px 18px;font:500 12px/1.5 var(--royal-ui);background:#e5cb92;color:#352b1c;border-bottom:1px solid #9a7c46;
}
body.royal-balanced-theme.portal-admin .fixture-banner {margin-left:282px}
body.royal-balanced-theme .fixture-banner a {color:#352b1c;text-decoration:underline;text-underline-offset:3px}
body.royal-balanced-theme .fixture-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px}
body.royal-balanced-theme :is(.fixture-card,.fixture-grid>.card) {
 min-width:0;padding:25px;border:1px solid var(--royal-border);border-radius:15px;
 color:var(--royal-ink);background:linear-gradient(135deg,var(--royal-surface2),var(--royal-surface));
 box-shadow:inset 0 1px #ffffff18,inset 0 -1px #00000025,0 4px var(--royal-shadow),0 12px 25px var(--royal-shadow);
}
body.royal-balanced-theme :is(.fixture-card,.fixture-grid>.card) h2 {font:600 21px/1.4 var(--royal-ui);color:var(--royal-ink);margin:0 0 13px}
body.royal-balanced-theme .fixture-form {display:grid;gap:12px;min-width:0}
body.royal-balanced-theme .fixture-form :is(input,select,textarea) {
 max-width:100%;min-width:0;width:100%;min-height:44px;background:var(--royal-field);color:var(--royal-ink);border:1px solid var(--royal-border);border-radius:7px;padding:10px 12px;font:500 14px var(--royal-ui);
}
body.royal-balanced-theme .fixture-form label {color:var(--royal-ink);font:600 14px/1.5 var(--royal-ui)}
body.royal-balanced-theme .fixture-form button {min-height:44px;justify-self:start;max-width:100%;white-space:normal;font-family:var(--royal-ui)}
body.royal-balanced-theme:is(.portal-admin,.portal-customer,.portal-login) input:is([name=uuid],[name=box_uuid]) {font-family:Consolas,ui-monospace,monospace}
body.royal-balanced-theme .fixture-table {overflow-x:auto;max-width:100%;border:1px solid var(--royal-border);border-radius:10px}
body.royal-balanced-theme .fixture-table table {width:100%;min-width:510px;margin:0;background:var(--royal-surface);color:var(--royal-ink)}
body.royal-balanced-theme .fixture-table :is(th,td) {padding:13px;white-space:nowrap;border-color:var(--royal-border)}
body.royal-balanced-theme .fixture-table th {font:600 12px var(--royal-ui);color:var(--royal-muted);background:var(--royal-surface2)}
body.royal-balanced-theme .fixture-table td {font:500 14px var(--royal-ui)}
body.royal-balanced-theme .fixture-status {color:var(--royal-muted)}
body.royal-balanced-theme.portal-login .lbox {background:var(--royal-surface);border-color:var(--royal-border);border-radius:18px}
body.royal-balanced-theme.portal-login .tag {font:350 19px/1.65 var(--royal-prose);color:var(--royal-ink)}
@media(max-width:560px) {
 body.royal-balanced-theme.portal-admin .admin-topbar {grid-template-columns:44px minmax(0,1fr)}
 body.royal-balanced-theme.portal-admin .admin-top-actions {grid-column:1/-1;justify-content:flex-end}
 body.royal-balanced-theme.portal-admin .admin-top-actions .langgo {display:inline-flex;align-items:center;min-height:44px}
 body.royal-balanced-theme.portal-admin :is(.admin-menu-btn,.admin-theme-btn) {width:44px;min-width:44px;height:44px;flex:0 0 44px}
 body.royal-balanced-theme.portal-admin .admin-top-actions .langsel {min-height:44px}
}
body.royal-balanced-theme.portal-login :is(label,.help,.langbar a) {color:var(--royal-muted);font-family:var(--royal-ui)}
body.royal-balanced-theme.portal-login input {color:var(--royal-ink);background:var(--royal-field);border-color:var(--royal-border)}
body.royal-balanced-theme.portal-login .langbar {flex-wrap:wrap}
@media(max-width:1280px) {
 body.royal-balanced-theme.portal-customer .pills {flex-basis:100%;order:3}
}
@media(max-width:1120px) {body.royal-balanced-theme.portal-admin .fixture-banner {margin-left:244px}}
@media(max-width:1050px) {body.royal-balanced-theme .fixture-grid {grid-template-columns:minmax(0,1fr)}}
@media(max-width:980px) {
 body.royal-balanced-theme p.fixture-lead {font-size:17px}
 body.royal-balanced-theme.portal-customer .tbin {padding:15px}
 body.royal-balanced-theme.portal-customer .pills a {font-size:14px;min-height:44px;padding:8px 10px}
 body.royal-balanced-theme .fixture-card {padding:19px}
 body.royal-balanced-theme :is(.admin-main>h1,.ptitle) {font-size:46px;line-height:1.4}
 body.royal-balanced-theme.portal-customer .brand-img {object-fit:contain}
}
@media(max-width:820px) {
 body.royal-balanced-theme.portal-admin .fixture-banner {margin-left:0}
 body.royal-balanced-theme.portal-admin .admin-rail {width:min(282px,86vw)}
}
@media(max-width:450px) {
 body.royal-balanced-theme .fixture-banner {font-size:11px;padding:9px 14px}
}
@media(prefers-reduced-motion:reduce) {:root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a,.portal-signout) {transition:none;transform:none!important}}
@media(forced-colors:active) {
 :root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a,.portal-signout),
 :root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a,.portal-signout):is(:hover,:active) {color:LinkText!important;background:Canvas!important;box-shadow:none!important;border-color:ButtonText!important}
 :root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a).on {color:HighlightText!important;background:Highlight!important}
 body.royal-balanced-theme svg.royal-material-icon [filter] {filter:none}
 body.royal-balanced-theme svg.royal-material-icon .material-body,
 body.royal-balanced-theme svg.royal-material-icon .material-body :is(path,rect,circle,ellipse,polygon) {fill:currentColor;stroke:currentColor}
 body.royal-balanced-theme svg.royal-material-icon :is(.material-highlight,.material-detail) {display:none}
}

/* Selected balanced navy/champagne palette. Existing re_theme preference wins. */
body.royal-balanced-theme {
 --royal-ui:'Plus Jakarta Sans',system-ui,sans-serif;
 --royal-surface:#101925;--royal-surface2:#172231;--royal-border:#414951;
 --royal-ink:#f5f5f4;--royal-muted:#d5d5d4;--royal-field:#0c1521;
 --royal-gold:#c8a96e;--royal-shadow:#0003;
 background:#080d16;font-weight:400;
}
body.royal-balanced-theme.portal-admin .admin-rail {background:linear-gradient(160deg,#101925,#080d16 72%);border-color:#2d3847}
body.royal-balanced-theme.portal-admin .admin-topbar,
body.royal-balanced-theme.portal-customer .customer-topbar {background:#101925;border-color:#2d3847}
:root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a,.portal-signout),
:root[data-theme] body.royal-balanced-theme.portal-admin .rail-nav a:nth-child(even):not(.on) {
 background:linear-gradient(160deg,#253449,#1a293a 55%,#132031);
 border-color:#ffffff2b;border-top-color:#ffffff3d;
 box-shadow:inset 0 1px #ffffff10,0 2px #0009,0 4px 8px #0002;
}
:root[data-theme] body.royal-balanced-theme :is(.rail-nav a,.pills a).on {
 background:linear-gradient(180deg,#5a4b34,#443a2b);border-color:#c8a96eaa;border-top-color:#e9d5b3;
 box-shadow:inset 0 1px #e9d5b329,0 2px #19140d,0 4px 8px #0003;
}
body.royal-balanced-theme :is(button,input,select,textarea,th,td) {font-family:var(--royal-ui)}
body.royal-balanced-theme :is(.num,.big,.tx-amt) {font-variant-numeric:tabular-nums}
body.royal-balanced-theme :is(.admin-main>h1,.ptitle) {background:none;-webkit-text-fill-color:currentColor;color:var(--royal-ink);text-shadow:none}
:root[data-theme=light] body.royal-balanced-theme.portal-admin .admin-rail {background:linear-gradient(145deg,#fbf7ee,#e8e2d6);border-color:#c1b6a4}
:root[data-theme=light] body.royal-balanced-theme.portal-admin .admin-topbar,
:root[data-theme=light] body.royal-balanced-theme.portal-customer .customer-topbar {background:#fbf8f0;border-color:#c8bdab}
html:is(:lang(ar),:lang(ja),:lang(zh),:lang(ko),:lang(ru),:lang(uk)) body.royal-balanced-theme {
 --royal-title:system-ui,sans-serif;--royal-prose:system-ui,sans-serif;--royal-ui:system-ui,sans-serif;
}
body.royal-balanced-theme.portal-customer .topright .who b {
 font-family:var(--royal-ui);font-size:15px;font-weight:600;text-shadow:none;
}
body.royal-balanced-theme.portal-customer .topright .who b::after {display:none;animation:none}
@media(max-width:820px) {
 body.royal-balanced-theme.portal-customer .tbin {gap:9px;padding:12px;min-width:0}
 body.royal-balanced-theme.portal-customer .pills {
  flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;min-width:0;width:100%;
  max-width:100%;flex-basis:100%;padding:2px 2px 7px;scrollbar-width:thin;
 }
 body.royal-balanced-theme.portal-customer .pills a {width:auto;flex:0 0 auto;white-space:nowrap}
 body.royal-balanced-theme.portal-customer .topright {flex:1 1 160px;gap:5px;flex-wrap:nowrap}
 body.royal-balanced-theme.portal-customer .topright .navbtn {min-height:44px}
 body.royal-balanced-theme.portal-customer .portal-signout {min-width:44px;width:44px;padding:0;flex:none}
}
