
/* REVA Responsive Guard v1
   Loaded after all page-specific fidelity styles.
   Goal: preserve the premium desktop look while making every Central REVA page
   fluid on phones, tablets, notebooks, ultrawide and touch devices. */

html,body{
  max-width:100%;
  overflow-x:hidden;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
img,svg,video,canvas{max-width:100%;height:auto}
input,select,textarea,button{max-width:100%;min-width:0}
body{min-width:0}
.reva-ambient{max-width:100vw;overflow:hidden}

/* ---------- PUBLIC HOME ---------- */
@media (max-width:1180px){
  body > .header .wrap,
  body > main.home{
    width:min(100% - 40px,1540px)!important;
  }
  body > main.home{
    display:block!important;
    min-height:auto!important;
  }
  body > main.home .hero{
    grid-template-columns:1fr!important;
    gap:26px!important;
    padding:30px 0 24px!important;
  }
  body > main.home .copy{
    max-width:820px!important;
  }
  body > main.home .visual{
    width:100%!important;
    min-height:clamp(430px,58vw,620px)!important;
  }
  body > main.home .cards{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}
@media (max-width:760px){
  body > .header{height:72px!important}
  body > .header .wrap{width:min(100% - 24px,1540px)!important}
  body > .header .head{gap:12px!important}
  body > .header .brand img{
    width:min(220px,58vw)!important;
    max-width:58vw!important;
  }
  body > .header .nav{gap:8px!important}
  body > .header .nav a:not(.enter){display:none!important}
  body > .header .nav .enter{
    padding:9px 16px!important;
    font-size:11px!important;
    white-space:nowrap!important;
  }
  body > main.home{
    width:min(100% - 24px,1540px)!important;
    padding-bottom:24px!important;
  }
  body > main.home .hero{padding-top:22px!important}
  body > main.home .copy .kicker{
    font-size:8px!important;
    padding:7px 10px!important;
    letter-spacing:.13em!important;
  }
  body > main.home .copy h1{
    font-size:clamp(42px,13vw,58px)!important;
    line-height:.94!important;
    margin:18px 0 15px!important;
    letter-spacing:-.045em!important;
  }
  body > main.home .copy p{
    font-size:14px!important;
    line-height:1.58!important;
  }
  body > main.home .actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
  }
  body > main.home .actions .btn{
    width:100%!important;
    height:50px!important;
    padding:0 18px!important;
  }
  body > main.home .visual{
    min-height:360px!important;
    border-radius:22px!important;
  }
  body > main.home .visual .glass-r{
    width:94%!important;
    left:-5%!important;
    height:100%!important;
  }
  body > main.home .visual .words{
    right:14px!important;
    font-size:7.5px!important;
    line-height:1.85!important;
    letter-spacing:.14em!important;
  }
  body > main.home .cards{
    grid-template-columns:1fr!important;
  }
  body > main.home .cards .card{
    min-height:142px!important;
    height:auto!important;
  }
  body > main.home .solutions-head h2{font-size:20px!important}
}
@media (max-width:390px){
  body > main.home .copy h1{font-size:40px!important}
  body > main.home .visual{min-height:315px!important}
  body > main.home .visual .words{font-size:7px!important;right:9px!important}
}

/* ---------- LOGIN ---------- */
/* This specifically fixes the two-column desktop rule that was still winning on mobile. */
@media (max-width:920px){
  body:has(> .layout){
    overflow:auto!important;
    overflow-x:hidden!important;
    min-height:100dvh!important;
    background-attachment:scroll!important;
  }
  body:has(> .layout) > .brand{
    position:absolute!important;
    top:max(18px,env(safe-area-inset-top))!important;
    left:max(18px,env(safe-area-inset-left))!important;
    right:max(18px,env(safe-area-inset-right))!important;
    width:max-content!important;
    max-width:calc(100% - 36px)!important;
  }
  body:has(> .layout) > .brand img{
    width:44px!important;height:44px!important;flex:0 0 auto!important;
  }
  body:has(> .layout) > .brand .word{
    font-size:23px!important;
    letter-spacing:.18em!important;
    white-space:nowrap!important;
  }
  body:has(> .layout) > .brand .sub{
    font-size:7px!important;
    letter-spacing:.10em!important;
    white-space:nowrap!important;
  }
  body:has(> .layout) .layout{
    display:block!important;
    width:min(100% - 28px,560px)!important;
    min-height:100dvh!important;
    margin:0 auto!important;
    padding:116px 0 max(34px,env(safe-area-inset-bottom))!important;
  }
  body:has(> .layout) .left{display:none!important}
  body:has(> .layout) .card{
    display:block!important;
    justify-self:auto!important;
    width:100%!important;
    max-width:520px!important;
    min-width:0!important;
    margin:0 auto!important;
    padding:clamp(26px,6vw,36px)!important;
    border-radius:24px!important;
  }
  body:has(> .layout) .card h2{
    font-size:clamp(27px,7vw,32px)!important;
    line-height:1.12!important;
    white-space:normal!important;
    overflow-wrap:normal!important;
    word-break:normal!important;
  }
  body:has(> .layout) .card .desc{
    font-size:12px!important;
    line-height:1.55!important;
    white-space:normal!important;
    overflow-wrap:normal!important;
    word-break:normal!important;
  }
  body:has(> .layout) .card .desc br{display:none!important}
  body:has(> .layout) .card form,
  body:has(> .layout) .card input,
  body:has(> .layout) .card button{
    width:100%!important;
    min-width:0!important;
  }
  body:has(> .layout) .card input{
    font-size:16px!important; /* prevents mobile browser zoom */
  }
}
@media (max-width:480px){
  body:has(> .layout) .layout{
    width:calc(100% - 20px)!important;
    padding-top:104px!important;
  }
  body:has(> .layout) > .brand{
    left:14px!important;right:14px!important;
  }
  body:has(> .layout) > .brand img{width:40px!important;height:40px!important}
  body:has(> .layout) > .brand .word{font-size:20px!important}
  body:has(> .layout) > .brand .sub{font-size:6.5px!important}
  body:has(> .layout) .card{
    padding:24px 18px 22px!important;
    border-radius:20px!important;
  }
  body:has(> .layout) .logo-mini{margin-bottom:14px!important}
  body:has(> .layout) .logo-mini img{width:52px!important;height:52px!important}
  body:has(> .layout) .logo-mini .reva{font-size:18px!important}
  body:has(> .layout) .card h2{font-size:28px!important}
}
@media (max-width:350px){
  body:has(> .layout) .layout{width:calc(100% - 14px)!important}
  body:has(> .layout) .card{padding-left:14px!important;padding-right:14px!important}
  body:has(> .layout) .card h2{font-size:25px!important}
}
@media (max-height:620px) and (orientation:landscape){
  body:has(> .layout) .layout{
    padding-top:88px!important;
    width:min(100% - 28px,620px)!important;
  }
  body:has(> .layout) > .brand{
    top:10px!important;
  }
}

/* ---------- CENTRAL REVA: shared shell ---------- */
@media (max-width:1250px){
  body:has(.app) .app{
    grid-template-columns:190px minmax(0,1fr)!important;
  }
  body:has(.app) .sidebar{padding-left:10px!important;padding-right:10px!important}
  body:has(.app) .modules{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-rows:auto!important;
  }
  body:has(.app) .dashboard-lower,
  body:has(.app) .grid{
    grid-template-columns:1fr!important;
  }
  body:has(.app) .card.wide{grid-column:auto!important}
}

@media (max-width:920px){
  body:has(.app){overflow:auto!important;overflow-x:hidden!important}
  body:has(.app) .app{
    grid-template-columns:78px minmax(0,1fr)!important;
    min-height:100dvh!important;
    height:auto!important;
  }
  body:has(.app) .sidebar{
    width:78px!important;
    height:100dvh!important;
    position:sticky!important;
    top:0!important;
    padding:14px 8px!important;
  }
  body:has(.app) .brand{justify-content:center!important;padding-left:0!important;padding-right:0!important}
  body:has(.app) .brand span,
  body:has(.app) .menu .label,
  body:has(.app) .side-bottom{display:none!important}
  body:has(.app) .menu a{
    justify-content:center!important;
    padding:0!important;
  }
  body:has(.app) .menu .dot{width:auto!important}
  body:has(.app) .main{
    min-width:0!important;
    width:100%!important;
    height:auto!important;
    min-height:100dvh!important;
    grid-template-rows:auto 1fr!important;
  }
  body:has(.app) .top{
    min-width:0!important;
    height:64px!important;
    padding:0 14px!important;
    position:sticky!important;
    top:0!important;
    z-index:30!important;
  }
  body:has(.app) .top .email,
  body:has(.app) .email{display:none!important}
  body:has(.app) .company,
  body:has(.app) #orgTop{
    min-width:0!important;
    max-width:50vw!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  body:has(.app) .content{
    min-width:0!important;
    width:100%!important;
    max-width:none!important;
    overflow:visible!important;
    padding:16px!important;
    grid-template-rows:auto auto auto auto!important;
  }
  body:has(.app) .welcome{
    min-height:210px!important;
    padding:24px!important;
    background-size:auto,44% auto,cover!important;
  }
  body:has(.app) .owner{
    top:16px!important;right:16px!important;
  }
  body:has(.app) .modules{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  body:has(.app) .modules .card{
    min-height:220px!important;
  }
  body:has(.app) .content > .hero{
    min-height:140px!important;
    padding:20px!important;
  }
  body:has(.app) .grid,
  body:has(.app) .invite-grid,
  body:has(.app) .module-picker,
  body:has(.app) .user-modules,
  body:has(.app) .license-grid,
  body:has(.app) .client-row,
  body:has(.app) .handoff-row{
    grid-template-columns:1fr!important;
  }
  body:has(.app) .user-head{
    grid-template-columns:1fr!important;
  }
  body:has(.app) .user-actions{justify-content:flex-start!important}
  body:has(.app) .module-row{
    grid-template-columns:auto minmax(0,1fr)!important;
  }
  body:has(.app) .module-row select{
    grid-column:2!important;
    width:100%!important;
  }
}

@media (max-width:680px){
  body:has(.app) .app{
    display:block!important;
    grid-template-columns:1fr!important;
    width:100%!important;
  }
  body:has(.app) .sidebar{display:none!important}
  body:has(.app) .main{
    display:block!important;
    width:100%!important;
    min-height:100dvh!important;
  }
  body:has(.app) .top{
    display:flex!important;
    width:100%!important;
    height:auto!important;
    min-height:60px!important;
    padding:
      max(10px,env(safe-area-inset-top))
      max(12px,env(safe-area-inset-right))
      10px
      max(12px,env(safe-area-inset-left))!important;
    gap:10px!important;
  }
  body:has(.app) .top .right,
  body:has(.app) .top-right{
    gap:7px!important;
    min-width:0!important;
  }
  body:has(.app) .avatar{
    width:32px!important;height:32px!important;flex:0 0 32px!important;
  }
  body:has(.app) .logout,
  body:has(.app) .btn.small{
    min-height:36px!important;
    padding:0 10px!important;
    white-space:nowrap!important;
  }
  body:has(.app) .company,
  body:has(.app) #orgTop{
    max-width:42vw!important;
    font-size:10px!important;
  }
  body:has(.app) .content{
    padding:12px 12px max(20px,env(safe-area-inset-bottom))!important;
    gap:12px!important;
  }
  body:has(.app) .welcome{
    min-height:240px!important;
    padding:22px 18px!important;
    border-radius:18px!important;
    background:
      linear-gradient(180deg,rgba(2,14,24,.90),rgba(2,14,24,.66)),
      url('/assets/reva-glass-r.svg') 92% 18%/58% auto no-repeat,
      url('/assets/hero-reva.webp') center/cover no-repeat!important;
  }
  body:has(.app) .welcome .eyebrow{font-size:7.5px!important}
  body:has(.app) .welcome h1{
    font-size:clamp(30px,10vw,42px)!important;
    line-height:1.04!important;
    margin-right:0!important;
  }
  body:has(.app) .welcome p{
    max-width:88%!important;
    font-size:11px!important;
    line-height:1.55!important;
  }
  body:has(.app) .owner{
    position:static!important;
    align-self:flex-start!important;
    margin-top:15px!important;
    padding:7px 10px!important;
  }
  body:has(.app) .section-head{
    display:block!important;
  }
  body:has(.app) .section-head h2{font-size:21px!important}
  body:has(.app) .section-head p{margin-top:4px!important;line-height:1.5!important}
  body:has(.app) .modules{
    grid-template-columns:1fr!important;
    grid-template-rows:none!important;
    gap:10px!important;
  }
  body:has(.app) .modules .card{
    min-height:0!important;
    height:auto!important;
    padding:16px!important;
  }
  body:has(.app) .modules .open{
    width:100%!important;
    max-width:none!important;
    min-height:44px!important;
    margin-top:14px!important;
  }
  body:has(.app) .content > .hero{
    display:flex!important;
    flex-direction:column!important;
    align-items:flex-start!important;
    min-height:0!important;
    padding:18px!important;
    gap:14px!important;
    border-radius:16px!important;
  }
  body:has(.app) .content > .hero h1{
    font-size:32px!important;
    line-height:1.08!important;
  }
  body:has(.app) .content > .hero p{
    font-size:11px!important;
    line-height:1.55!important;
  }
  body:has(.app) .content > .hero > .btn,
  body:has(.app) .content > .hero > a.btn{
    width:100%!important;
    min-height:44px!important;
  }
  body:has(.app) .card{
    padding:15px!important;
    border-radius:15px!important;
  }
  body:has(.app) .fields{
    grid-template-columns:1fr!important;
  }
  body:has(.app) .field.full{grid-column:auto!important}
  body:has(.app) .row,
  body:has(.app) .unit,
  body:has(.app) .pending-head{
    min-width:0!important;
  }
  body:has(.app) .unit,
  body:has(.app) .pending-head{
    grid-template-columns:1fr!important;
    display:grid!important;
  }
  body:has(.app) .client-row{
    grid-template-columns:1fr!important;
  }
  body:has(.app) .client-row .client-action{grid-column:auto!important}
  body:has(.app) .module-nav{
    max-width:100%!important;
    overflow-x:auto!important;
    overscroll-behavior-x:contain;
    scrollbar-width:none;
  }
  body:has(.app) .module-nav::-webkit-scrollbar{display:none}
  body:has(.app) .module-nav a,
  body:has(.app) .module-nav button{
    flex:0 0 auto!important;
  }
}

@media (max-width:420px){
  body:has(.app) .content{padding-left:9px!important;padding-right:9px!important}
  body:has(.app) .welcome{padding:18px 14px!important}
  body:has(.app) .welcome h1{font-size:30px!important}
  body:has(.app) .card{padding:13px!important}
  body:has(.app) .top{padding-left:9px!important;padding-right:9px!important}
  body:has(.app) .company,
  body:has(.app) #orgTop{max-width:36vw!important}
  body:has(.app) .btn{white-space:normal!important}
}

/* ---------- ACTIVATE / RESET PASSWORD ---------- */
@media (max-width:620px){
  body > main.wrap{
    min-height:100dvh!important;
    padding:14px!important;
  }
  body > main.wrap > .card{
    width:100%!important;
    max-width:540px!important;
    padding:24px 18px!important;
    border-radius:20px!important;
  }
  body > main.wrap > .card h1{
    font-size:27px!important;
    line-height:1.12!important;
  }
  body > main.wrap .fields{grid-template-columns:1fr!important}
  body > main.wrap input{font-size:16px!important}
}

/* ---------- TOUCH ---------- */
@media (pointer:coarse){
  a,button,input,select{touch-action:manipulation}
  button,.btn,.open,.enter,.logout{min-height:44px}
}
