/* Round 13 — phone layout: bottom tab bar, day/3-day calendar, bottom-sheet
   popups, larger tap targets, Tasks in a single Notion-style column.
   Applied only when body has .d95-phone (set in js). Desktop is unchanged. */

body.d95-phone{
  --d95-tab:56px;
  --d95-tab-pad:env(safe-area-inset-bottom,0px);
}
body.d95-phone #app>aside,
body.d95-phone #primary-sidebar{
  display:none!important;
}
body.d95-phone #app>main,
body.d95-phone #app>main>#content,
body.d95-phone #content{
  padding-bottom:calc(var(--d95-tab) + var(--d95-tab-pad) + 16px)!important;
  margin-left:0!important;
}
body.d95-phone #offcanvasSidebarToggle,
body.d95-phone #offcanvasSidebarScrim,
body.d95-phone #leftPagebarClickShieldV7,
body.d95-phone #sidebarPin{
  display:none!important;
  pointer-events:none!important;
}
body.d95-phone #app>main>header,
body.d95-phone.d87-docked #app>main>header,
body.d95-phone #app>main>header:has(#galaxyReturn){
  padding-left:16px!important;
  margin-left:0!important;
  gap:8px!important;
}
body.d95-phone #app>main>header>div:first-child{
  min-width:0!important;
  padding-left:0!important;
  margin-left:0!important;
  flex:1 1 140px!important;
}
body.d95-phone #pageTitle,
body.d95-phone .page-title{
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  max-width:100%!important;
}

/* Bottom tab bar */
#d95TabBar{
  display:none;
}
body.d95-phone #d95TabBar{
  display:flex!important;
  position:fixed;
  left:0;right:0;bottom:0;
  z-index:60;
  height:calc(var(--d95-tab) + var(--d95-tab-pad));
  padding:4px 4px var(--d95-tab-pad);
  box-sizing:border-box;
  align-items:stretch;
  justify-content:space-between;
  gap:0;
  background:#11100e;
  border-top:1px solid var(--line, rgba(244,239,229,.12));
  box-shadow:none;
}
body.d95-phone #d95TabBar button{
  flex:1 1 0;
  min-width:0;
  min-height:44px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  padding:4px 2px;
  border:0;
  background:transparent;
  color:var(--tx-3, rgba(244,239,229,.55));
  font:650 .58rem/1.1 var(--unified-font-stack,inherit);
  letter-spacing:.02em;
  cursor:pointer;
}
body.d95-phone #d95TabBar button svg{
  width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8;
}
body.d95-phone #d95TabBar button .nav-tooltip{display:none!important}
body.d95-phone #d95TabBar button .nav-label{
  display:block!important;
  max-width:100%!important;
  width:auto!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  word-break:normal!important;
  letter-spacing:0!important;
  font-size:.55rem!important;
  line-height:1.15!important;
  opacity:1!important;
  transform:none!important;
  position:static!important;
}
body.d95-phone #d95TabBar button.active,
body.d95-phone #d95TabBar button[aria-current="page"]{
  color:var(--tx-1, rgba(244,239,229,.92));
}

/* Larger tap targets */
body.d95-phone .btn,
body.d95-phone .btn.small,
body.d95-phone .header-actions .btn,
body.d95-phone .seg>button,
body.d95-phone .nt6-row,
body.d95-phone [data-t85-build]>.btn{
  min-height:44px!important;
  min-width:44px!important;
}
body.d95-phone .nt6-row{padding-top:8px!important;padding-bottom:8px!important}

/* Bottom-sheet popups */
body.d95-phone #modalBackdrop.open,
body.d95-phone .modal-backdrop.open{
  align-items:flex-end!important;
  justify-content:center!important;
}
body.d95-phone #modalBackdrop .modal,
body.d95-phone .modal-backdrop .modal{
  width:100%!important;
  max-width:100%!important;
  max-height:88vh!important;
  margin:0!important;
  border-radius:16px 16px 0 0!important;
  border-bottom:0!important;
}

/* Tasks: one Notion-style column */
body.d95-phone[data-solar-view="tasks"] .nt6.tn81 .nt6-table,
body.d95-phone[data-solar-view="tasks"] .nt6 .nt6-board,
body.d95-phone[data-solar-view="tasks"] .nt6 .nt6-cols{
  display:block!important;
  grid-template-columns:1fr!important;
  width:100%!important;
}
body.d95-phone[data-solar-view="tasks"] .nt6.tn81 .nt6-row{
  display:flex!important;
  flex-wrap:wrap!important;
  width:100%!important;
}
body.d95-phone[data-solar-view="tasks"] .nt6-title{font-size:28px!important}
body.d95-phone[data-solar-view="tasks"] .nt6-search{width:100%!important;max-width:none!important}

/* Calendar 3-day / day */
body.d95-phone[data-solar-view="calendar"] .week-grid{
  min-width:0!important;
}
body.d95-phone.d95-cal-3day[data-solar-view="calendar"] .week-grid{
  grid-template-columns:48px repeat(3,minmax(0,1fr))!important;
}
body.d95-phone.d95-cal-3day[data-solar-view="calendar"] .week-grid .day-col{display:none!important}
body.d95-phone.d95-cal-3day[data-solar-view="calendar"] .week-grid .day-col.d95-show{display:block!important}
body.d95-phone.d95-cal-3day[data-solar-view="calendar"] .week-grid .cal-head{display:block!important}
body.d95-phone[data-solar-view="calendar"] .calendar-toolbar{
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  flex-wrap:nowrap!important;
  gap:8px!important;
}
body.d95-phone[data-solar-view="calendar"] .calendar-toolbar .seg{
  display:flex!important;
  flex-direction:row!important;
  flex-wrap:wrap!important;
  width:100%!important;
  max-width:none!important;
  overflow:visible!important;
}
body.d95-phone[data-solar-view="calendar"] .calendar-toolbar .seg>button,
body.d95-phone[data-solar-view="calendar"] .calendar-toolbar .seg .d95-cal-seg{
  flex:1 0 auto!important;
  white-space:nowrap!important;
}
body.d95-phone[data-solar-view="calendar"] .qa-input-wrap{flex:1 1 100%;min-width:0}
body.d95-phone .d95-cal-seg[data-d95-cal="3day"].active,
body.d95-phone .seg>button.active{font-weight:700}

/* Dashboard / analytics grids already collapse in app.css; keep stat cards stacked */
body.d95-phone .dashboard-stat-row,
body.d95-phone .grid.cols-2,
body.d95-phone .grid.cols-3,
body.d95-phone .grid.cols-4,
body.d95-phone .i84-root{
  grid-template-columns:1fr!important;
}

/* Landscape phone: slightly shorter tab, tighter header */
@media (max-height:500px){
  body.d95-phone{--d95-tab:48px}
  body.d95-phone #d95TabBar button .nav-label{font-size:.52rem}
  body.d95-phone #modalBackdrop.open,
  body.d95-phone .modal-backdrop.open{align-items:flex-end!important}
  body.d95-phone #modalBackdrop .modal,
  body.d95-phone .modal-backdrop .modal{
    max-height:calc(100vh - 8px)!important;
    width:100%!important;
    max-width:100%!important;
    border-radius:12px 12px 0 0!important;
    top:auto!important;
    bottom:0!important;
    left:0!important;
    right:0!important;
    transform:none!important;
    margin:0!important;
    overflow:auto!important;
  }
}
