/* Home & care (#156, ADR 057): switches and one-line rows on one phone screen; everything bigger
   opens as a sheet (sheets.js). Tokens only (app.css), so light and dark follow the page's theme. */
#tab-system{--tab-width:560px}
.care-layout{display:block}
.care-list{display:grid;gap:12px;padding:4px 0 8px;min-width:0}
.care-alert:empty{display:none}
.care-group{display:grid;padding:4px;border:1px solid var(--stroke);border-radius:var(--r-control);background:var(--glass);min-width:0;
  -webkit-backdrop-filter:blur(var(--blur-compact));backdrop-filter:blur(var(--blur-compact))}
.care-group>.care-row{min-height:52px;padding:8px 10px}
.care-list .care-row{min-height:52px}
.care-row .care-row-label{min-width:0;overflow-wrap:anywhere}
.care-icon{display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:10px;background:var(--glass-raised);border:1px solid var(--stroke-soft)}
.care-icon .icon{width:18px;height:18px}
.tone-rose{color:var(--rose)}.tone-violet{color:var(--violet)}.tone-cyan{color:var(--cyan)}.tone-amber{color:var(--amber)}.tone-mint{color:var(--mint)}
:root[data-theme=light] .care-icon{color:var(--text)}
@media (prefers-color-scheme:light){:root:not([data-theme]) .care-icon{color:var(--text)}}
.care-open{justify-content:flex-start}
.care-open>.care-row-label,.care-open>.care-row-text{flex:1}
.care-value{display:inline-flex;align-items:center;gap:4px;margin-left:auto;color:var(--text-2);font-size:14px;font-weight:500;white-space:nowrap}
.care-value:empty{display:none}
.care-value .glyph{width:16px;height:16px}
.care-value.ok .glyph{color:var(--mint)}
.care-value.needs{color:var(--amber);font-weight:600}
/* Saving energy (#115): amber words and battery, not a hand (nothing needs the owner). */
.care-value:is(.some,.little){color:var(--amber)}
:root[data-theme=light] .care-value:is(.some,.little){color:#8A5200}
@media (prefers-color-scheme:light){:root:not([data-theme]) .care-value:is(.some,.little){color:#8A5200}}
:root[data-theme=light] .care-value.needs{color:#8A5200}
@media (prefers-color-scheme:light){:root:not([data-theme]) .care-value.needs{color:#8A5200}}
.care-row .chevron{flex:none;color:var(--text-3)}
.care-row.current{background:var(--glass-raised);box-shadow:inset 3px 0 0 var(--violet)}
/* The account banner: one tall row. */
.care-banner{min-height:64px;padding:10px 14px;border:1px solid var(--stroke);border-radius:var(--r-control);background:var(--glass);
  -webkit-backdrop-filter:blur(var(--blur-compact));backdrop-filter:blur(var(--blur-compact))}
.care-avatar{width:44px;height:44px;border-radius:50%;flex:none;background:linear-gradient(135deg,rgba(139,124,255,.55),rgba(102,226,240,.45))}
.care-avatar .icon{width:22px;height:22px}
/* Notifications: two targets in one row, split by a visible line; each is at least 44 px. */
.care-split{padding:0 12px 0 0!important;gap:0}
.care-split-open{display:flex;align-items:center;gap:12px;flex:1;min-width:0;min-height:52px;padding:8px 10px;margin:0;background:transparent;color:var(--text);
  border:0;border-radius:var(--r-compact);text-align:left;font-weight:500}
.care-split-open:hover{filter:none;background:var(--glass-soft)}
.care-split-open .care-row-text{flex:1}
.care-divider{flex:none;width:1px;height:28px;margin:0 12px 0 4px;background:var(--stroke)}
.care-switch-row{cursor:pointer}
.care-switch-row .care-row-text{flex:1}
.care-look #look-label{flex:1}
.look-switch{width:auto;flex:none}
.look-switch button{min-width:44px;width:44px;padding:0;display:grid;place-items:center}
.look-switch button .icon{width:18px;height:18px}
/* Sheets: one <dialog> each. The head stays while the body scrolls; nothing drags the page behind. */
.care-sheet{padding:0 18px 18px;overflow:auto;overscroll-behavior:contain;max-width:640px}
.care-sheet[open]{animation:care-sheet-in var(--base) var(--ease-settle)}
@keyframes care-sheet-in{from{transform:translateY(28px);opacity:0}to{transform:none;opacity:1}}
.sheet-head{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:6px;min-height:60px;margin:0 -18px 8px;padding:10px 10px 6px 18px;
  background:var(--surface);border-bottom:1px solid var(--stroke-soft)}
.sheet-title{flex:1;min-width:0;margin:0;font-size:20px;line-height:26px;font-weight:620;overflow-wrap:anywhere;cursor:default}
.sheet-title:focus{outline:none}
.sheet-back{display:inline-flex;align-items:center;gap:2px;flex:none;min-height:44px;padding:6px 10px 6px 4px;border-color:transparent;font-size:15px;color:var(--text-2)}
.sheet-back[hidden]{display:none}
.sheet-back .icon{width:18px;height:18px}
.sheet-close{flex:none;border-radius:50%;background:var(--glass-soft);border:1px solid var(--stroke-soft)}
.sheet-head .info-btn{margin:0}
.sheet-view{display:grid;gap:12px;min-width:0}
.sheet-view[hidden]{display:none}
.sheet-view>.preferences{margin:0}
.sheet-line{margin:0}
.care-sheet [role=status]:empty,.care-sheet .fine:empty{display:none}
.sheet-section{display:grid;gap:8px;min-width:0}
.sec{display:flex;align-items:center;gap:8px;margin:8px 2px 0;font-size:13px;font-weight:650;color:var(--text-2);letter-spacing:.01em}
.sec.sticky{position:sticky;top:60px;z-index:1;margin:0 -18px;padding:8px 18px;background:var(--surface);border-bottom:1px solid var(--stroke-soft)}
.count-badge{display:inline-grid;place-items:center;min-width:22px;height:22px;padding:0 7px;border-radius:999px;background:var(--glass-raised);
  border:1px solid var(--stroke-soft);color:var(--text);font-size:12px;font-weight:650}
.count-badge:empty,.count-badge[hidden]{display:none}
.see-all-slot:empty{display:none}
.see-all{justify-content:flex-start;gap:10px;min-height:48px;border:1px solid var(--stroke-soft)!important;border-radius:var(--r-compact)!important;color:var(--violet)}
.see-all .see-all-label{flex:1;font-weight:600}
.see-all .icon{width:18px;height:18px;color:var(--text-3)}
:root[data-theme=light] .see-all{color:#5646CF}
@media (prefers-color-scheme:light){:root:not([data-theme]) .see-all{color:#5646CF}}
.sheet-empty{display:grid;justify-items:center;gap:8px;margin:0;padding:24px 12px;text-align:center;color:var(--text-2)}
.sheet-empty[hidden]{display:none}
p.sheet-empty{display:block;font-size:15px}
.sheet-empty-mark{display:grid;place-items:center;width:52px;height:52px;border-radius:16px;background:var(--glass-raised);color:var(--amber)}
.sheet-empty-mark .glyph{width:24px;height:24px}
.sheet-empty-words{margin:0;font-weight:600;color:var(--text)}
.skeleton-row{display:flex;align-items:center;gap:12px;min-height:56px;padding:10px 12px;border:1px solid var(--stroke-soft);border-radius:var(--r-compact)}
.skeleton-mark{width:32px;height:32px;border-radius:10px;background:var(--glass-raised)}
.skeleton-line{flex:1;height:12px;border-radius:6px;background:var(--glass-raised)}
.sheet-search input{width:100%;border-radius:var(--r-chip)}
.sheet-search[hidden]{display:none}
.sheet-action{justify-self:start;display:inline-flex;align-items:center;gap:6px}
.sheet-signout{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:52px;color:var(--rose);border-color:rgba(255,120,146,.45)}
:root[data-theme=light] .sheet-signout{color:#B0243F}
@media (prefers-color-scheme:light){:root:not([data-theme]) .sheet-signout{color:#B0243F}}
.devices-actions button{display:inline-flex;align-items:center;gap:6px}
.remove-button{width:44px;height:44px;min-width:44px;padding:0;display:grid;place-items:center;border-radius:50%;color:var(--rose);border-color:rgba(255,120,146,.40)}
.remove-button .icon{width:20px;height:20px}
.history-chips{display:flex;gap:8px;flex-wrap:wrap}
.history-chips[hidden]{display:none}
.history-chips .quest-chip{gap:6px}
.history-chips .quest-chip[aria-pressed=true]{background:var(--violet);color:var(--on-accent);border-color:transparent}
.history-chips .icon{width:16px;height:16px}
.history-list{display:grid;gap:0;min-width:0}
.day-rows{display:grid;gap:6px;padding:8px 0}
.history-row{margin:0;padding:10px 12px;border:1px solid var(--stroke-soft);border-radius:var(--r-compact);font-size:14px;line-height:20px;color:var(--text);overflow-wrap:anywhere}
.history-row span{color:var(--text-2)}
.history-row.problem{border-color:rgba(246,174,94,.5)}
.computer-body{display:grid;gap:12px}
.computer-body .always-on{margin:0}
.always-on-row{display:flex;flex-direction:column;align-items:flex-start;gap:2px}
.always-on-cause{padding-left:22px;color:var(--text-2);font-size:14px;line-height:19px}
.computer-facts .summary-list{display:grid;grid-template-columns:1fr auto;gap:0;margin:0;padding:0 10px}
.computer-facts dt,.computer-facts dd{margin:0;padding:14px 0;border-top:1px solid var(--stroke-soft);font-size:15px}
.computer-facts dt:first-of-type,.computer-facts dt:first-of-type+dd{border-top:0}
.computer-facts dd{text-align:right;color:var(--text-2)}
.sheet-view .keys-list{padding:0}
.sheet-view .devices-list{margin:0}
.care-sheet .device-row>div{display:grid;gap:2px;min-width:0;flex:1}
.care-sheet .device-row>button{flex:none}
.care-sheet .promise-row{grid-template-columns:minmax(0,1fr) auto}
.care-sheet .promise-row .key-confirm{grid-column:1/-1}
.sheet-view .connections{padding:4px 6px 10px}
.care-sheet .back-to-top{margin-right:-6px}
/* Phone (#171): a floating card, never glued to the bottom edge. It is inset from the sides and
   rounded on every corner. The card never needs to reach the screen's edge, so the iOS Home Screen
   app's bottom inset can't leave a strip under it. No grabber: the sheet is not dragged, so none is
   drawn. --sab is the bottom safe area (a variable, so a screenshot can simulate an iPhone's 34 px).
   Its height follows its content in both directions (#205): an empty sheet is its header, and a
   sheet grows upward with what it holds (a list that arrives after it opened, an opened History) up
   to just below the status bar, and only then scrolls inside. A short sheet floats higher (at least
   14 % of the screen above the bottom); one that opens long (Account, See all) stops just above the
   home indicator. */
:root{--sab:env(safe-area-inset-bottom,0px);--sat:env(safe-area-inset-top,0px)}
@media (max-width:760px){
  .care-sheet{--sheet-gap:max(calc(var(--sab) + 16px),14dvh);width:calc(100vw - 20px);max-width:560px;margin:auto auto var(--sheet-gap);
    max-height:calc(100dvh - var(--sat) - var(--sheet-gap) - 24px);border-radius:28px;padding:0 16px 16px}
  .care-sheet[data-size=full]{--sheet-gap:calc(var(--sab) + 10px);padding-bottom:28px}
  /* The quest report (and a World note) is the same floating card; it is usually long, so it uses the height. */
  .quest-sheet{--sheet-gap:calc(var(--sab) + 10px);width:calc(100vw - 20px);max-width:560px;margin:auto auto var(--sheet-gap);
    max-height:calc(100dvh - var(--sat) - var(--sheet-gap) - 24px);border-radius:28px;padding:20px 20px 28px}
  /* A sheet that scrolls fades out at its bottom edge while more lies below (#171 review), and only then
     (#205): the sheet's own scroll drives the fade, so it is gone at the end of the list and never drawn
     while everything fits. A browser without scroll timelines draws no fade. */
  .care-sheet::after,.quest-sheet::after{content:"";position:sticky;bottom:0;z-index:2;display:block;height:24px;margin:-24px -16px 0;
    background:linear-gradient(180deg,transparent,var(--surface));pointer-events:none;opacity:0}
  .quest-sheet::after{margin:-24px -20px 0}
  @supports (animation-timeline:scroll()){
    .care-sheet,.quest-sheet{scroll-timeline:--sheet-scroll block}
    .care-sheet::after,.quest-sheet::after{animation:sheet-more linear both;animation-timeline:--sheet-scroll;animation-range:calc(100% - 24px) 100%}
  }
  .sheet-head{margin:0 -16px 8px;padding:12px 8px 6px 16px;border-radius:28px 28px 0 0}
  .sec.sticky{margin:0 -16px;padding:8px 16px}
  .care-list{gap:8px;padding-bottom:4px}
  .care-sheet .device-row{flex-direction:row;align-items:center}
  .look-switch{width:auto}.look-switch button{flex:none;min-width:44px;padding:0}
}
/* Shown before the last 24 px of the sheet's scroll, gone at its end (#205). */
@keyframes sheet-more{from{opacity:1}to{opacity:0}}
/* The scrim reaches the screen's bottom edge even where the Home Screen app's fixed layer stops short
   of the home indicator (#171): it is drawn past the bottom, where nothing else is. */
dialog::backdrop{bottom:calc(-1 * (var(--sab) + 120px))}
/* Tablet and small laptop: the sheet is a panel from the right, over the screen (modal). */
@media (min-width:761px){
  .care-sheet:modal{margin:0 0 0 auto;width:min(480px,92vw);height:100dvh;max-height:100dvh;border-radius:var(--r-card) 0 0 var(--r-card);border-right:0}
  .care-sheet:modal[open]{animation-name:care-panel-in}
}
@keyframes care-panel-in{from{transform:translateX(28px);opacity:0}to{transform:none;opacity:1}}
/* Laptop: the list stays on the left and the sheet docks on the right, not modal. */
@media (min-width:1100px){
  #tab-system{--tab-width:1060px}
  .care-layout{display:grid;grid-template-columns:minmax(0,420px);justify-content:center;gap:24px;align-items:start}
  .care-layout:has(.care-sheet.docked[open]){grid-template-columns:minmax(0,380px) minmax(0,640px)}
  .care-sheet.docked{position:sticky;top:0;inset:auto;z-index:1;margin:4px 0 0;width:auto;max-width:none;max-height:calc(100dvh - 120px);
    box-shadow:var(--shadow-card);animation:none}
  body:has(.care-sheet.docked[open]):not(:has(dialog:modal)) #tab-system{overflow:auto}
}
@media (prefers-reduced-motion:reduce){
  .care-sheet[open],.care-sheet:modal[open]{animation:care-sheet-fade .1s linear}
}
@keyframes care-sheet-fade{from{opacity:0}to{opacity:1}}
@media (prefers-reduced-transparency:reduce){.care-group,.care-banner{background:var(--surface);-webkit-backdrop-filter:none;backdrop-filter:none}}
/* Very narrow (a phone at 200 % zoom): icons give their room to the words, and a row may wrap. */
@media (max-width:300px){
  .care-icon,.care-avatar{display:none}
  .care-row .care-row-label{overflow-wrap:normal}
  .care-list .care-row,.care-split-open{flex-wrap:wrap;column-gap:8px}
  .care-split{flex-wrap:wrap}
  .care-divider{display:none}
  .care-look #look-label{flex:1 1 100%}
}
/* #156 review: one line per item in the long lists. The item's name, one sub-line, a rose ⊖. */
.care-sheet .list-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:4px 6px;padding:4px 4px 4px 2px;
  border:1px solid var(--stroke-soft);border-radius:var(--r-compact);background:transparent;min-width:0}
.care-sheet .list-row.locked{border-color:rgba(255,120,146,.35)}
.list-row-main{display:grid;gap:2px;justify-items:start;min-width:0;min-height:48px;margin:0;padding:6px 10px;background:transparent;color:var(--text);
  border:0;border-radius:10px;text-align:left;font-weight:400;letter-spacing:0}
.list-row-main:hover{filter:none;background:var(--glass-soft)}
.list-row-name{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;font-size:15px}
.list-row-sub{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}
.list-row>.key-confirm,.list-row>.list-row-detail{grid-column:1/-1;margin:0;padding:6px 10px 8px}
.list-row .info-btn{margin:0}
.key-locked{color:var(--rose)}
:root[data-theme=light] .key-locked{color:#B0243F}
@media (prefers-color-scheme:light){:root:not([data-theme]) .key-locked{color:#B0243F}}
.history-main{display:flex;align-items:center;gap:10px;width:100%}
.history-main .glyph{width:18px;height:18px;flex:none;color:var(--mint)}
.history-row.problem .history-main .glyph{color:var(--amber)}
.history-main .list-row-name{flex:1;font-weight:500}
.history-time{flex:none}
.care-sheet .history-row{grid-template-columns:minmax(0,1fr)}
.key-uses{margin:8px 0 0}
.key-uses-list{list-style:none;margin:6px 0 0;padding:0;display:grid;gap:4px;font-size:14px;color:var(--text-2)}
/* Energy and Computer: the sheet is the card; no heading and border inside it again. */
.care-sheet .preferences,.computer-body .always-on{border:0;background:none;box-shadow:none;padding:0 2px;-webkit-backdrop-filter:none;backdrop-filter:none}
.care-sheet #engine-list-title{display:none}
.care-value.needs .glyph,.always-on-needs_you .always-on-state,.always-on-needs_you .always-on-state .glyph{color:var(--amber)}
:root[data-theme=light] :is(.care-value.needs .glyph,.always-on-needs_you .always-on-state,.always-on-needs_you .always-on-state .glyph){color:#8A5200}
@media (prefers-color-scheme:light){:root:not([data-theme]) :is(.care-value.needs .glyph,.always-on-needs_you .always-on-state,.always-on-needs_you .always-on-state .glyph){color:#8A5200}}
.notify-more[data-state=off] .care-row-label,.notify-more[data-state=off] .notify-times{opacity:.55}
/* 200 % text on a phone (a page of about 200 px): each row stacks, the label first and its control
   right-aligned below; switches keep their size; the header keeps only its back chevron; the tab bar
   keeps its icons (the buttons keep their names for screen readers). */
@media (max-width:300px){
  .care-list .care-row,.care-split-open,.care-sheet .care-row{flex-wrap:wrap;row-gap:4px}
  .care-list .care-row>.care-row-label,.care-list .care-row>.care-row-text,.care-split-open .care-row-text{flex:1 1 100%;min-width:0}
  .care-list .care-value{margin-left:auto}
  .care-list .switch,.care-sheet .switch{flex:none;margin-left:auto}
  .care-split{flex-direction:column;align-items:stretch;padding:0 0 8px!important}
  .care-split>.switch{align-self:flex-end;margin-right:10px}
  .care-group{grid-template-columns:minmax(0,1fr)}
  .look-switch{margin-left:0;width:100%;display:flex}
  .look-switch button{flex:1 1 0;min-width:0;width:auto}
  .back-button span{display:none}
  .header-title h2{min-width:0;overflow:hidden;text-overflow:ellipsis}
  .care-sheet .list-row{grid-template-columns:minmax(0,1fr) auto}
  .care-sheet .list-row>.remove-button{grid-column:2}
}
@media (max-width:240px){
  .nav span.nav-label,.nav-collapsed .nav-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
}
/* #50's account, first in the Account sheet: the name, then "Two-step · 8 codes ›". */
.account-rows:has(.account-row[hidden]){display:none}
.account-row{display:grid;gap:2px;padding:10px 6px 6px 16px;border:1px solid var(--stroke-soft);border-radius:var(--r-compact)}
.account-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:17px;font-weight:650}
.account-security{min-height:44px!important;padding:6px 10px 6px 0!important}
.account-security .care-row-label{flex:1;font-weight:500}
/* Away from Ari's computer the state is words, not a button (#211). */
.account-plain{display:flex;align-items:center;min-height:44px;margin:0;padding:6px 10px 6px 0;font-weight:500}
.account-reset-area{display:grid;gap:8px;padding:4px 10px 10px 0}
.account-reset{justify-self:start;display:inline-flex;align-items:center;gap:6px;color:var(--rose);border-color:rgba(255,120,146,.45)}
#devices-history .care-row-label{flex:1}
/* The owner's review (#156): sign out is a small icon at the top of Home & care on a phone. */
.care-signout{display:none}
@media (max-width:760px){.shell[data-screen=system] .care-signout{display:inline-grid;color:var(--rose)}}
/* Compact Account: two-line device rows, tighter gaps. */
#sheet-account .sheet-view{gap:8px}
#sheet-account .sheet-section{gap:6px}
.list-row-text{cursor:default}
.list-row-text:hover{background:transparent}
.care-sheet .device-row{padding:2px 4px 2px 2px}
.care-sheet .device-row .list-row-main{min-height:44px;padding:4px 10px}
#devices-history{justify-content:flex-start}
/* Quests at once: the slots say how many work, green when one does. */
.lane-busy rect{fill:var(--mint);stroke:var(--mint)}
.lane-busy{filter:drop-shadow(0 0 3px color-mix(in srgb,var(--mint) 55%,transparent))}
/* The ⓘ sheet: a round ✕ beside its title, never over the text. */
.info-sheet .dialog-header{align-items:flex-start;gap:12px;margin:0 0 8px}
.info-sheet .dialog-header h3{flex:1;min-width:0;padding-top:8px;overflow-wrap:anywhere}
.info-sheet #info-close{flex:none;margin:-4px -4px 0 0}
.notify-sheet-row .care-row-label{font-weight:600}
/* Sign out asks in a popover beside the ⎋ that was pressed (#211): the top layer, placed by app.js. */
.signout-ask{position:fixed;z-index:40;inset:auto;margin:0;width:max-content;max-width:min(300px,calc(100vw - 16px));padding:12px;color:var(--text);
  border:1px solid var(--stroke);border-radius:var(--r-compact);background:var(--surface);box-shadow:var(--shadow-float)}
.signout-ask:not(:popover-open){display:none}
.signout-ask p{margin:0 0 8px;flex:1 1 100%}
/* GitHub → Connections sits inset like every other row in Keys (#171 review). */
.care-sheet .list-row.key-connection{padding:8px 12px}
/* Owner commands (#304): the row's choice wraps under its title on a phone and each choice keeps its whole
   word (content-sized, never an ellipsis); an ask is a row with two compact taps (36 px drawn on a 44 px hit). */
.owner-commands-row{flex-wrap:wrap;row-gap:8px}
.owner-commands-choice{flex:0 1 auto}
.owner-commands-choice button{flex:1 1 auto;min-width:0;padding-left:8px;padding-right:8px;font-size:15px}
.owner-ask{flex-wrap:wrap;row-gap:4px}
.owner-ask .care-row-title{flex-wrap:wrap;row-gap:2px}
.owner-ask-exact{flex:1 1 100%;font-size:12px;line-height:16px;color:var(--text-2);overflow-wrap:anywhere;white-space:normal}
.owner-ask-actions{display:inline-flex;gap:4px;flex-shrink:0}
.owner-ask-actions button{--ring:var(--hit-ring);box-sizing:border-box;min-height:var(--hit);padding:0 14px;
  border:var(--ring) solid transparent!important;background-clip:padding-box!important;border-radius:14px;
  font-size:14px;line-height:1.2}
.owner-ask-actions button.quiet{box-shadow:inset 0 0 0 1px var(--stroke)}
@media (max-width:520px){.owner-commands-choice{width:100%}}
