/* UCOCEKO Core New V1.6.5 — universal account/portal responsive hardening. */
:root{
 --uco-r-gutter:clamp(14px,3vw,36px);
 --uco-r-page:1440px;
 --uco-r-content:1180px;
 --uco-r-reading:760px;
 --uco-r-safe-top:env(safe-area-inset-top,0px);
 --uco-r-safe-bottom:env(safe-area-inset-bottom,0px);
 --uco-r-bottom-h:72px;
 --uco-r-header-h:72px;
 --uco-r-touch:46px;
}
html{max-inline-size:100%;overflow-x:clip!important;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body.uco-core-v165-responsive{max-inline-size:100%;min-inline-size:0;overflow-x:clip!important}
body.uco-core-v165-responsive *,body.uco-core-v165-responsive *::before,body.uco-core-v165-responsive *::after{box-sizing:border-box}
body.uco-core-v165-responsive :where(main,section,article,aside,header,footer,nav,div,form,fieldset,label,ul,ol,li){min-inline-size:0}
body.uco-core-v165-responsive :where(img,picture,svg,video,canvas,iframe){max-inline-size:100%;height:auto}
body.uco-core-v165-responsive :where(input,select,textarea,button){max-inline-size:100%;font:inherit}
body.uco-core-v165-responsive :where(p,a,span,strong,small,td,th,label){overflow-wrap:anywhere}

/* The portal owns vertical scrolling; drawers own their internal scrolling only while open. */
body.ucn11-portal-document.uco-core-v165-responsive{width:100%!important;min-height:100svh!important;min-height:100dvh!important;height:auto!important;overflow-y:auto!important;overflow-x:clip!important;overscroll-behavior-y:auto!important;touch-action:pan-y!important;-webkit-overflow-scrolling:touch}
body.ucn11-portal-document.uco-core-v165-responsive.ucn16-menu-open{overflow:hidden!important;touch-action:none!important}
body.ucn11-portal-document.uco-core-v165-responsive:not(.ucn16-menu-open){overflow-y:auto!important;touch-action:pan-y!important}

/* One fluid account canvas. */
body.uco-core-v165-responsive :is(.ucn16-account .uco127-main,.uco600-app-content,.uco125-stage,.uco1252-stage){
 width:min(100%,var(--uco-r-content))!important;
 max-width:var(--uco-r-content)!important;
 margin-inline:auto!important;
 padding-inline:var(--uco-r-gutter)!important;
}
body.uco-core-v165-responsive .ucn16-account .uco127-main{padding-block-start:clamp(16px,2.3vw,28px)!important;padding-block-end:calc(var(--uco-r-bottom-h) + var(--uco-r-safe-bottom) + 38px)!important}

/* Fluid grids: cards shrink instead of forcing horizontal page overflow. */
body.uco-core-v165-responsive :is(.uco127-grid,.uco127-summary,.uco127-checks,.uco600-app-grid,.uco600-rank-cards,.uco600-rule-cards,.uco600-course-grid,.uco600-account-links,.uco800-present-grid,.uco800-campaign-grid,.uco800-share-grid,.uco800-hub-grid,.uco118-stat-grid,.uco118-pack-grid,.uco118-asset-grid,.uco22-health-grid,.uco22-action-grid){
 display:grid!important;
 grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr))!important;
 gap:clamp(10px,1.8vw,18px)!important;
 align-items:stretch;
}
body.uco-core-v165-responsive :is(.uco127-card,.uco600-app-card,.uco600-app-grid>article,.uco14-finance-card,.uco900-recovery-card){min-width:0!important;max-width:100%!important}

/* Portal/business split areas collapse according to available space, not device brand. */
body.uco-core-v165-responsive :is(.uco127-business,.uco600-business-preview,.uco600-profile-card,.uco600-plan-structure,.uco600-plan-pwa){
 grid-template-columns:repeat(auto-fit,minmax(min(300px,100%),1fr))!important;
 gap:clamp(12px,2vw,22px)!important;
}

/* Account forms are intrinsically responsive. */
body.uco-core-v165-responsive :is(.uco22-form-grid,.uco22-os__form-grid,.uco22-settings-grid,.uco221-grid,.uco221-toggle-grid,.uco127-module form .form-row,.woocommerce form .form-row){min-width:0!important}
body.uco-core-v165-responsive :is(.uco22-form-grid,.uco22-os__form-grid,.uco22-settings-grid,.uco221-grid){display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr))!important;gap:clamp(12px,2vw,20px)!important}
body.uco-core-v165-responsive :is(input:not([type=checkbox]):not([type=radio]),select,textarea){width:100%;min-width:0;max-width:100%}
body.uco-core-v165-responsive :where(button,.button,[role=button]){min-height:var(--uco-r-touch)}

