/* Omvia Cloud v2.0.11.4-R10 — Web Global Authority
   Final additive UI authority. The R9 geometry layer stays underneath.
   Mandatory gates: Padding/Clearspace · Oversizing/Responsive · Offset/Alignment · Text Flow/Collision · Avatar Uniqueness.
   Desktop receives the broad convergence pass; mobile/PWA geometry remains intentionally conservative. */
:root{
  --oc-r10-web-max:1240px;
  --oc-r10-web-gutter:clamp(22px,3vw,36px);
  --oc-r10-gap:clamp(14px,1.55vw,20px);
  --oc-r10-control:44px;
  --oc-r10-radius:14px;
}

/* Universal safety rails — no visual redesign of immersive media/PWA navigation. */
html,body{max-width:100%;overflow-x:clip}
body:not(.media-immersive-page) :where(.page-shell,.account-shell,.admin-shell,.ref-shell,.gallery-shell,.pricing-page-shell,.legal-v213,.public-request-shell){min-width:0;max-width:100%}
body:not(.media-immersive-page) :where(img,video,canvas){max-width:100%;height:auto}
body:not(.media-immersive-page) :where(.section-card,.ref-card,.stat,.setting-row,.plan-card,.platform-row,.session-item,.token-item,.account-side,.account-layout,.field-grid,.platform-form-grid,.admin-grid,.admin-content-grid){min-width:0;max-width:100%}
body:not(.media-immersive-page) :where(.section-head,.page-heading,.admin-heading,.account-hero,.platform-row,.session-item,.token-item)>*{min-width:0}
body:not(.media-immersive-page) :where(.section-card,.ref-card,.platform-row,.session-item,.token-item,.field-grid,.platform-form,.platform-inline-form,.security-card-body) :where(h1,h2,h3,h4,p,strong,span,small,label,a,button,td,th,code){overflow-wrap:anywhere;word-break:normal}
body:not(.media-immersive-page) :where(pre,.code-block){max-width:100%;overflow:auto}
body:not(.media-immersive-page) :where(input,select,textarea,.form-control){max-width:100%;min-width:0}
body:not(.media-immersive-page) [data-omvia-avatar-duplicate="1"]{display:none!important}

/* Official Share glyph remains shape-authoritative via the global SVG sprite. */
body :where([data-share-file],[data-share-folder],[data-share],[aria-label*="Share" i],a[href*="sharing-center.php"]) svg use[href$="#share"],
body :where([data-share-file],[data-share-folder],[data-share],[aria-label*="Share" i],a[href*="sharing-center.php"]) svg use[href$="#share-link"]{pointer-events:none}

/* Owner PWA/Admin bridge. Server-side owner check controls whether this exists. */
.owner-admin-console-action{justify-content:flex-start;gap:10px;min-height:44px}

