.tg{max-width:560px;margin:auto;padding:calc(var(--tg-safe-area-inset-top,env(safe-area-inset-top,0px)) + var(--tg-content-safe-area-inset-top,0px) + 18px) 16px calc(var(--tg-safe-area-inset-bottom,env(safe-area-inset-bottom,0px)) + 40px);display:flex;flex-direction:column;gap:14px}
.tg-head{display:flex;align-items:center;gap:14px}.tg-head img{border-radius:12px}
.tg-head h1{font-size:28px;margin:0}.tg-head p{margin:0;color:var(--muted);font-size:14px}
.tg-card{padding:20px;display:flex;flex-direction:column;gap:12px}.tg-card[hidden]{display:none}.tg-card h2{font-size:20px}
.tg-card .muted,.muted{color:var(--muted);font-size:14px;margin:0}
.tg-note{margin:0;padding:12px 14px;border-radius:16px;background:color-mix(in srgb,var(--red) 14%,var(--surface));font-size:14px}
.tg-note.ok{background:color-mix(in srgb,var(--green) 14%,var(--surface))}
.tg-row{display:flex;gap:10px;flex-wrap:wrap}.tg-row>*{flex:1 1 140px}
.tg-input{width:100%;min-height:50px;padding:0 14px;border-radius:14px;border:1px solid var(--line);background:var(--surface-raised);color:var(--text);font-size:16px}
.tg-router{display:flex;align-items:center;gap:12px;width:100%;min-height:64px;padding:10px 12px;border-radius:16px;background:var(--surface-raised);text-align:left}
.tg-router+.tg-router{margin-top:8px}.tg-router i{width:9px;height:9px;flex:0 0 9px;border-radius:50%;background:var(--subtle)}
.tg-router i.on{background:var(--green)}.tg-router span{flex:1;min-width:0}.tg-router strong,.tg-router small{display:block}
.tg-router small{color:var(--muted);font-size:13px}.tg-router b{color:var(--subtle);font-size:24px;font-weight:400}
.secondary-button{min-height:46px;border-radius:14px;background:var(--surface-raised);font-weight:650;font-size:14px}
.tg-foot{text-align:center;color:var(--subtle);font-size:13px}.tg-foot a{color:var(--blue)}
.tg-router.on{outline:2px solid var(--blue);outline-offset:-2px}
.tg-access-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.tg-access-head h2{margin:0}.tg-access-head p{margin:2px 0 0}
.tg-badge{font-size:12px;font-weight:700;color:var(--subtle);white-space:nowrap}.tg-badge.on{color:var(--green)}
.tg-switch-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-radius:16px;background:var(--surface-raised)}
.tg-switch-row span{display:flex;flex-direction:column;gap:2px;min-width:0}.tg-switch-row small{color:var(--muted);font-size:12px}
.tg-sub{font-size:16px;margin:8px 0 0}
.tg-person{display:flex;align-items:center;gap:12px;padding:10px 4px;border-top:1px solid var(--line)}.tg-person:first-child{border-top:0}
.tg-person span{flex:1;min-width:0;display:flex;flex-direction:column}.tg-person small{color:var(--muted);font-size:12px}
.tg-person strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tg-avatar{width:36px;height:36px;flex:0 0 36px;border-radius:50%;display:grid;place-items:center;font-style:normal;font-weight:750;background:color-mix(in srgb,var(--blue) 22%,var(--surface-raised));color:var(--blue)}
.tg-remove{color:var(--red);font-size:13px;font-weight:700;padding:8px 6px}
.tg-wide{width:100%}
#ownerTools{display:flex;flex-direction:column;gap:10px}#ownerTools[hidden]{display:none}
#inviteOut{display:flex;flex-direction:column;gap:8px}
.tg-qr-img{width:200px;height:200px;align-self:center;background:#fff;border-radius:16px;padding:8px}.tg-qr-img[hidden]{display:none}#inviteOut[hidden]{display:none}
.tg-code{align-self:center;font:700 26px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;letter-spacing:.08em;padding:10px 14px;border-radius:14px;background:var(--surface-raised);user-select:all}
.tg-code:empty{display:none}
.tg-code-input{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;letter-spacing:.06em}
.code-out{display:flex;flex-direction:column;gap:8px}.code-out[hidden]{display:none}
#logoutRow{flex:1 1 140px;display:flex}#logoutRow[hidden]{display:none}
#waitNote{margin:0}
.tg-approve{color:var(--green);font-size:13px;font-weight:700;padding:8px 6px}

/* colors: green = invite / create / approve, orange = transfer ownership / change role, red = remove / revoke / disable */
:root{--orange:#ff9f0a}
:root[data-theme=light]{--orange:#f08c00}
.secondary-button.tg-good{background:color-mix(in srgb,var(--green) 16%,var(--surface-raised));color:var(--green)}
.secondary-button.tg-bad{background:color-mix(in srgb,var(--red) 14%,var(--surface-raised));color:var(--red)}
.tg-owner{color:var(--orange);font-size:13px;font-weight:700;padding:8px 6px}
.tg-edit-btn{color:var(--muted);font-size:13px;font-weight:650;padding:8px 6px}
.tg-person{flex-wrap:wrap}
.tg-acts{flex:1 0 100%;display:flex;flex-wrap:wrap;gap:2px 8px;padding-left:48px;margin-top:-4px}
.tg-person>.tg-remove,.tg-person>.tg-approve{margin-left:auto}
.tg-pager{display:flex;align-items:center;gap:8px;margin-top:8px;font-size:13px;color:var(--muted)}.tg-pager .grow{flex:1}
.tg-pg{min-width:34px;height:34px;border-radius:10px;background:var(--surface-raised);font-size:16px;font-weight:700}.tg-pg:disabled{opacity:.35}
.tg-pgsize{min-height:34px;border-radius:10px;border:1px solid var(--line);background:var(--surface-raised);color:var(--text);padding:0 8px}
@media (max-width:899px){  /* U30: touch targets of at least 44x44 CSS px */
  .tg-remove,.tg-approve,.tg-owner,.tg-edit-btn:not(#sessionsNote .tg-edit-btn),.tg-pg{min-width:44px;min-height:44px}
  .tg-pgsize{min-height:44px;min-width:44px}
}
.tg-edit{min-height:34px;width:150px;max-width:100%;padding:0 10px;border-radius:10px;border:1px solid var(--blue);background:var(--surface-raised);color:var(--text);font-size:15px}
.tg-editrow{display:inline-flex;gap:6px;align-items:center}
.tg-fold{border-top:1px solid var(--line);padding-top:8px}.tg-fold[hidden]{display:none}.tg-fold summary{cursor:pointer;color:var(--muted);font-size:13px;font-weight:650;padding:6px 0}

/* PC / wide window: use the whole screen (adaptive, not the phone column): access on the left, the rest on the right */
@media (min-width:900px){
  .tg{max-width:1280px;padding-left:clamp(24px,3.2vw,56px);padding-right:clamp(24px,3.2vw,56px);display:grid;
    grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);column-gap:18px;row-gap:16px;align-items:start}
  .tg>*{grid-column:2;margin:0}
  .tg-head,.tg>.tg-note{grid-column:1/-1}
  #accessCard{grid-column:1;grid-row:span 4}
  #loginCard{grid-column:1/-1;justify-self:center;width:min(100%,520px)}
  .tg-foot{grid-column:1/-1}
  .tg-head h1{font-size:34px}
  /* nothing on the left (no routers yet): one centred column instead of an empty 60% */
  .tg:not(:has(#accessCard:not([hidden]))){grid-template-columns:minmax(0,640px);justify-content:center}
  .tg:not(:has(#accessCard:not([hidden])))>*{grid-column:1}
}
@media (min-width:1500px){.tg{max-width:1500px;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr)}}

/* ---------- Progress (one component for long actions) ---------- */
.progress{display:flex;flex-direction:column;gap:9px;padding:6px 0}
.progress-head{display:flex;align-items:center;gap:10px;min-height:22px;font-size:14px;font-weight:600;color:var(--text)}
.progress-icon{position:relative;flex:0 0 18px;width:18px;height:18px;border-radius:50%;border:2.5px solid var(--blue);border-right-color:transparent;animation:tgSpin .8s linear infinite;transition:border-color .3s var(--ease)}
.progress.ok .progress-icon,.progress.bad .progress-icon{animation:none;border-color:transparent}
.progress.ok .progress-icon::after,.progress.bad .progress-icon::after{position:absolute;inset:-3px;display:grid;place-items:center;border-radius:50%;font-size:12px;font-weight:800;color:#fff;animation:tgFadeIn .3s var(--ease)}
.progress.ok .progress-icon::after{content:"✓";background:var(--green)}
.progress.bad .progress-icon::after{content:"✕";background:var(--red)}
.progress-label{flex:1;min-width:0}
.progress-left{flex:0 0 auto;color:var(--muted);font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}
.progress-track{position:relative;height:6px;border-radius:3px;background:var(--surface-raised);overflow:hidden}
.progress-track i{display:block;height:100%;width:0;border-radius:3px;background:var(--blue);transition-property:width,background-color;transition-duration:.4s;transition-timing-function:var(--ease)}
.progress.ok .progress-track i{background:var(--green)}.progress.bad .progress-track i{background:var(--red)}
.progress.indeterminate .progress-track i{position:absolute;width:38%!important;animation:progress-slide 1.25s var(--ease) infinite}
@keyframes progress-slide{from{left:-40%}to{left:100%}}
.progress-steps{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:5px;font-size:13px;color:var(--subtle)}
.progress-steps li{display:flex;align-items:center;gap:8px;transition:color .3s var(--ease)}
.progress-steps li::before{content:"";flex:0 0 8px;width:8px;height:8px;border-radius:50%;background:var(--surface-raised);transition:background-color .3s var(--ease)}
.progress-steps li.now{color:var(--text)}.progress-steps li.now::before{background:var(--blue);animation:breathe-dot 1.2s ease-in-out infinite alternate}
.progress-steps li.done{color:var(--muted)}.progress-steps li.done::before{background:var(--green)}
.progress.bad .progress-steps li.now::before{background:var(--red);animation:none}
@keyframes breathe-dot{from{opacity:.45}to{opacity:1}}
.sub-status .progress{padding:0}

@keyframes tgSpin{to{transform:rotate(360deg)}}@keyframes tgFadeIn{from{opacity:0}to{opacity:1}}
@media (prefers-reduced-motion:reduce){.progress-track i{transition-duration:0s!important}.progress.indeterminate .progress-track i{animation:none;left:0;width:100%!important;opacity:.5}}
.tg-prog{position:fixed;z-index:120;left:12px;right:12px;top:calc(var(--tg-safe-area-inset-top,env(safe-area-inset-top,0px)) + var(--tg-content-safe-area-inset-top,0px) + 10px);
  display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none}
.tg-prog .progress{width:min(100%,420px);padding:12px 14px;border-radius:18px;background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow);transition:opacity .3s var(--ease),transform .3s var(--ease);animation:tgFadeIn .25s var(--ease)}
.tg-prog .progress.leaving{opacity:0;transform:translateY(-6px)}
.tg-stale{color:var(--muted);font-size:12px}
#sessionsNote .tg-edit-btn{display:inline;padding:2px 6px}
.tg-offer{display:grid;gap:8px;padding:14px;border-radius:16px;background:color-mix(in srgb,var(--blue) 14%,var(--surface));border:1px solid var(--line)}
.tg-offer[hidden]{display:none}.tg-offer p{margin:0}
.tg-facts{display:grid;grid-template-columns:auto 1fr;gap:6px 12px;margin:0;font-size:14px}.tg-facts dt{color:var(--muted)}.tg-facts dd{margin:0;word-break:break-word}
.tg-steps{margin:0;padding-left:20px;display:grid;gap:10px}.tg-steps p{margin:2px 0 0}
.tg-owner-tools{display:flex;flex-wrap:wrap;gap:8px}.tg-owner-tools[hidden]{display:none}#wifiNewKey{font-size:20px;font-weight:750;letter-spacing:.04em;word-break:break-all;user-select:all}
