/* DigiMark phone app layer: safe areas, bottom tabs, install hint. Phones only (<768px) unless noted. */
html.dm-standalone{ -webkit-tap-highlight-color: transparent; }
html.dm-standalone body{ overscroll-behavior-y: none; }
/* Installed app: keep the header clear of the notch / status bar */
html.dm-standalone header{ padding-top: env(safe-area-inset-top); height: calc(3.5rem + env(safe-area-inset-top)) !important; }
html.dm-standalone [data-sidebar="sidebar"]{ padding-top: env(safe-area-inset-top); }

/* Signal Tree logo on the sign-in screen (replaces the old "D" mark, same approach as the sidebar swap) */
svg[aria-label="DigiMark"].h-8.w-8{ display:none; }
div.flex.items-center:has(> svg[aria-label="DigiMark"].h-8.w-8)::before{ content:""; flex:none; width:40px; height:40px; background:url(./dm-logo.svg) center/contain no-repeat; }

#dm-tabbar{ display:none; }
@media (max-width: 767px){
  #dm-tabbar{
    display:flex; position:fixed; left:0; right:0; bottom:0; z-index:40;
    background:hsl(var(--background)); border-top:2px solid var(--dm-ink, #141414);
    padding:4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  #dm-tabbar[hidden]{ display:none; }
  /* Logo + name in the phone header, next to the menu button */
  header:has(> [data-testid="button-sidebar-toggle"]){ position:relative; }
  header:has(> [data-testid="button-sidebar-toggle"])::after{
    content:"DigiMark"; position:absolute; left:52px; bottom:0; height:3.5rem; display:flex; align-items:center;
    padding-left:36px; background:url(./dm-logo.svg) left center/28px 28px no-repeat;
    font:700 17px/1 var(--dm-display, "General Sans", system-ui); letter-spacing:-.01em; color:hsl(var(--foreground)); pointer-events:none;
  }
}
@media (max-width: 359px){
  header:has(> [data-testid="button-sidebar-toggle"])::after{ content:""; width:28px; padding-left:0; }
}
@media (max-width: 767px){
  #dm-tabbar a, #dm-tabbar button{
    flex:1 1 0; min-width:0; min-height:52px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
    background:none; border:0; border-radius:12px; color:hsl(var(--muted-foreground)); text-decoration:none;
    font:600 11px/1.1 var(--font-sans, system-ui); letter-spacing:.01em; cursor:pointer;
  }
  #dm-tabbar span{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
  #dm-tabbar .is-active{ color:hsl(var(--foreground)); background:hsl(var(--accent)); }
  #dm-tabbar .is-active svg{ color:var(--dm-orange, #ff6809); }
  #dm-tabbar a:focus-visible, #dm-tabbar button:focus-visible{ outline:2px solid hsl(var(--ring)); outline-offset:-2px; }
  body.dm-has-tabs #root{ padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.dm-has-tabs main{ padding-bottom: 16px; }

  /* Tab rows (e.g. Plan / Services / Notes / Emails / Hours) swipe sideways instead of clipping */
  main [role=tablist]{ max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; justify-content:flex-start; }
  main [role=tablist]::-webkit-scrollbar{ display:none; }
  main [role=tablist] > [role=tab]{ flex:none; }

  /* Stop iOS from zooming into form fields */
  input:not([type=checkbox]):not([type=radio]), select, textarea{ font-size:16px !important; }

  #dm-install{
    position:fixed; left:10px; right:10px; z-index:41; bottom:calc(72px + env(safe-area-inset-bottom));
    display:flex; align-items:center; gap:10px; padding:10px 10px 10px 12px;
    background:hsl(var(--card)); color:hsl(var(--card-foreground));
    border:2px solid var(--dm-ink, #141414); border-radius:14px; box-shadow:var(--dm-pop, 3px 3px 0 #141414);
    font:14px/1.35 var(--font-sans, system-ui);
  }
  #dm-install img{ border-radius:10px; flex:none; }
  .dm-install-txt{ flex:1; min-width:0; display:flex; flex-direction:column; }
  .dm-install-txt span{ color:hsl(var(--muted-foreground)); font-size:13px; }
  .dm-install-txt svg{ display:inline-block; vertical-align:-2px; margin:0 1px; }
  .dm-install-go{ flex:none; font:600 14px var(--font-sans, system-ui); background:var(--dm-orange,#ff6809); color:#141414; border:2px solid #141414; border-radius:10px; padding:8px 12px; }
  .dm-install-x{ flex:none; width:32px; height:32px; font-size:22px; line-height:1; background:none; border:0; color:hsl(var(--muted-foreground)); }
}
