/* RenoTasks — app layout. Tokens/components live in tokens.css; this file only positions them. */
html,body{height:100%}
/* Native-app feel: no pinch-zoom, no double-tap zoom, no landscape text inflation.
   iOS has ignored user-scalable=no since iOS 10, so `touch-action` is the part that actually works there;
   pan-x pan-y keeps all scrolling and the sheet swipe-to-dismiss intact. */
html{touch-action:pan-x pan-y;-webkit-text-size-adjust:100%;text-size-adjust:100%}
/* the page must never scroll sideways; clip rather than hidden, which would make body a
   scroll container and break the sticky app bar */
html,body{overflow-x:clip}

/* Installed app only: hide scrollbars so scrolling reads like a native app. Deliberately NOT applied
   in a browser tab, where the scrollbar is a genuine position cue. Two selectors because iOS before
   16.4 reports standalone only via navigator.standalone, which app.js mirrors onto data-standalone. */
@media (display-mode: standalone),(display-mode: fullscreen){
  html,body,*{scrollbar-width:none;-ms-overflow-style:none}
  ::-webkit-scrollbar{width:0;height:0;display:none}
}
:root[data-standalone],:root[data-standalone] *{scrollbar-width:none;-ms-overflow-style:none}
:root[data-standalone] ::-webkit-scrollbar,:root[data-standalone]::-webkit-scrollbar{width:0;height:0;display:none}
body{margin:0;background:var(--bg);color:var(--ink);font:17px/24px var(--font-sans);-webkit-font-smoothing:antialiased;overscroll-behavior-y:none}
#app{min-height:100%;display:flex;flex-direction:column}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px}

/* app bar: sticky, respects notch */
.appbar{position:sticky;top:0;z-index:3;background:var(--bg);padding-top:env(safe-area-inset-top);height:calc(56px + env(safe-area-inset-top))}
.appbar .title{display:flex;align-items:center;gap:8px}

/* offline bar sits under the app bar and pushes content */
.offline-bar{position:sticky;top:calc(56px + env(safe-area-inset-top));z-index:2}

/* scroll area: room for tab bar + fab */
.scroll{flex:1;padding:0 16px calc(84px + 72px + env(safe-area-inset-bottom));max-width:100%}
.view{display:flex;flex-direction:column;min-height:100%}

/* tab bar fixed to the viewport */
.tabbar{position:fixed;left:0;right:0;bottom:0;height:auto;min-height:64px;padding-bottom:env(safe-area-inset-bottom);z-index:3}
.tabbar a{min-height:64px}
.tabbar.hidden,[hidden]{display:none!important}

/* fab above tab bar */
.fab{position:fixed;right:16px;bottom:calc(64px + 16px + env(safe-area-inset-bottom));z-index:2;border:0;cursor:pointer}
.fab.is-hidden{transform:translateY(120px);opacity:0;pointer-events:none}
.fab{transition:transform var(--dur-2) var(--ease-out),opacity var(--dur-2) var(--ease-out)}

/* overlays fixed to viewport */
.scrim{position:fixed;inset:0;z-index:20;animation:fadein var(--dur-2) var(--ease-out)}
.sheet{position:fixed;left:0;right:0;bottom:0;z-index:21;max-height:92vh;max-height:92dvh;padding-bottom:env(safe-area-inset-bottom);animation:slideup var(--dur-2) var(--ease-out)}
.sheet.full{top:calc(24px + env(safe-area-inset-top));max-height:none;border-radius:var(--r-3) var(--r-3) 0 0}
.sheet.full .grab{display:none}
.sheet .content{overflow-y:auto;-webkit-overflow-scrolling:touch;flex:1;min-height:0}
.sheet.closing{animation:slidedown var(--dur-2) var(--ease-in) forwards}
.scrim.closing{animation:fadeout var(--dur-2) var(--ease-in) forwards}
.dialog{position:fixed;left:16px;right:16px;top:50%;transform:translateY(-50%);z-index:21;max-width:440px;margin:0 auto;animation:fadein var(--dur-2) var(--ease-out)}
.dialog .actions{display:flex;gap:12px;margin-top:20px}
.dialog .actions .btn{flex:1}
.dialog p{margin:8px 0 0;color:var(--ink-2)}
#toasts{position:fixed;left:16px;right:16px;bottom:calc(64px + 12px + env(safe-area-inset-bottom));z-index:30;pointer-events:none;display:flex;flex-direction:column;align-items:stretch;max-width:520px;margin:0 auto}
.toast{position:static;pointer-events:auto;animation:slideup var(--dur-2) var(--ease-out)}
@keyframes slideup{from{transform:translateY(100%);opacity:.6}to{transform:none;opacity:1}}
@keyframes slidedown{to{transform:translateY(100%);opacity:.6}}
@keyframes fadein{from{opacity:0}to{opacity:1}}
@keyframes fadeout{to{opacity:0}}