/* Tables scroll locally; never enlarge the document. */
body.uco-core-v165-responsive :is(.uco127-module,.uco600-app-block,.woocommerce,.uco22-portal-module,.uco22-account-settings){max-width:100%;min-width:0}
body.uco-core-v165-responsive :is(.uco127-module,.uco600-app-block,.woocommerce,.uco22-portal-module,.uco22-account-settings) :is(table,.shop_table,.uco131-table,.uco22-ws-table,.uco22-quick-table){width:100%;max-width:100%}
@media(max-width:900px){
 body.uco-core-v165-responsive :is(.uco127-module,.uco600-app-block,.woocommerce,.uco22-portal-module,.uco22-account-settings) :is(table,.shop_table,.uco131-table,.uco22-ws-table,.uco22-quick-table){display:block!important;overflow-x:auto!important;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch;white-space:nowrap}
}

/* Drawer works on narrow phones, Huawei browser viewport changes and landscape. */
body.uco-core-v165-responsive .ucn16-drawer[open]{
 width:min(380px,calc(100dvw - 16px))!important;
 max-width:calc(100dvw - 16px)!important;
 height:calc(100dvh - 16px)!important;
 max-height:calc(100dvh - 16px)!important;
 inset:8px auto 8px max(8px,var(--uco-r-safe-left,8px))!important;
}
body.uco-core-v165-responsive .ucn16-drawer-scroll{min-height:0!important;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch}

