/* Functional states added to the approved design; visual baseline stays in style.css. */
#ph-mobile-flow{min-height:100dvh;box-sizing:border-box}
/* Stretch the desktop shell, so its sidebar footer reaches the viewport bottom. */
@media(min-width:541px){#ph-mobile-flow .ph-shell{min-height:calc(100dvh - 2px)}}
@media(min-width:541px) and (display-mode:standalone){#ph-mobile-flow .ph-shell{min-height:calc(100dvh - 2px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}}
#ph-mobile-flow .ph-workspace{min-width:0}
#ph-mobile-flow .ph-space-label{display:flex;flex-direction:column;align-items:flex-start;gap:4px}
#ph-mobile-flow .ph-space-label small{color:var(--ph-muted);line-height:1.5}
#ph-mobile-flow .ph-settings-actions{padding-top:24px}
#ph-mobile-flow .ph-brand>span{display:flex;align-items:center;gap:10px}
#ph-mobile-flow .ph-logo{display:block;flex:none;width:44px;height:44px;object-fit:contain;border-radius:9px;background:#fff}
#ph-mobile-flow .ph-login-logo{display:block;width:80px;height:80px;object-fit:contain;border-radius:16px;background:#fff}
#ph-mobile-flow .ph-login{width:calc(100% - 32px);max-width:460px;margin:12vh auto;padding:32px;display:grid;gap:20px}
#ph-mobile-flow .ph-login-link{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:10px 16px;border-radius:8px;background:var(--ph-accent);color:var(--ph-on-accent);text-decoration:none}
#ph-mobile-flow .ph-save-status{padding:8px 32px 0;color:var(--ph-muted);min-height:32px}
#ph-mobile-flow .ph-global-error{margin:12px 32px;padding:12px;background:var(--ph-warm);color:var(--ph-text);border:1px solid var(--ph-amber);border-radius:8px}
#ph-mobile-flow [role=alert]:not(:empty){margin-top:12px;padding:12px;background:var(--ph-warm);color:var(--ph-text);border:1px solid var(--ph-amber);border-radius:8px}
#ph-mobile-flow .ph-section{margin-top:20px}
#ph-mobile-flow .ph-detail-description,#ph-mobile-flow .ph-source-quote{white-space:pre-wrap;overflow-wrap:anywhere;margin:16px 0}
#ph-mobile-flow .ph-detail-facts{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin:24px 0}
#ph-mobile-flow .ph-detail-facts dt{color:var(--ph-muted)}
#ph-mobile-flow .ph-detail-facts dd{margin:5px 0}
#ph-mobile-flow .ph-delete-area{margin-top:28px}
#ph-mobile-flow .ph-delete-area p{margin-bottom:12px}
#ph-mobile-flow .ph-danger{background:light-dark(#991b1b,#ffb3b3);color:light-dark(#fff,#480909);border-color:transparent}
#ph-mobile-flow .ph-field textarea{font:inherit;background:var(--ph-panel);border:1px solid var(--ph-control);border-radius:8px;padding:10px;resize:vertical;width:100%;min-width:0;color:var(--ph-text)}
#ph-mobile-flow .ph-field input[aria-invalid=true]{border-color:var(--ph-amber)}
#ph-mobile-flow .ph-empty{padding:28px 20px}
#ph-mobile-flow .ph-empty p{margin:12px 0 20px}
#ph-mobile-flow .ph-chat-content>p{margin-bottom:14px}
#ph-mobile-flow .ph-chat-content>.ph-field{margin-bottom:14px}
#ph-mobile-flow .ph-task-detail-grid{align-items:start}
#ph-mobile-flow .ph-review-detail{margin-bottom:14px}
#ph-mobile-flow .ph-review-detail h2{margin-top:16px}
#ph-mobile-flow .ph-line>small{display:block}
#ph-mobile-flow .ph-line>.ph-deadline{margin-top:8px}
#ph-mobile-flow .ph-table input[type=checkbox]{flex:0 0 20px;width:20px;height:20px;cursor:pointer}
@media(max-width:540px){
  #ph-mobile-flow .ph-login{margin:8vh auto;padding:24px}
  #ph-mobile-flow .ph-save-status{padding:8px 18px 0}
  #ph-mobile-flow .ph-global-error{margin:12px 18px}
  #ph-mobile-flow .ph-detail-facts{grid-template-columns:1fr}
  #ph-mobile-flow .ph-field textarea{font-size:16px}
  #ph-mobile-flow .ph-table input[type=checkbox]{width:24px;height:24px;flex-basis:24px;margin:10px}
  #ph-mobile-flow[data-chat=open]>.ph-shell{display:none}
}

/* PWA controls use the same theme tokens and stay within Settings. */
#ph-mobile-flow .ph-pwa p{margin:12px 0;overflow-wrap:anywhere}
#ph-mobile-flow .ph-pwa button{min-height:44px}
#ph-mobile-flow .ph-pwa [data-pwa-confirm]{margin-top:16px;padding-top:16px;border-top:1px solid var(--ph-line)}
#ph-mobile-flow .ph-network{margin:12px 32px 0;padding:12px 16px;border:1px solid var(--ph-amber);border-radius:8px;background:var(--ph-warm);color:var(--ph-text)}
@media(max-width:540px){#ph-mobile-flow .ph-network{margin:12px 18px 0}}
@media(display-mode:standalone){#ph-mobile-flow{padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}}

/* Home cards share row tracks so both columns stay aligned as content grows. */
#ph-mobile-flow .ph-home-grid{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(240px,1fr);grid-template-areas:"decisions calendar" "deadlines connections";gap:var(--ph-gap);align-items:stretch}
#ph-mobile-flow .ph-home-decisions{grid-area:decisions}
#ph-mobile-flow .ph-home-deadlines{grid-area:deadlines}
#ph-mobile-flow .ph-home-calendar{grid-area:calendar}
#ph-mobile-flow .ph-home-connections{grid-area:connections}
#ph-mobile-flow .ph-home-grid>.ph-panel{min-width:0}
#ph-mobile-flow .ph-home-grid .ph-panel-head{min-height:44px}
#ph-mobile-flow .ph-home-action{margin-top:16px}
@media(max-width:820px){#ph-mobile-flow .ph-home-grid{grid-template-columns:minmax(0,1fr);grid-template-areas:"decisions" "deadlines" "calendar" "connections"}}

/* A single, brief welcome after successful sign-in; normal navigation skips it. */
#ph-mobile-flow .ph-welcome{min-height:calc(100dvh - 2px);display:grid;place-items:center;padding:32px 24px;text-align:center}
#ph-mobile-flow .ph-welcome-content{display:grid;justify-items:center;gap:20px;max-width:100%;animation:ph-welcome-arrive 480ms cubic-bezier(.16,1,.3,1) both}
#ph-mobile-flow .ph-welcome img{display:block;width:88px;height:88px;object-fit:contain;background:#fff;border-radius:20px}
#ph-mobile-flow .ph-welcome h1{font-size:clamp(23px,3vw,30px);line-height:1.4;outline:none}
#ph-mobile-flow .ph-main h1[tabindex="-1"]{outline:none}
#ph-mobile-flow .ph-welcome p{color:var(--ph-muted);font-size:14px}
#ph-mobile-flow .ph-welcome-leaving .ph-welcome-content{animation:ph-welcome-leave 180ms ease-out both}
@keyframes ph-welcome-arrive{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@keyframes ph-welcome-leave{to{opacity:0;transform:translateY(-4px)}}
@media(prefers-reduced-motion:reduce){#ph-mobile-flow .ph-welcome-content{animation:none!important}}
