/* The header, content and footer share one viewport, including mobile navigation. */
body{min-height:100vh;min-height:100dvh}
.app-shell{display:flex;flex-direction:column;min-height:100vh;min-height:100dvh}
.app-shell>.global-header{flex:0 0 auto}
.app-shell>.content{flex:1 0 auto;min-height:0;width:100%}
.app-shell>.footer{flex:0 0 auto;width:100%;margin:0 auto}

/* A space uses the same permission-protected photo on its card and every subpage. */
.space-heading-copy{min-width:0}
.space-heading-copy h1{overflow-wrap:anywhere}
.space-heading-copy p{overflow-wrap:anywhere}
.space-heading.has-cover{position:relative;isolation:isolate;overflow:hidden;min-height:200px;padding:24px 30px;align-items:flex-end;border-radius:22px;background:#33443b;color:#fff;box-shadow:var(--surface-shadow)}
.space-heading-cover{position:absolute;inset:0;z-index:-2;display:block;width:100%;height:100%;object-fit:cover;object-position:50% 58%;pointer-events:none}
.space-heading.has-cover::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(15,24,20,.78),rgba(15,24,20,.2) 65%,rgba(15,24,20,.4)),linear-gradient(0deg,rgba(15,24,20,.34),transparent 75%);pointer-events:none}
.space-heading.has-cover>.space-heading-copy{flex:1;max-width:75%}
.space-heading.has-cover h1{color:#fff;text-shadow:0 1px 4px #0004}
.space-heading.has-cover .back-link,.space-heading.has-cover p,.space-heading.has-cover .space-switch>span{color:#fff}
.space-heading.has-cover .back-link{margin-bottom:10px}
.space-heading.has-cover p{font-size:13px;line-height:1.7}
.space-heading.has-cover .space-switch{flex:0 0 180px;min-width:0;max-width:230px;margin:0;position:static}
.space-heading.has-cover .space-switch>span{text-shadow:0 1px 3px #0008}
.space-heading.has-cover .space-switch select{width:100%;background:#fffffff2;color:#1d1d1f;border-color:#fff;box-shadow:none}
.space-heading.has-cover .source-label,.space-heading.has-cover .badge{background:#fffffff0;color:#444b47;text-shadow:none}
.space-heading.has-cover .back-link:focus-visible{outline-color:#fff}
@media(max-width:760px){
 .space-heading.has-cover{display:flex;flex-wrap:wrap;align-items:flex-end;min-height:210px;padding:18px;gap:14px;border-radius:18px}
 .space-heading.has-cover>.space-heading-copy{flex:1 1 150px;width:auto;max-width:100%}
 .space-heading.has-cover h1{font-size:27px;padding:0;line-height:1.3}
 .space-heading.has-cover .back-link{max-width:none;margin-bottom:7px}
 .space-heading.has-cover .space-switch{flex:0 1 132px;width:132px;max-width:100%}
 .space-heading.has-cover .space-switch select{font-size:16px;min-height:44px}
 .space-heading.has-cover p{font-size:12px}
}

/* Compact mobile space cards keep the same photo, full accessible name and entry. */
.space-card-controls{display:flex;justify-content:flex-end;align-items:center;gap:16px;padding:8px 18px;border-top:1px solid var(--line)}
.space-sensor-status{display:flex;flex-wrap:wrap;gap:5px 12px;margin-top:9px;color:var(--muted,#626a74);font-size:13px;line-height:1.45;font-variant-numeric:tabular-nums}
.space-sensor-status>span{white-space:nowrap}
.space-sensor-status .detected{font-weight:650;color:#23734d}
.space-sensor-status .neutral{font-weight:550}
.space-push-toggle{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:44px;min-width:44px;padding:5px 8px;border:0;border-radius:10px;background:#f3f4f6;color:#7a818b;font-size:11px;white-space:nowrap}.space-push-toggle.is-on{background:#fff3e4;color:#a45a19}.space-push-toggle .icon{width:18px;height:18px}.space-card-controls>.text-button{min-height:36px;font-size:11px}
@media(max-width:760px){
 #app .spaces-grid{gap:12px}
 #app .spaces-grid .space-open{padding:0;min-height:104px}
 #app .spaces-grid .space-open.has-cover{display:grid;grid-template-columns:104px minmax(0,1fr);align-items:stretch}
 #app .spaces-grid .space-cover{width:104px;height:100%;min-height:104px;aspect-ratio:1;object-fit:cover}
 #app .spaces-grid .space-card-body{min-width:0;min-height:104px;padding:16px 14px;gap:10px}
 #app .spaces-grid .space-card-body>span{min-width:0}
 #app .spaces-grid .space-open.has-cover .space-card-body>.icon:first-child{display:none}
 #app .spaces-grid .space-card-body strong{font-size:16px;line-height:1.35;overflow-wrap:anywhere;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
 #app .spaces-grid .space-card-body small{font-size:11px;margin-top:5px;line-height:1.5}
 .space-sensor-status{gap:3px 8px;margin-top:6px;font-size:11px}
 #app .spaces-grid .space-card-body>.icon{width:18px;height:18px;flex-shrink:0}
 #app .spaces-grid .space-card{position:relative}
 #app .spaces-grid .space-card:has(.space-card-tools) .space-card-body{padding-right:72px}
 #app .spaces-grid .space-card:has(.space-card-tools) .space-card-body>.icon:last-child{display:none}
 #app .spaces-grid .space-card-tools{position:absolute;top:50%;right:6px;transform:translateY(-50%);padding:0;min-height:44px;gap:0;border-top:0;justify-content:flex-end}
 #app .spaces-grid .space-card-tools>span{display:none}
 #app .spaces-grid .space-card-tools button{width:56px;min-height:44px;padding:0;font-size:11px;border-radius:10px;background:#f5f5f8}
 #app .spaces-grid .space-card:has(.space-card-controls){display:grid;grid-template-columns:minmax(0,1fr) 56px;align-items:stretch}
 #app .spaces-grid .space-card:has(.space-card-controls) .space-open{min-width:0}
 #app .spaces-grid .space-card:has(.space-card-controls) .space-open.has-cover{grid-template-columns:80px minmax(0,1fr)}
 #app .spaces-grid .space-card:has(.space-card-controls) .space-cover{width:80px}
 #app .spaces-grid .space-card:has(.space-card-controls) .space-card-body{padding:12px 8px;gap:6px}
 #app .spaces-grid .space-card:has(.space-card-controls) .space-card-body>.icon:last-child{display:none}
 #app .spaces-grid .space-card-controls{display:flex;flex-direction:column;justify-content:center;gap:2px;padding:4px;border:0;min-width:0}
 #app .spaces-grid .space-push-toggle{flex-direction:column;gap:2px;width:48px;min-width:44px;padding:4px 0;font-size:10px}
 #app .spaces-grid .space-card-controls>.text-button{width:48px;font-size:10px;padding:0}
}
