/* =========================================================
   Rabbit Workspace OS v142 — Perfect Responsive
   Complete responsive pass for Command Driver dashboard.
   ========================================================= */

:root{
  --v142-safe-top:env(safe-area-inset-top,0px);
  --v142-safe-right:env(safe-area-inset-right,0px);
  --v142-safe-bottom:env(safe-area-inset-bottom,0px);
  --v142-safe-left:env(safe-area-inset-left,0px);
}

html,body{max-width:100%;overflow-x:hidden}
img,svg,video,canvas{max-width:100%}
.v142-mail-back{display:none}

/* Compact desktop / laptop */
@media (max-width:1440px) and (min-width:1181px){
  .app{grid-template-columns:220px minmax(0,1fr) 270px!important;gap:10px!important;padding:0 10px!important}
  .main{min-width:0!important}
  .rabbit-v140-topbar-title{font-size:19px!important}
  .v140-dashboard-grid{gap:14px!important}
  .v140-hero-card,.v140-attention-card{min-height:390px!important}
  .v140-hero-card{padding:50px 28px 24px!important}
  .v140-hero-card h1{font-size:clamp(45px,4.5vw,66px)!important}
  .v140-hero-actions{left:28px!important;right:28px!important;bottom:24px!important;gap:7px!important}
  .v140-attention-card{padding:24px 20px!important}
  .v140-attention-row{grid-template-columns:42px minmax(0,1fr) auto!important}
  .v140-mail-detail{padding:18px!important}
  .v140-side-card{padding:16px 13px!important}
}

/* Tablet and mobile shell */
@media (max-width:1180px){
  html,body{min-height:100%;background-attachment:fixed!important}
  body{padding-left:var(--v142-safe-left);padding-right:var(--v142-safe-right)}
  .scale-root{transform:none!important;width:100%!important;min-height:100dvh!important}
  .app{display:block!important;width:100%!important;min-height:100dvh!important;padding:0!important}
  .app>.sidebar,.app>aside.sidebar,.rightbar{display:none!important}
  .main{width:100%!important;max-width:none!important;padding:0 16px calc(94px + var(--v142-safe-bottom))!important}
  .topbar.rabbit-pro-topbar,.topbar{
    position:sticky!important;top:calc(6px + var(--v142-safe-top))!important;z-index:1200!important;
    width:100%!important;margin:8px 0 16px!important;padding:8px!important;
    display:grid!important;grid-template-columns:46px minmax(0,1fr) auto!important;gap:8px!important;
    border-radius:22px!important;backdrop-filter:blur(22px)!important;-webkit-backdrop-filter:blur(22px)!important;
  }
  .rabbit-v140-topbar-title{display:none!important}
  .mobile-menu-btn{display:inline-flex!important;width:46px!important;height:46px!important;min-width:46px!important;border-radius:15px!important}
  .topbar .search{min-width:0!important;width:100%!important}
  .topbar .search input{width:100%!important;height:46px!important;min-width:0!important;font-size:16px!important;border-radius:15px!important}
  .rabbit-topbar-user{display:flex!important;gap:6px!important;min-width:0!important}
  .rabbit-admin-chip{width:46px!important;min-width:46px!important;height:46px!important;padding:0!important;border-radius:15px!important}
  .rabbit-admin-chip b{display:none!important}
  .rabbit-bell{width:46px!important;height:46px!important;min-width:46px!important;border-radius:15px!important}

  #home.rabbit-v140-dashboard{width:100%!important;min-width:0!important}
  .v140-dashboard-grid{display:grid!important;grid-template-columns:1fr!important;gap:14px!important;width:100%!important}
  .v140-hero-card,.v140-attention-card,.v140-mail-console{width:100%!important;min-width:0!important;border-radius:24px!important}
  .v140-hero-card{min-height:420px!important;padding:46px 28px 26px!important}
  .v140-hero-card h1{font-size:clamp(48px,8vw,70px)!important;line-height:.94!important;max-width:780px!important}
  .v140-hero-card p{max-width:680px!important}
  .v140-attention-card{padding:24px!important}
  .v140-attention-list{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}
  .v140-attention-row{margin:0!important;min-width:0!important}
  .v140-attention-actions{grid-template-columns:repeat(3,minmax(0,1fr))!important}

  .v140-mail-console{padding:18px!important}
  .v140-mail-console>header{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:12px!important}
  .v140-mail-split{display:grid!important;grid-template-columns:minmax(280px,40%) minmax(0,1fr)!important;min-width:0!important}
  .v140-mail-list{min-width:0!important;max-height:610px!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch!important}
  .v140-mail-detail{min-width:0!important;overflow-wrap:anywhere!important}
  .v140-mail-detail h3{font-size:clamp(16px,2.3vw,20px)!important}
  .v140-mail-actions{grid-template-columns:1.2fr 1fr 1fr!important}

  #mobileDrawer.mobile-drawer{padding-top:var(--v142-safe-top)!important}
  #mobileDrawer .mobile-drawer-panel{
    width:min(88vw,390px)!important;max-width:390px!important;height:100dvh!important;
    padding-bottom:var(--v142-safe-bottom)!important;border-radius:0 30px 30px 0!important;
    overflow-y:auto!important;-webkit-overflow-scrolling:touch!important;
  }
  #mobileDrawerNav.mobile-drawer-nav button{min-height:56px!important}

  #rabbitUnifiedHub{right:calc(14px + var(--v142-safe-right))!important;bottom:calc(14px + var(--v142-safe-bottom))!important;z-index:1300!important}
}