/* auth screens: centred column, no tab bar */
.auth{max-width:420px;margin:0 auto;padding:calc(32px + env(safe-area-inset-top)) 20px 40px;display:flex;flex-direction:column;flex:1}
.auth .brand{display:flex;flex-direction:column;gap:8px;margin-bottom:32px}
.auth .brand .logo{width:48px;height:48px;font-size:24px;border-radius:10px}
.auth .or{display:flex;align-items:center;gap:12px;color:var(--ink-3);font-size:12px;letter-spacing:.08em;text-transform:uppercase;font-weight:600;margin:20px 0}
.auth .or::before,.auth .or::after{content:"";flex:1;height:1px;background:var(--border)}
.field .input.with-btn{padding-right:4px}
.field .input .iconbtn{margin-left:auto}
.input input::placeholder,.input textarea::placeholder{color:var(--ink-3);opacity:1}
.input.disabled{opacity:.6}
.input input[type="time"],.input input[type="date"]{font-family:var(--font-mono);font-variant-numeric:tabular-nums}

/* generic page bits views reuse */
.page-head{padding:8px 0 4px}
.page-head .eyebrow{margin-bottom:4px}
.stack{display:flex;flex-direction:column;gap:12px}
.row-gap{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.center{text-align:center}
.mt-2{margin-top:8px}.mt-4{margin-top:16px}.mt-6{margin-top:24px}
.mb-4{margin-bottom:16px}
.grow{flex:1;min-width:0}
.hidden-visually{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.kv{background:var(--surface)}
.kv.link{cursor:pointer}
.kv .sub{display:block;font-size:13px;line-height:16px;color:var(--ink-3)}
.kv .v{text-align:right}
.status-pill{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border-radius:var(--r-full);font-size:13px;font-weight:600;border:1px solid var(--border)}
.status-pill.ok{background:var(--success-soft);color:var(--success);border-color:transparent}
.status-pill.bad{background:var(--danger-soft);color:var(--danger);border-color:transparent}
.steps{list-style:none;margin:16px 0 0;padding:0;display:flex;flex-direction:column;gap:12px;counter-reset:s}
.steps li{display:flex;gap:12px;align-items:flex-start;counter-increment:s;font-size:15px;line-height:20px}
.steps li::before{content:counter(s);width:28px;height:28px;border-radius:50%;background:var(--ink);color:var(--bg);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;flex:none}
.notice{display:flex;gap:10px;align-items:flex-start;padding:12px;border-radius:var(--r-2);background:var(--surface-2);color:var(--ink-2);font-size:13px;line-height:18px}
.radio-card{display:flex;align-items:center;gap:12px;min-height:64px;padding:12px 14px;background:var(--surface);border:1px solid var(--border-strong);border-radius:var(--r-2);cursor:pointer;text-align:left;width:100%}
.radio-card.on{border-color:var(--ink);box-shadow:0 0 0 1px var(--ink)}
.radio-card .radio{width:22px;height:22px;border-radius:50%;border:2px solid var(--border-strong);flex:none;display:inline-flex;align-items:center;justify-content:center}
.radio-card.on .radio{border-color:var(--ink)}
.radio-card.on .radio::after{content:"";width:12px;height:12px;border-radius:50%;background:var(--ink)}
.radio-card .t{font-weight:600}
.radio-card .d{font-size:13px;line-height:16px;color:var(--ink-2)}
.big-icon{width:72px;height:72px;border-radius:var(--r-3);background:var(--accent-soft);display:inline-flex;align-items:center;justify-content:center;color:var(--ink);margin:0 auto 16px}
.big-icon.danger{background:var(--danger-soft);color:var(--danger)}
.sheet-intro{text-align:center;padding:8px 0 4px}
.sheet-intro p{margin:8px 0 0;color:var(--ink-2)}
.list-header{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:4px 0 8px;color:var(--ink-2);font-size:13px;line-height:16px}
.sec .eyebrow svg{width:14px;height:14px}
.sec button.eyebrow{display:inline-flex;align-items:center;gap:6px;min-height:44px;color:var(--ink-3)}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:12px 0}
.stat{background:var(--surface);border-radius:var(--r-2);box-shadow:var(--e-1);padding:10px 12px}
.stat .n{font-family:var(--font-mono);font-size:20px;line-height:26px;font-weight:700;font-variant-numeric:tabular-nums}
.stat .l{font-size:13px;line-height:16px;color:var(--ink-2)}
.swatches{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.swatch{display:flex;flex-direction:column;align-items:center;gap:4px;font-size:13px;color:var(--ink-2);min-height:44px}
.swatch .sq{width:44px;height:44px;border-radius:var(--r-1);display:inline-flex;align-items:center;justify-content:center;color:var(--on-house)}
.swatch.on .sq{box-shadow:0 0 0 2px var(--ink),0 0 0 4px var(--surface)}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.people{display:flex;gap:8px;flex-wrap:wrap}
.people button{border-radius:50%}
.people .avatar{width:44px;height:44px;font-size:15px}
.people .on .avatar{box-shadow:0 0 0 2px var(--ink)}
.totalbar{position:fixed;left:0;right:0;bottom:calc(64px + env(safe-area-inset-bottom));background:var(--surface);border-top:1px solid var(--border);padding:8px 16px;display:flex;justify-content:space-between;align-items:center;min-height:52px;z-index:2}
/* the count belongs on its own line — without display:block it reads "wszystkie domy14 pozycji" */
.totalbar .lbl{font-weight:600;font-size:15px;line-height:20px;min-width:0}
.totalbar .lbl small{display:block;font-size:13px;line-height:16px;color:var(--ink-3);font-weight:500}
.totalbar .mono{font-size:20px;line-height:26px;font-weight:700;flex:none;margin-left:12px}
.has-totalbar .scroll{padding-bottom:calc(84px + 72px + 52px + env(safe-area-inset-bottom))}
.has-totalbar .fab{bottom:calc(64px + 52px + 16px + env(safe-area-inset-bottom))}
.has-totalbar #toasts{bottom:calc(64px + 52px + 12px + env(safe-area-inset-bottom))}
.filterbar{position:sticky;top:calc(56px + env(safe-area-inset-top));z-index:1;background:var(--bg);margin:0 -16px;padding:8px 16px 4px;overflow-x:auto;scrollbar-width:none}
.filterbar::-webkit-scrollbar{display:none}
/* .filterbar's negative margin cancels .scroll's 16px padding; `flush` is for when the bar is a
   direct child of .view instead, where there is no padding to cancel. */
.filterbar.flush{margin:0}
.filterbar .filters{overflow:visible}
.compact-row{display:flex;align-items:center;gap:10px;min-height:48px;padding:4px 12px;background:var(--surface)}
.compact-row .title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.compact-row.done .title{text-decoration:line-through;color:var(--ink-3)}
.updating{opacity:.6;pointer-events:none}

/* ≥1024: tab bar becomes a side nav; content gets columns */
@media (min-width:1024px){
  #app{flex-direction:row}
  .tabbar{top:0;bottom:0;left:0;right:auto;width:240px;height:auto;flex-direction:column;justify-content:flex-start;padding:20px 12px;gap:4px;border-top:0;border-right:1px solid var(--border)}
  .tabbar a{flex:0 0 auto;flex-direction:row;justify-content:flex-start;gap:12px;height:44px;min-height:44px;padding:0 12px;border-radius:var(--r-2);font-size:17px;line-height:24px;font-weight:500;color:var(--ink-2)}
  .tabbar a.active{background:var(--accent-soft);color:var(--ink);font-weight:600;box-shadow:inset 3px 0 0 var(--accent)}
  .tabbar a.active::before{display:none}
  .tabbar .badge{position:static;margin-left:auto}
  .tabbar .brand{display:flex!important;align-items:center;gap:10px;padding:8px 12px 20px;font-weight:700;font-size:20px;letter-spacing:-.01em}
  .tabbar .nav-spacer{flex:1}
  .tabbar .nav-user{display:flex!important;align-items:center;gap:10px;padding:8px 12px;color:var(--ink-2);font-size:15px}
  .main{margin-left:240px;flex:1;min-width:0;display:flex;flex-direction:column}
  .scroll{padding:0 32px 96px;max-width:1200px;width:100%;margin:0 auto}
  .appbar,.offline-bar,.filterbar{padding-left:32px;padding-right:32px}
  .appbar{margin:0}
  .fab{right:32px;bottom:32px}
  .totalbar{left:240px;bottom:0;padding:12px 32px}
  .has-totalbar .fab{bottom:80px}
  #toasts{left:calc(240px + 16px);bottom:24px}
  .has-totalbar #toasts{bottom:80px}
  .cols{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:start}
  .cols.wide{grid-template-columns:2fr 1fr}
  .auth{padding-top:80px}
  .tabbar.hidden ~ .main{margin-left:0}
}
.tabbar .brand,.tabbar .nav-user{display:none}