/* Tablet: real tablet layout, not stretched phone. */
@media (min-width:783px) and (max-width:1180px){
 :root{--uco-r-gutter:clamp(20px,3vw,32px)}
 body.uco-core-v165-responsive .ucn16-account .uco127-main{max-width:100%!important}
 body.uco-core-v165-responsive .ucn16-account .uco127-top{grid-template-columns:46px minmax(0,1fr) auto!important;gap:12px!important;padding:16px!important}
 body.uco-core-v165-responsive .uco127-grid{grid-template-columns:repeat(auto-fit,minmax(210px,1fr))!important}
 body.uco-core-v165-responsive .uco127-checks{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 body.uco-core-v165-responsive .uco14-finance{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 body.uco-core-v165-responsive .uco600-app-layout{grid-template-columns:minmax(190px,22vw) minmax(0,1fr)!important}
 body.uco-core-v165-responsive .uco600-app-rail{width:auto!important;min-width:0!important;padding-inline:12px!important}
 body.uco-core-v165-responsive .uco600-app-rail .uco600-app-nav a{grid-template-columns:30px minmax(0,1fr)!important;padding:10px!important}
}

/* Compact tablet / large phone. */
@media(max-width:900px){
 :root{--uco-r-bottom-h:74px}
 body.uco-core-v165-responsive .uco600-app-layout{display:block!important;min-height:0!important}
 body.uco-core-v165-responsive .uco600-app-rail{display:none!important}
 body.uco-core-v165-responsive .uco600-app>.uco600-app-nav{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;position:fixed!important;z-index:1080;inset:auto 0 0!important;padding:7px max(7px,env(safe-area-inset-right)) calc(7px + var(--uco-r-safe-bottom)) max(7px,env(safe-area-inset-left))!important}
 body.uco-core-v165-responsive .uco600-app>.uco600-app-nav a{min-width:0!important;min-height:56px!important;padding:5px 2px!important}
 body.uco-core-v165-responsive .uco127-main{width:100%!important}
}

/* Mobile. */
@media(max-width:782px){
 :root{--uco-r-gutter:clamp(13px,4vw,20px);--uco-r-bottom-h:72px;--uco-r-header-h:68px}
 body.uco-core-v165-responsive .ucn16-account .uco127-main{padding-top:calc(var(--uco-r-header-h) + var(--uco-r-safe-top) + 14px)!important;padding-inline:var(--uco-r-gutter)!important}
 body.uco-core-v165-responsive .ucn16-account .ucn162-mobile-bar{min-height:var(--uco-r-header-h)!important;padding:calc(8px + var(--uco-r-safe-top)) var(--uco-r-gutter) 8px!important}
 body.uco-core-v165-responsive .ucn16-account .uco127-top{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:10px!important;padding:12px 0!important;margin-bottom:12px!important}
 body.uco-core-v165-responsive .ucn16-account .uco127-top>.ucn16-menu-toggle{display:none!important}
 body.uco-core-v165-responsive .ucn16-account .uco127-top-actions{gap:7px!important;justify-content:flex-end!important}
 body.uco-core-v165-responsive .ucn16-account [data-uco127-connection]{display:none!important}
 body.uco-core-v165-responsive :is(.uco127-grid,.uco127-summary,.uco127-checks,.uco14-finance,.uco600-app-grid,.uco600-rank-cards,.uco600-course-grid,.uco600-account-links){grid-template-columns:1fr!important}
 body.uco-core-v165-responsive :is(.uco127-card,.uco600-app-card,.uco600-app-block){padding:clamp(16px,4.5vw,22px)!important;border-radius:16px!important}
 body.uco-core-v165-responsive .uco600-app-card{display:grid!important;gap:16px!important;align-items:start!important}
 body.uco-core-v165-responsive .uco600-app-card :is(.uco600-app-primary,.uco600-app-secondary){width:100%!important}
 body.uco-core-v165-responsive .uco600-app-shop .products{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
 body.uco-core-v165-responsive .uco600-app-shop .product{min-width:0!important;padding:10px!important}
 body.uco-core-v165-responsive .uco145-bottom{left:8px!important;right:8px!important;bottom:calc(8px + var(--uco-r-safe-bottom))!important;width:auto!important;max-width:none!important;grid-template-columns:repeat(4,minmax(0,1fr))!important}
 body.uco-core-v165-responsive .uco145-bottom :is(a,button){min-width:0!important;min-height:56px!important;padding-inline:4px!important}
 body.uco-core-v165-responsive .uco145-bottom span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .ucn162-crop{width:100%!important;max-width:100%!important;padding:14px!important;margin-inline:0!important}.ucn162-crop-position{grid-template-columns:1fr!important}.ucn162-crop-actions{display:grid!important;grid-template-columns:1fr!important}.ucn162-crop-actions button{width:100%!important}
}

/* Very small phones. */
@media(max-width:420px){
 :root{--uco-r-gutter:12px}
 body.uco-core-v165-responsive .uco600-app-shop .products{grid-template-columns:1fr!important}
 body.uco-core-v165-responsive .uco127-top h1{font-size:clamp(23px,8vw,30px)!important}
 body.uco-core-v165-responsive .ucn16-drawer[open]{width:calc(100dvw - 10px)!important;max-width:calc(100dvw - 10px)!important;inset:5px auto 5px 5px!important;height:calc(100dvh - 10px)!important;max-height:calc(100dvh - 10px)!important;border-radius:18px!important}
}

/* Short landscape phones/tablets: preserve content viewport. */
@media(max-height:540px) and (orientation:landscape){
 :root{--uco-r-bottom-h:58px;--uco-r-header-h:56px}
 body.uco-core-v165-responsive .ucn16-account .ucn162-mobile-bar{min-height:56px!important;padding-block:5px!important}
 body.uco-core-v165-responsive .ucn16-account .uco127-main{padding-top:calc(60px + var(--uco-r-safe-top))!important}
 body.uco-core-v165-responsive :is(.uco145-bottom,.uco600-app>.uco600-app-nav){min-height:54px!important;padding-block:3px!important}
 body.uco-core-v165-responsive :is(.uco145-bottom,.uco600-app>.uco600-app-nav) span{display:none!important}
 body.uco-core-v165-responsive .ucn16-drawer[open]{height:calc(100dvh - 8px)!important;max-height:calc(100dvh - 8px)!important;inset-block:4px!important}
}

/* Touch-first behavior for Huawei/Android/iPad/Surface touch modes. */
@media(hover:none) and (pointer:coarse){
 body.uco-core-v165-responsive :where(a,button,input,select,textarea,summary){-webkit-tap-highlight-color:transparent}
 body.uco-core-v165-responsive :where(button,.button,[role=button],summary){min-height:48px}
 body.uco-core-v165-responsive :where(.uco127-card,.uco600-app-card){transform:none!important}
}

/* VisualViewport keyboard class added by JS. */
body.uco-core-v165-responsive.uco165-keyboard-open :is(.uco145-bottom,.uco600-app>.uco600-app-nav,.uco15-portal-help){display:none!important}
body.uco-core-v165-responsive.uco165-keyboard-open .uco127-main{padding-bottom:24px!important}

@media(prefers-reduced-motion:reduce){body.uco-core-v165-responsive *,body.uco-core-v165-responsive *::before,body.uco-core-v165-responsive *::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