/* Portrait tablet */
@media (max-width:900px){
  .main{padding-left:12px!important;padding-right:12px!important}
  .v140-hero-card{min-height:440px!important}
  .v140-attention-list{grid-template-columns:1fr!important}
  .v140-attention-row{min-height:78px!important}
  .v140-mail-split{grid-template-columns:1fr!important}
  .v140-mail-list{max-height:460px!important;border-right:0!important;border-bottom:1px solid var(--v140-line)!important}
  .v140-mail-detail{min-height:420px!important}
}

/* Smartphone */
@media (max-width:760px){
  .main{padding:0 10px calc(88px + var(--v142-safe-bottom))!important}
  .topbar.rabbit-pro-topbar,.topbar{top:calc(4px + var(--v142-safe-top))!important;margin:6px 0 12px!important;grid-template-columns:44px minmax(0,1fr) 44px!important;padding:6px!important;border-radius:19px!important}
  .mobile-menu-btn,.rabbit-admin-chip{width:44px!important;height:44px!important;min-width:44px!important}
  .rabbit-bell{display:none!important}
  .topbar .search input{height:44px!important}

  .v140-dashboard-grid{gap:11px!important}
  .v140-hero-card,.v140-attention-card,.v140-mail-console{border-radius:22px!important}
  .v140-hero-card{min-height:500px!important;padding:40px 20px 20px!important}
  .v140-kicker{font-size:10px!important}
  .v140-hero-card h1{font-size:clamp(42px,13vw,58px)!important;line-height:.94!important;letter-spacing:-.055em!important;margin-top:18px!important}
  .v140-hero-card p{font-size:15px!important;line-height:1.43!important;max-width:100%!important}
  .v140-hero-actions{position:absolute!important;left:18px!important;right:18px!important;bottom:18px!important;grid-template-columns:1fr 1fr!important;gap:8px!important}
  .v140-hero-actions button{min-height:48px!important;border-radius:14px!important;font-size:12px!important}

  .v140-attention-card{padding:19px 14px!important}
  .v140-attention-card h2{font-size:30px!important;line-height:1.03!important}
  .v140-attention-row{grid-template-columns:42px minmax(0,1fr) auto!important;min-height:76px!important;padding:10px!important;border-radius:15px!important}
  .v140-attention-row span b{font-size:13px!important}
  .v140-attention-row span small,.v140-attention-row span em{font-size:10px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .v140-attention-row i{font-size:9px!important;padding:5px 7px!important}
  .v140-attention-actions{grid-template-columns:1fr!important;gap:8px!important;margin-top:12px!important}
  .v140-attention-actions button{min-height:47px!important}

  .v140-mail-console{padding:14px 10px!important}
  .v140-mail-console>header{flex-direction:column!important;align-items:stretch!important;gap:10px!important;margin-bottom:10px!important}
  .v140-mail-console>header h2{font-size:27px!important;line-height:1.05!important}
  .v140-mail-console>header p{font-size:12px!important}
  .v141-mail-header-actions{display:grid!important;grid-template-columns:1fr 46px!important;width:100%!important}
  .v141-refresh-mail{min-height:46px!important}
  .v141-more-mail{height:46px!important}
  .v140-mail-split{display:block!important;border-radius:17px!important;overflow:hidden!important}
  .v140-mail-list{display:block!important;max-height:none!important;padding:7px!important;border:0!important}
  .v140-mail-list-head{position:sticky!important;top:0!important;z-index:2!important;min-height:48px!important}
  .v140-mail-row{grid-template-columns:38px minmax(0,1fr) auto!important;min-height:70px!important;padding:9px!important;border-radius:14px!important}
  .v140-mail-row time{display:none!important}
  .v140-mail-row>em{grid-column:auto!important;align-self:center!important}
  .v140-mail-row span small{max-width:100%!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .v140-view-all{min-height:48px!important}

  .v140-mail-detail{display:none!important;margin:7px!important;padding:14px 12px!important;min-height:0!important;border-radius:15px!important}
  .v140-mail-split.v143-show-list .v140-mail-list{display:block!important}
  .v140-mail-split.v143-show-list .v140-mail-detail{display:none!important}
  .v140-mail-split.v143-show-detail .v140-mail-list{display:none!important}
  .v140-mail-split.v143-show-detail .v140-mail-detail{display:block!important}
  .v142-mail-back{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-height:42px!important;margin-bottom:12px!important;padding:0 13px!important;border:1px solid #c8d7e5!important;border-radius:12px!important;background:#f4f8fc!important;color:#174a79!important;font-weight:850!important}
  .v140-mail-detail h3{font-size:18px!important;line-height:1.25!important;margin-bottom:12px!important}
  .v141-ai-summary{padding:11px!important}
  .v140-task-extract label{align-items:flex-start!important;line-height:1.35!important}
  .v140-quick-reply textarea{min-height:110px!important;font-size:16px!important}
  .v140-mail-actions{grid-template-columns:1fr!important;gap:8px!important}
  .v140-mail-actions button{min-height:49px!important;font-size:12px!important}

  #rabbitHubMain,#rabbitHubChat{width:52px!important;height:52px!important}
}

/* Very small phones */
@media (max-width:390px){
  .main{padding-left:7px!important;padding-right:7px!important}
  .v140-hero-card{min-height:520px!important;padding-left:17px!important;padding-right:17px!important}
  .v140-hero-card h1{font-size:41px!important}
  .v140-hero-actions{left:14px!important;right:14px!important}
  .v140-attention-card{padding-left:11px!important;padding-right:11px!important}
  .v140-attention-row{grid-template-columns:38px minmax(0,1fr) auto!important}
  .v140-avatar{width:38px!important;height:38px!important;min-width:38px!important}
  #mobileDrawer .mobile-drawer-panel{width:94vw!important}
}

/* Landscape phones */
@media (max-height:520px) and (orientation:landscape) and (max-width:950px){
  .topbar.rabbit-pro-topbar,.topbar{position:relative!important;top:auto!important}
  .v140-hero-card{min-height:390px!important}
  .v140-hero-actions{grid-template-columns:repeat(4,1fr)!important}
  #mobileDrawer .mobile-drawer-panel{width:min(62vw,420px)!important}
}

/* Keyboard/open viewport: keep dock away from input area */
@media (max-width:760px){
  body.v142-keyboard-open #rabbitUnifiedHub{display:none!important}
}

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