/* Shared presentation layer; data, authentication and chart logic remain in their owning scripts. */
:root,html[data-theme="dark"],html[data-ustp-theme="dark"],html[data-daerah-theme="dark"]{--bg:#090a0c;--bg2:#101114;--surface:#141519;--surface-soft:#1c1c20;--text:#f3f0e9;--text-soft:#d1ccc1;--muted:#a7a39b;--primary:#e6bd69;--secondary:#b68b3e;--accent:#e6bd69;--accent-soft:#2b2315;--blue-soft:#282316;--border:#353026;--shadow:0 14px 38px #00000024;--radius-lg:12px;--radius-md:9px;--gold-strong:#e6bd69;--gold-soft:#d8bb85;--button-ink:#211807;--panel-gradient:linear-gradient(140deg,#211d15,#121316)}
html:is([data-theme="light"],[data-ustp-theme="light"],[data-daerah-theme="light"]){--bg:#f7f5ef;--bg2:#eeeae0;--surface:#ffffff;--surface-soft:#f2eee4;--text:#24221c;--text-soft:#4e493d;--muted:#6b6455;--primary:#805b18;--secondary:#9b6b21;--accent:#805b18;--accent-soft:#f0e5cc;--blue-soft:#f0e5cc;--border:#d9cdb5;--shadow:0 12px 28px #6a4e1910;--gold-strong:#805b18;--gold-soft:#805b18;--button-ink:#211807;--panel-gradient:linear-gradient(135deg,#fffaf0,#fff)}
html[data-portal-ui="gold"] body{background:var(--bg)!important;color:var(--text)!important;font-family:Inter,Arial,sans-serif!important}
html[data-portal-ui="gold"] body .topbar{background:var(--bg)!important;border-bottom:1px solid var(--border)!important;backdrop-filter:blur(15px)!important}
html[data-portal-ui="gold"] body .nav{min-height:80px!important;gap:16px!important}.brand-text strong{font-size:14px!important;line-height:1.35!important}.brand-text span{font-size:10px!important;line-height:1.5!important}.brand-mark{background:var(--surface)!important;border:1px solid var(--border)!important;border-radius:8px!important;box-shadow:none!important}
html[data-portal-ui="gold"] body .nav-links{gap:17px!important;font-size:12px!important;white-space:nowrap}.nav-links a{color:var(--muted)!important}.nav-links a:hover{color:var(--primary)!important}.nav-links .home-link{padding:8px 10px!important;background:var(--accent-soft)!important;border:1px solid var(--border)!important;border-radius:5px!important;color:var(--primary)!important}
html[data-portal-ui="gold"] body :is(.btn,.admin-btn,.v2-theme-toggle,.nav-toggle){border-radius:6px!important;box-shadow:none!important;font-size:12px!important;min-height:42px;letter-spacing:0!important}.admin-btn{white-space:nowrap;padding:11px 14px!important}.v2-theme-toggle{padding:9px 12px!important;white-space:nowrap;border:1px solid var(--border)!important;background:var(--surface)!important;color:var(--text)!important}.nav-toggle{background:var(--surface)!important;color:var(--primary)!important;border-color:var(--border)!important}
html[data-portal-ui="gold"] body :is(.btn-primary,.admin-btn){background:linear-gradient(110deg,#f0d38f,#d6a642)!important;color:var(--button-ink)!important;border:1px solid #c69a49!important}.btn-primary:hover,.admin-btn:hover{filter:brightness(1.07)}html[data-portal-ui="gold"] body .btn-secondary{background:var(--surface)!important;color:var(--text)!important;border:1px solid var(--border)!important}
html[data-portal-ui="gold"] body .hero{padding:55px 0!important;background:radial-gradient(ellipse at 75% 0%,#bc914214,transparent 65%),var(--bg)!important;border-bottom:1px solid var(--border)!important}.hero-grid{grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr)!important;gap:38px!important}.hero h1{font-size:clamp(34px,3.75vw,55px)!important;line-height:1.12!important;letter-spacing:-1.8px!important;font-weight:700!important;margin:22px 0!important;color:var(--text)!important;max-width:700px!important}.hero p{font-size:15px!important;color:var(--muted)!important;line-height:1.8!important}.hero-actions{gap:10px!important;margin-top:26px!important}.hero-visual{min-height:300px!important}.visual-card{position:relative!important;inset:auto!important;border:1px solid #715831!important;border-radius:12px!important;padding:26px!important;background:var(--panel-gradient)!important;box-shadow:none!important;color:var(--text)!important}.visual-card:before,.visual-card:after{display:none!important}.visual-title{font-size:23px!important;line-height:1.35!important;margin-bottom:22px!important}.mini-label{font-size:10px!important;letter-spacing:1.5px!important;text-transform:uppercase;color:var(--gold-soft)!important}.mini-kpis{gap:12px!important}.mini-kpi{background:var(--surface-soft)!important;border:1px solid var(--border)!important;border-radius:7px!important;padding:19px!important;backdrop-filter:none!important}.mini-kpi strong{color:var(--primary)!important;font-size:30px!important}.mini-kpi span{color:var(--muted)!important;font-size:11px!important}
html[data-portal-ui="gold"] body .eyebrow{color:var(--primary)!important;background:var(--accent-soft)!important;border:1px solid var(--border)!important;border-radius:5px!important;font-size:10px!important;letter-spacing:.9px!important;padding:8px 11px!important}.section{padding-top:45px!important;padding-bottom:45px!important}.section-heading h2{font-size:clamp(25px,3vw,34px)!important;letter-spacing:-.8px!important;line-height:1.25!important}.section-heading p{font-size:13px!important;line-height:1.8!important;max-width:720px}.section-heading{gap:18px!important;align-items:center!important}.status-line{font-size:11px!important;white-space:normal!important;max-width:240px!important}
html[data-portal-ui="gold"] body :is(.v2-command-strip,.v2-priority-section,.v2-timeline-section){background:var(--bg)!important;border-color:var(--border)!important}.v2-command-strip{padding:17px 0!important}.v2-command-strip-inner{font-size:11px!important;gap:16px!important}.v2-command-status,.v2-command-date,.v2-section-status,.v2-section-kicker{color:var(--primary)!important}.v2-command-meta{color:var(--muted)!important}.v2-live-dot{background:var(--primary)!important;box-shadow:0 0 0 4px #e6bd6914!important}.v2-alert-grid{gap:16px!important}.v2-alert-card{background:var(--surface)!important;border:1px solid var(--border)!important;border-radius:9px!important;box-shadow:none!important;padding:24px!important}.v2-alert-card:before,.v2-alert-card:after{display:none!important}.v2-alert-icon{background:var(--accent-soft)!important;color:var(--primary)!important;border-color:var(--border)!important;border-radius:7px!important}.v2-alert-label{color:var(--gold-soft)!important;font-size:9px!important;letter-spacing:1px!important}.v2-alert-card h3{font-size:19px!important;line-height:1.4!important;color:var(--text)!important}.v2-alert-card p{font-size:12px!important;color:var(--muted)!important}.v2-alert-card a{color:var(--primary)!important;font-size:12px!important}
html[data-portal-ui="gold"] body :is(.year-card,.kpi-card,.chart-card,.competition-card,.v2-top3-card,.panel,.stat,.kpi,.card,.secret-panel){background:var(--surface)!important;color:var(--text)!important;border:1px solid var(--border)!important;border-radius:9px!important;box-shadow:none!important}.year-card{min-height:115px;display:grid!important;gap:10px!important;padding:22px!important}.year-card strong{font-size:28px!important;color:var(--primary)!important}.year-card span{color:var(--muted)!important;font-size:12px!important}.year-card[aria-pressed="true"]{border-color:var(--primary)!important;background:var(--panel-gradient)!important}.kpi-grid{gap:12px!important}.kpi-card{padding:20px!important}.kpi-value{color:var(--primary)!important;font-size:30px!important}.kpi-icon{background:var(--accent-soft)!important;border-radius:6px!important;color:var(--primary)!important}.kpi-label{font-size:11px!important}.kpi strong,.stat strong{color:var(--primary)!important}
html[data-portal-ui="gold"] body :is(.filter-control,.control,input,select){background:var(--surface)!important;color:var(--text)!important;border-color:var(--border)!important;border-radius:6px!important}.filters{gap:12px!important}.filters label{font-size:12px!important;color:var(--muted)!important}.filter-control{min-height:47px!important}html[data-portal-ui="gold"] body input::placeholder{color:var(--muted)!important;opacity:1}html[data-portal-ui="gold"] body :is(.competition-top,.dashboard-top){background:var(--panel-gradient)!important;color:var(--text)!important;border-bottom:1px solid var(--border)!important}.competition-top{padding:24px!important}.competition-top:after{display:none!important}.competition-top h3{font-size:23px!important;line-height:1.35!important;color:var(--text)!important}.competition-top p{font-size:13px!important;color:var(--muted)!important}.competition-badges{margin-bottom:16px!important}.badge{background:var(--accent-soft)!important;border:1px solid var(--border)!important;color:var(--gold-soft)!important;border-radius:4px!important;font-size:10px!important}.competition-body{padding:22px!important}.competition-stats{gap:9px!important}.small-stat{background:var(--surface-soft)!important;border:1px solid var(--border)!important;border-radius:6px!important;padding:12px 8px!important}.small-stat strong{color:var(--primary)!important;font-size:21px!important}.small-stat span{color:var(--muted)!important;font-size:10px!important}.winner-note{font-size:11px!important}.competition-footer{gap:12px!important;flex-wrap:wrap!important}.chart-card h3{color:var(--text)!important;font-size:18px!important}.chart-summary{font-size:12px!important}.chart-summary li{border-color:var(--border)!important}.dashboard-panel{background:var(--surface)!important;color:var(--text)!important;border:1px solid var(--border)!important;border-radius:12px!important}.dashboard-modal{background:#000000b8!important;backdrop-filter:blur(6px)}.dashboard-top h2{font-size:26px!important;line-height:1.3!important}.dashboard-close,.secret-close{background:var(--surface-soft)!important;color:var(--text)!important;border-color:var(--border)!important}.dashboard-note,.source-note{background:var(--accent-soft)!important;color:var(--text-soft)!important;border-color:var(--border)!important}.dashboard-section-title{color:var(--primary)!important}.district-table th,.table th{background:var(--accent-soft)!important;color:var(--gold-soft)!important}.district-table td,.table td{border-color:var(--border)!important;color:var(--text)!important}.district-table tr.active{background:var(--accent-soft)!important}.table-wrap{border-color:var(--border)!important}.empty-state,.loading-state,.error-state{background:var(--surface)!important;border-color:var(--border)!important;color:var(--muted)!important}.error-state{color:#e68f85!important}.auth-message.error{color:#e68f85!important}.footer{background:var(--bg)!important;border-top:1px solid var(--border)!important;color:var(--muted)!important}.footer strong{color:var(--text)!important}.toast{background:var(--accent-soft)!important;color:var(--text)!important;border:1px solid var(--primary)!important}
html[data-portal-ui="gold"] body .ustp-home-card{background:var(--panel-gradient)!important;border:1px solid #715831!important;border-radius:10px!important;box-shadow:none!important;backdrop-filter:none!important}.ustp-home-card h2{color:var(--text)!important;text-shadow:none!important;font-size:24px!important}.ustp-home-card p{color:var(--muted)!important;font-size:13px!important}.ustp-home-actions{min-width:210px!important}.ustp-home-entry .eyebrow{color:var(--primary)!important}
html[data-portal-ui="gold"] body :is(.side,.side-rail){background:var(--bg)!important;border-right:1px solid var(--border)!important;box-shadow:none!important}html[data-portal-ui="gold"] body :is(.side-head,.side-rail-head){border-color:var(--border)!important;min-height:130px!important;padding:25px 20px!important}html[data-portal-ui="gold"] body :is(.side-head strong,.side-rail-head strong){color:var(--primary)!important;font-size:22px!important}html[data-portal-ui="gold"] body :is(.side-head span,.side-rail-head span,.side-label){color:var(--muted)!important}.side-rail-link,.side-link{font-size:12px!important;min-height:44px!important;border-radius:5px!important;color:var(--muted)!important}.side-rail-menu,.side-menu{padding:20px 12px!important;gap:8px!important}html[data-portal-ui="gold"] body :is(.side-rail-link.active,.side-link.active){background:var(--accent-soft)!important;color:var(--primary)!important;border-color:#6b5530!important;box-shadow:inset 3px 0 0 var(--primary)!important}html[data-portal-ui="gold"] body :is(.side-rail-link:hover,.side-link:hover){background:var(--surface)!important;border-color:var(--border)!important;color:var(--text)!important}html[data-portal-ui="gold"] body :is(.side-foot,.side-rail-foot){background:var(--bg)!important;border-color:var(--border)!important}html[data-portal-ui="gold"] body :is(.side-foot,.side-rail-foot) .btn{background:var(--surface)!important;color:var(--text)!important;border-color:var(--border)!important;border-radius:5px!important}
html:is([data-theme="light"],[data-ustp-theme="light"],[data-daerah-theme="light"]) body :is(.topbar,.hero,.side,.side-rail,.side-head,.side-rail-head,.side-foot,.side-rail-foot){background:var(--bg)!important;color:var(--text)!important}html:is([data-theme="light"],[data-ustp-theme="light"],[data-daerah-theme="light"]) body :is(.side-link,.side-rail-link){color:var(--text-soft)!important}html:is([data-theme="light"],[data-ustp-theme="light"],[data-daerah-theme="light"]) body :is(.side-link.active,.side-rail-link.active){color:var(--primary)!important;background:var(--accent-soft)!important;box-shadow:inset 3px 0 0 var(--primary)!important}
:focus-visible{outline:2px solid var(--primary)!important;outline-offset:4px!important}
@media(min-width:1180px){html[data-portal-ui="gold"] body :is(.side,.side-rail){width:230px!important}html[data-portal-ui="gold"] body{padding-left:230px!important}.topbar .nav-links{display:none!important}.topbar .brand{margin-right:auto}.hero-grid{gap:30px!important}}
@media(min-width:861px) and (max-width:1179px){html[data-portal-ui="gold"] body :is(.side,.side-rail){width:210px!important}html[data-portal-ui="gold"] body{padding-left:210px!important}.topbar .nav-links{display:none!important}.hero-grid{grid-template-columns:1fr!important}.hero-visual{min-height:auto!important}.mini-kpis{grid-template-columns:repeat(4,minmax(0,1fr))!important}.mini-kpi{padding:17px 10px!important}.visual-title{font-size:20px!important}.visual-card{padding:22px!important}.hero h1{font-size:43px!important;max-width:650px!important}}
@media(max-width:860px){html[data-portal-ui="gold"] body{padding-left:0!important}.hero{padding:38px 0!important}.hero-grid{grid-template-columns:1fr!important;gap:30px!important}.hero h1{font-size:clamp(31px,6.3vw,45px)!important;line-height:1.14!important;letter-spacing:-1.2px!important}.hero-visual{min-height:auto!important}.nav{flex-wrap:wrap!important;padding:12px 0!important;gap:10px!important}.nav-links{width:100%;gap:10px!important;flex-wrap:wrap!important}.v2-command-strip-inner{flex-wrap:wrap!important}.kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}.kpi-card:last-child{grid-column:1/-1}.section-heading{align-items:flex-start!important;flex-wrap:wrap!important}.status-line{max-width:none!important}.ustp-home-card{grid-template-columns:1fr!important}.ustp-home-actions{justify-content:flex-start!important}.v2-alert-grid,.chart-grid{grid-template-columns:1fr!important}.competition-grid{grid-template-columns:1fr!important}.chart-card{padding:18px!important}.dashboard-modal{padding:16px 10px!important}.dashboard-top h2{font-size:22px!important}}
@media(max-width:500px){.container{width:calc(100% - 32px)!important}.brand-text strong{font-size:12px!important;max-width:160px!important}.brand-text span{font-size:9px!important;max-width:170px!important}.brand-mark{width:40px!important;height:40px!important}.admin-btn{padding:10px!important;font-size:10px!important;min-height:40px!important}.v2-theme-toggle{font-size:10px!important;min-height:38px!important}.hero h1{font-size:34px!important}.hero p{font-size:14px!important}.visual-card{padding:20px!important}.visual-title{font-size:21px!important}.mini-kpi{padding:17px!important}.mini-kpi strong{font-size:27px!important}.hero-actions .btn{flex:1 1 140px!important;font-size:11px!important}.competition-top h3{font-size:21px!important}.competition-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}.v2-alert-card{padding:20px!important}.section-heading h2{font-size:27px!important}.filters{grid-template-columns:1fr!important}.filter-control{min-width:0!important;width:100%!important}.v2-command-meta{display:none!important}.competition-footer .btn{min-width:130px!important}.dashboard-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto!important}*,*:before,*:after{animation:none!important;transition:none!important}}
@media(min-width:861px){html[data-portal-ui="gold"] body .topbar .nav-links{display:flex!important}html[data-portal-ui="gold"] body .topbar .nav-links a:not(.home-link){display:none!important}html[data-portal-ui="gold"] body .topbar .nav-links .home-link{display:block!important}}
@media(max-width:500px){html[data-portal-ui="gold"] body .nav>.brand{flex:1 1 calc(100% - 60px)!important}html[data-portal-ui="gold"] body .nav-toggle{flex:0 0 44px!important}html[data-portal-ui="gold"] body .nav>.admin-btn{width:auto!important;flex:1 1 200px!important}html[data-portal-ui="gold"] body .nav>.v2-theme-toggle{width:auto!important;flex:0 0 auto!important}html[data-portal-ui="gold"] body .nav-links.open{top:100%!important;background:var(--surface)!important;border:1px solid var(--border)!important;padding:16px!important}}
html[data-portal-ui="gold"] body .top{background:var(--panel-gradient)!important;border:1px solid #715831!important;border-radius:12px!important;box-shadow:none!important}html[data-portal-ui="gold"] body .top p{color:var(--muted)!important}html[data-portal-ui="gold"] body .top h1{color:var(--text)!important;letter-spacing:-1px!important}html[data-portal-ui="gold"] body .status{color:var(--muted)!important}
/* Readable type and touch targets on the public portal and both district views. */
html[data-portal-ui="gold"] body :is(.eyebrow,.mini-label,.v2-alert-label,.badge,.v2-section-kicker,.status-line,.v2-command-strip-inner,.v2-command-meta,.v2-command-date,.year-card span,.chart-summary,.winner-note,.kpi-label,.mini-kpi span,.small-stat span){font-size:12px!important;line-height:1.65!important}
html[data-portal-ui="gold"] body :is(.section-heading p,.v2-alert-card p,.ustp-home-card p,.competition-top p,.hero p){font-size:15px!important;line-height:1.8!important}
html[data-portal-ui="gold"] body :is(.side-link,.side-rail-link,.nav-links){font-size:13px!important;line-height:1.6!important}
html[data-portal-ui="gold"] body :is(.brand-text span,.side-head span,.side-rail-head span){font-size:12px!important;line-height:1.6!important}
html[data-portal-ui="gold"] body :is(.btn,.admin-btn,.v2-theme-toggle,.nav-toggle){font-size:13px!important;line-height:1.5!important;min-height:44px!important}
html[data-portal-ui="gold"] body :is(input,select,.filter-control,.control){font-size:16px!important;line-height:1.5!important;min-height:48px!important}
html[data-portal-ui="gold"] body :is(.small-stat span,.kpi-label,.mini-kpi span){color:var(--muted)!important}
html[data-portal-ui="gold"] body :is(.competition-top h3,.v2-alert-card h3,.brand-text strong,.rank-main){overflow-wrap:anywhere!important}
html[data-portal-ui="gold"] body .side-rail-head span{max-width:none!important;white-space:normal!important}
@media(max-width:500px){html[data-portal-ui="gold"] body .brand-text strong{font-size:13px!important;line-height:1.4!important}html[data-portal-ui="gold"] body .brand-text span{font-size:11px!important}html[data-portal-ui="gold"] body :is(.section-heading p,.v2-alert-card p,.ustp-home-card p,.competition-top p,.hero p){font-size:15px!important}html[data-portal-ui="gold"] body :is(.btn,.admin-btn,.v2-theme-toggle){font-size:13px!important}html[data-portal-ui="gold"] body .nav>.admin-btn{flex:1 1 200px!important}html[data-portal-ui="gold"] body .competition-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}html[data-portal-ui="gold"] body .table-wrap{overflow-x:auto!important;-webkit-overflow-scrolling:touch}html[data-portal-ui="gold"] body .table-wrap :is(td,th){font-size:13px!important;line-height:1.65!important}.footer small{font-size:12px!important;line-height:1.8!important}}

/* Chart summaries must remain legible in both themes. */
html[data-portal-ui="gold"] body .chart-summary{color:var(--text)!important;font-size:14px!important;line-height:1.75!important}
html[data-portal-ui="gold"] body .chart-summary li{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:12px 18px!important;align-items:start!important;padding:12px 0!important;border-color:var(--border)!important;color:var(--text)!important;opacity:1!important}
html[data-portal-ui="gold"] body .chart-summary li *{color:var(--text)!important;opacity:1!important;font-size:14px!important;line-height:1.75!important;min-width:0;overflow-wrap:anywhere}
html[data-portal-ui="gold"] body .chart-summary li strong{color:var(--primary)!important;font-weight:700!important;text-align:right!important}
html[data-portal-ui="gold"][data-theme="light"] body .chart-summary li,html[data-portal-ui="gold"][data-theme="light"] body .chart-summary li span{color:#24221c!important}
html[data-portal-ui="gold"][data-theme="light"] body .chart-summary li strong{color:#805b18!important}
@media(max-width:500px){html[data-portal-ui="gold"] body .chart-summary li{gap:10px!important}html[data-portal-ui="gold"] body .chart-summary li *{font-size:13px!important}}
