/* V8 visual redesign; V7.2 application logic is untouched */
:root{--v8-side:rgba(2,40,42,.94);--v8-surface:rgba(252,248,239,.95);--v8-gold:#d9b76e}
:root[data-nagi-theme="B"]{--v8-side:rgba(45,81,51,.95);--v8-surface:rgba(255,251,241,.96)}
:root[data-nagi-theme="C"]{--v8-side:rgba(2,40,27,.96);--v8-surface:rgba(251,250,240,.95)}
:root[data-nagi-theme="D"]{--v8-side:rgba(29,41,59,.95);--v8-surface:rgba(255,246,242,.95)}
body:has(#home:not(.hidden))>header{display:none}
body:has(#home:not(.hidden)) .wrap{max-width:1450px!important;margin:22px auto!important;padding:0 20px!important}
#home.dashboard:not(.hidden){display:grid!important;grid-template-columns:205px minmax(0,1fr);gap:14px 18px;align-content:start;min-height:750px;padding:16px!important;background:rgba(4,39,40,.38)!important;border:1px solid var(--v8-gold)!important;border-radius:22px!important;box-shadow:0 24px 70px #001e204d!important}
#home .dash-nav{grid-column:1;grid-row:1/span 6;position:relative!important;top:auto!important;bottom:auto!important;display:flex!important;flex-direction:column!important;gap:3px!important;align-items:stretch!important;overflow:visible!important;background:var(--v8-side)!important;border:1px solid #d9b76e80!important;border-radius:15px!important;padding:16px 12px!important}
#home .dash-nav:before{content:"";display:block;height:145px;width:100%;margin:0 auto 15px;background:url('./nagi-official-logo.png') center/contain no-repeat;border-bottom:1px solid #d9b76e33}
#home .dash-nav .tab,#home .dash-nav a.tab{display:flex!important;align-items:center!important;justify-content:flex-start!important;width:100%!important;min-height:38px!important;margin:0!important;padding:9px 11px!important;border:0!important;border-radius:8px!important;background:transparent!important;color:#fff4d8!important;font-size:12px!important;white-space:normal!important;text-decoration:none!important;box-shadow:none!important}
#home .dash-nav .tab.active{background:linear-gradient(105deg,#fff3cf,#c9a55e)!important;color:#173c34!important;font-weight:700!important}
#home .dash-nav .tab:hover{background:#d9b76e33!important}
#home .dash-top{grid-column:2;grid-row:1;margin:0!important;padding:12px 10px 4px!important;color:white!important}
#home .dash-top h1{color:white!important;font-size:27px!important;letter-spacing:.07em}
#home .dash-top p,#home .dash-top .eyebrow{color:#f0dfba!important}
#home .status-note{grid-column:2;grid-row:2;margin:0!important;padding:10px 14px!important;background:var(--v8-surface)!important;font-size:12px!important}
#home .stats{grid-column:2;grid-row:3;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:10px!important}
#home .stat{background:rgba(8,68,67,.77)!important;color:white!important;border:1px solid #d9b76e80!important;padding:18px 14px!important;min-width:0!important}
#home .stat strong,#home .stat span,#home .stat small{color:white!important}
:root[data-nagi-theme="B"] #home .stat{background:rgba(250,247,236,.94)!important}
:root[data-nagi-theme="B"] #home .stat strong,:root[data-nagi-theme="B"] #home .stat span,:root[data-nagi-theme="B"] #home .stat small{color:#21482e!important}
:root[data-nagi-theme="D"] #home .stat{background:rgba(38,47,66,.78)!important}
#home .nagi-ga4{grid-column:2;grid-row:4;margin:0!important;padding:20px!important;background:var(--v8-surface)!important;border:1px solid var(--v8-gold)!important;border-radius:15px!important;color:#24423c!important}
#home .nagi-ga-stats{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:10px!important}
#home .nagi-ga-stats>div{background:#fff9!important;border:1px solid #d9b76e!important;border-radius:11px!important;padding:14px 10px!important;min-width:0}
#home .dash-content{grid-column:2;grid-row:5;margin:0!important;background:var(--v8-surface)!important;border:1px solid var(--v8-gold)!important;min-height:220px!important}
body:has(#home:not(.hidden)) .foot{display:none}
@media(max-width:800px){body:has(#home:not(.hidden)) .wrap{padding:0 10px 100px!important;margin:10px auto!important}#home.dashboard:not(.hidden){display:flex!important;flex-direction:column!important;min-height:0!important;padding:12px!important;gap:12px!important}#home .dash-top{order:1;width:100%}#home .dash-top:before{content:"";display:block;height:90px;width:95px;margin:0 auto 10px;background:url('./nagi-official-logo.png') center/contain no-repeat}#home .status-note{order:2}#home .stats{order:3;grid-template-columns:repeat(2,minmax(0,1fr))!important;width:100%}#home .stat{padding:12px!important}#home .nagi-ga4{order:4;width:100%;padding:13px!important}#home .nagi-ga-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}#home .dash-content{order:5;width:100%;padding:15px!important}#home .dash-nav{order:6;position:fixed!important;z-index:99!important;top:auto!important;bottom:0!important;left:0!important;right:0!important;display:flex!important;flex-direction:row!important;overflow-x:auto!important;gap:4px!important;border-radius:0!important;min-height:65px!important;padding:7px 8px max(8px,env(safe-area-inset-bottom))!important}#home .dash-nav:before{display:none!important}#home .dash-nav .tab,#home .dash-nav a.tab{width:auto!important;min-width:77px!important;justify-content:center!important;text-align:center!important;padding:10px 5px!important;font-size:10px!important}}

/* V8.1 shared navigation shell */
#home.nagi-detail-view .stats,#home.nagi-detail-view .nagi-ga4,#home.nagi-detail-view .status-note{display:none!important}
#home.nagi-detail-view .dash-content{grid-row:2;min-height:650px!important;padding:16px!important}
#home.nagi-detail-view .dash-top{grid-row:1}
#home .nagi-legacy-frame{display:block;width:100%;min-height:740px;border:0;border-radius:12px;background:#fbf8f1}
#home .nagi-page-status{font-size:12px;margin:0 0 12px;color:#52695d}
#home .nagi-page-back{margin:0 0 10px;width:auto!important;padding:9px 15px!important}
#home.nagi-detail-view .dash-nav .tab.active{background:linear-gradient(110deg,#f8efd6,#caa762)!important;color:#183d36!important}
@media(max-width:800px){#home.nagi-detail-view .dash-content{order:3!important;min-height:65vh!important}#home .nagi-legacy-frame{min-height:72vh}}

/* V8.3.1 mobile interaction repair: avoid bottom-nav overlays and clipped controls */
html,body{max-width:100%;overflow-x:clip}
#home,#home .dash-content,#home .nagi-legacy-frame{min-width:0;max-width:100%}
@media(max-width:800px){
 body:has(#home:not(.hidden)) .wrap{padding-bottom:calc(120px + env(safe-area-inset-bottom))!important}
 #home.dashboard:not(.hidden){padding-bottom:calc(120px + env(safe-area-inset-bottom))!important}
 #home .dash-nav{height:auto!important;max-height:88px!important;min-height:66px!important;overscroll-behavior-x:contain;scrollbar-width:thin;touch-action:pan-x;align-items:stretch!important;box-sizing:border-box}
 #home .dash-nav .tab,#home .dash-nav a.tab{flex:0 0 auto!important;min-height:48px!important;min-width:85px!important;max-width:125px!important;overflow-wrap:anywhere!important}
 #home .dash-content{overflow:visible!important;padding:12px!important}
 #home .dash-content input,#home .dash-content select,#home .dash-content textarea,#home .dash-content button{max-width:100%}
 #home .nagi-legacy-frame{height:900px;min-height:75vh!important;overflow:hidden}
 #home .stats,#home .nagi-ga4,#home .dash-content{min-width:0!important}
}

/* Phase 1: remove the redundant floating theme switcher; profile settings remain. */
body:has(#home:not(.hidden)) .nagi-theme-switcher,
body:has(#home:not(.hidden)) .nagi-theme-bar,
body:has(#home:not(.hidden)) .nagi-theme-picker,
body:has(#home:not(.hidden)) #nagiThemeSwitcher,
body:has(#home:not(.hidden)) #nagiThemeBar,
body:has(#home:not(.hidden)) #nagiThemePicker{display:none!important}
#home .nagi-integrated-view[hidden]{display:none!important}
#home .nagi-integrated-view{display:block;min-width:0;max-width:100%;width:100%;overflow-wrap:anywhere}
#home .nagi-shell-hidden{display:none!important}
#home.nagi-detail-view .dash-content{min-width:0!important;overflow:visible!important}
#home.nagi-detail-view .dash-content> :not(.nagi-integrated-view){display:none!important}
@media(max-width:800px){
 html,body{width:100%;max-width:100%;overflow-x:clip!important}
 #home .dash-top{min-width:0!important;display:flex!important;flex-wrap:wrap!important;gap:10px!important}
 #home .dash-top>div{min-width:0!important;flex:1 1 175px!important}
 #home .dash-top h1{font-size:clamp(21px,6vw,29px)!important;letter-spacing:0!important;overflow-wrap:anywhere!important}
 #home .dash-top .signout{flex:0 0 auto!important;max-width:100%!important}
 #home .nagi-ga4 h2{font-size:clamp(19px,5vw,27px)!important}
 #home .dash-nav{z-index:110!important}
 #home .dash-content{width:100%!important;min-width:0!important}
 #home .dash-content>*{max-width:100%}
 body:has(#home:not(.hidden)) .wrap{padding-bottom:calc(135px + env(safe-area-inset-bottom))!important}
}