@media(min-width:961px){
  /* Gate 1: measured web clearspace. */
  body[data-omvia-auth="1"] :where(.page-topbar,.account-top){min-height:76px!important;padding:14px var(--oc-r10-web-gutter)!important;gap:12px!important}
  body[data-omvia-auth="1"] :where(.page-main,.account-main){width:min(var(--oc-r10-web-max),calc(100% - (var(--oc-r10-web-gutter) * 2)))!important;max-width:var(--oc-r10-web-max)!important;margin-inline:auto!important;padding:30px 0 88px!important}
  body[data-omvia-auth="1"] :where(.page-return-row){margin:0 0 20px!important}
  body[data-omvia-auth="1"] :where(.page-heading,.admin-heading,.account-hero){margin:0 0 22px!important;gap:18px!important}
  body[data-omvia-auth="1"] :where(.section-card)+.section-card{margin-top:var(--oc-r10-gap)}
  body[data-omvia-auth="1"] :where(.section-card)>.section-head{padding:17px clamp(17px,1.8vw,22px)!important;gap:14px!important}

  /* Gate 2: bounded sizes; never let legacy declarations make the web UI huge. */
  body[data-omvia-auth="1"] :where(.page-heading h1,.admin-heading h1,.account-hero h1){font-size:clamp(30px,3vw,44px)!important;line-height:1.04!important;max-width:100%!important}
  body[data-omvia-auth="1"] :where(.page-main,.account-main,.admin-main) h2{font-size:clamp(17px,1.6vw,22px);line-height:1.2}
  body[data-omvia-auth="1"] :where(.page-main,.account-main,.admin-main) h3{font-size:clamp(14px,1.35vw,18px);line-height:1.25}
  body[data-omvia-auth="1"] :where(.page-main,.account-main,.admin-main) .stat-value{font-size:clamp(25px,2.7vw,36px)!important;line-height:1.05!important}
  body[data-omvia-auth="1"] :where(.page-main,.account-main,.admin-main) :where(.btn,.icon-btn,.row-action,.form-control,button,input,select,textarea){min-width:0;max-width:100%}
  body[data-omvia-auth="1"] :where(.form-control,input:not([type="checkbox"]):not([type="radio"]),select,textarea){width:100%;box-sizing:border-box}
  body[data-omvia-auth="1"] :where(textarea){resize:vertical}
  body[data-omvia-auth="1"] :where(.table-wrap,.admin-table-scroll,.file-table-wrap,.scroll-region){max-width:100%!important;overflow:auto!important}
  body[data-omvia-auth="1"] table{max-width:100%}

  /* Gate 3: page structure must participate in flow. Intentional viewer/FAB/orbit offsets stay outside this scope. */
  body[data-omvia-auth="1"] :where(.page-heading,.admin-heading,.account-hero,.page-return-row){position:static!important;inset:auto!important;transform:none!important}
  body[data-omvia-auth="1"] :where(.page-heading,.admin-heading,.account-hero){width:100%!important;max-width:100%!important}
  body[data-omvia-auth="1"] :where(.platform-two-col,.platform-three-col,.security-pro-grid,.account-layout,.notification-layout){align-items:start!important;min-width:0!important;max-width:100%!important;gap:var(--oc-r10-gap)!important}
  body[data-omvia-auth="1"] .platform-two-col{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body[data-omvia-auth="1"] .platform-three-col{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  body[data-omvia-auth="1"] .account-layout{grid-template-columns:minmax(0,1.3fr) minmax(300px,.7fr)!important}

  /* Gate 4: text and controls keep separate lanes. */
  body[data-omvia-auth="1"] :where(.field-grid,.platform-form-grid){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px!important;align-items:end}
  body[data-omvia-auth="1"] :where(.field-grid,.platform-form-grid,.platform-form,.platform-inline-form) label{display:grid;align-content:start;gap:7px;min-width:0;line-height:1.35}
  body[data-omvia-auth="1"] :where(.field-grid,.platform-form-grid,.platform-form,.platform-inline-form) label>.form-control{margin:0!important}
  body[data-omvia-auth="1"] :where(.platform-row,.session-item,.token-item){gap:12px!important}
  body[data-omvia-auth="1"] :where(.platform-row,.session-item,.token-item)>:where(div,span){min-width:0}
  body[data-omvia-auth="1"] :where(.platform-row,.session-item,.token-item) :where(strong,span,small){display:block;max-width:100%;line-height:1.4}
  body[data-omvia-auth="1"] :where(.section-head-copy,.page-heading>div,.admin-heading>div,.account-hero-copy){min-width:0;max-width:100%}
  body[data-omvia-auth="1"] :where(.section-head-copy p,.page-heading p,.admin-heading p,.account-hero p){line-height:1.55!important}
  body[data-omvia-auth="1"] :where(.btn,.account-action){white-space:normal;line-height:1.25}

  /* Header convergence + Gate 5: one identity authority per header. */
  body[data-omvia-auth="1"] :where(.page-header-actions,.topbar-actions,.ref-top-actions,.gallery-top-actions,.account-top-actions,.admin-top-actions,.omvia-header-core,.omvia-display-controls){display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:10px!important;min-width:0!important}
  body[data-omvia-auth="1"] .omvia-header-core{margin-left:auto!important}
  body[data-omvia-auth="1"] .omvia-header-core>:where(.icon-btn,.lang-toggle,.omvia-header-account,.omvia-header-notifications),
  body[data-omvia-auth="1"] .omvia-header-core .omvia-display-controls>:where(.icon-btn,.lang-toggle){width:var(--oc-r10-control)!important;height:var(--oc-r10-control)!important;min-width:var(--oc-r10-control)!important;min-height:var(--oc-r10-control)!important;max-width:var(--oc-r10-control)!important;max-height:var(--oc-r10-control)!important;padding:0!important;margin:0!important;display:grid!important;place-items:center!important;flex:0 0 var(--oc-r10-control)!important}
  body[data-omvia-auth="1"] .omvia-header-core .omvia-header-account{overflow:hidden!important;border-radius:12px!important}
  body[data-omvia-auth="1"] .omvia-header-core .omvia-header-account :where(.user-copy,span>strong,span>small,.svg:last-child){display:none!important}
  body[data-omvia-auth="1"] .omvia-header-core .omvia-header-account :where(.avatar,.omvia-header-avatar,.gallery-avatar,.ref-avatar){width:34px!important;height:34px!important;min-width:34px!important;min-height:34px!important;margin:0!important;border-radius:10px!important}
  body[data-omvia-auth="1"] :where(.page-topbar,.account-top,.admin-top,.ref-topbar,.gallery-topbar) [data-omvia-avatar-duplicate="1"]{display:none!important}

  /* Admin web surfaces. */
  body[data-omvia-auth="1"] .admin-main{min-width:0!important;max-width:100%!important;padding-inline:clamp(20px,2.4vw,32px)!important}
  body[data-omvia-auth="1"] :where(.admin-grid,.admin-users-grid,.admin-settings-grid,.admin-content-grid,.health-grid,.update-center-grid,.admin-stats){min-width:0!important;max-width:100%!important;gap:var(--oc-r10-gap)!important}
  body[data-omvia-auth="1"] :where(.admin-card,.admin-panel,.stat){min-width:0;max-width:100%}

  /* Platform/Security/WebDAV remain bounded by the R9 route-specific rules, but text lanes get final authority. */
  body[data-omvia-route="platform.php"] :where(.platform-feature-copy,.platform-feature-copy strong,.platform-feature-copy>span){min-width:0!important;max-width:100%!important}
  body[data-omvia-route="security.php"] :where(.security-card-body,.security-inline-form,.session-list){min-width:0!important;max-width:100%!important}
  body[data-omvia-route="webdav-access.php"] :where(.webdav-client-card,.webdav-secret-value){min-width:0!important;max-width:100%!important}
}

/* Keep the already-approved PWA geometry stable; only expose the owner console cleanly. */
@media(max-width:960px){
  .owner-admin-console-action{width:100%!important;min-height:48px!important;justify-content:flex-start!important}
  body:not(.media-immersive-page) :where(.section-card,.platform-row,.session-item,.token-item) :where(h1,h2,h3,p,strong,span,small,label){overflow-wrap:anywhere}
}
