/* Phone layouts of the sheets, In this room, Invite and the lobby. Wider
   windows keep the layouts of viewer-session.css and viewer-room.css. */

/* Controls only a phone shows. Wider, a session row's Rename and Delete lie
   in the row, their popover a mere wrapper, and Progress is a plain list. */
.sheet-close,.lobby-more,.task-fold,.section-count { display:none; }
.lobby-facts,.lobby-row-menu { display:contents; color:inherit; }
#owner-device-content { display:grid; gap:8px; }
.owner-device-row { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.owner-approval-fields { display:grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap:.3rem .6rem; margin:.4rem 0; }
.owner-approval-fields dd { margin:0; }
.owner-approval-fields,.owner-approval-technical { overflow-wrap:anywhere; }
.owner-approval-input { white-space:break-spaces; }
.owner-approval-technical { margin-bottom:.75rem; }
#owner-device-content code { overflow-wrap:anywhere; }
#owner-device-content textarea { display:block; width:100%; }
@media (min-width:641px) {
  #activity > summary { pointer-events:none; cursor:default; }
  #session-box #activity > summary::after { content:none; }
}

/* Invite on a phone (viewer-session.js): one level, its code, its link. */
#invite[data-compact] .sheet-form > .sheet-note,#invite[data-compact] figcaption { display:none; }
#invite[data-compact] #invite-tiers { display:contents; }
.invite-levels { display:flex; border:1px solid var(--line); border-radius:4px; overflow:hidden; }
.invite-levels .btn { flex:1; min-height:40px; padding:0 6px; border:0; border-left:1px solid var(--line); border-radius:0; font-size:14px; font-weight:500; text-transform:capitalize; }
.invite-levels .btn:first-child { border-left:0; }
.invite-levels .btn[aria-pressed="true"] { background:var(--accent); color:var(--on-accent); font-weight:600; }
.invite-levels + .sheet-note { margin:0; }
#invite[data-compact] .invite-qr { order:1; margin:0; }
#invite[data-compact] .invite-qr-code { width:148px; }
.invite-copy { order:2; display:flex; margin:0 -16px; padding:10px 16px 0; border-top:1px solid var(--line); }
.invite-copy .btn { flex:1; min-height:44px; font-size:14px; }

@media (max-width:640px) {
  /* Every sheet rises from the bottom edge, within the screen and its safe
     areas, under a grabber, a 17px title and a close control. */
  dialog.sheet { inset:auto 0 0; margin:0; width:100%; max-width:none; max-height:calc(100dvh - var(--safe-top) - 16px); border-width:1px 0 0; border-radius:12px 12px 0 0; overflow-y:auto; overscroll-behavior:contain; }
  dialog.sheet::before { content:""; display:block; width:36px; height:4px; margin:6px auto 0; border-radius:2px; background:var(--line); }
  .sheet-form { padding:0 16px calc(14px + var(--safe-bottom,env(safe-area-inset-bottom,0px))); }
  .sheet-title { display:flex; align-items:center; min-height:44px; padding-right:40px; font-size:17px; font-weight:650; letter-spacing:-.01em; }
  /* Beside the title, and still in reach when a long sheet scrolls. */
  .sheet-close { position:sticky; top:4px; z-index:1; align-self:flex-end; display:grid; place-items:center; width:44px; height:44px; margin:0 -10px -54px 0; padding:0; border:0; border-radius:50%; background:var(--surface); color:var(--muted); font-size:22px; line-height:1; cursor:pointer; }
  .sheet-note { margin-bottom:4px; line-height:1.45; }
  /* Safari zooms the page when a focused field is under 16px. */
  .sheet-input { font-size:16px; }
  .sheet-actions { margin-top:10px; }
  .sheet-actions .btn { min-height:44px; }
  /* The close control stands in for a lone Done. */
  .sheet-actions:has(> .btn.quiet[type="submit"]:only-child) { display:none; }

  /* In this room, open: the same bottom sheet, its sections an accordion
     (viewer.js) with Progress first and counts on the closed ones. */
  #session-box[open] { max-height:calc(100dvh - var(--safe-top) - 16px); padding:0 16px calc(12px + var(--safe-bottom,env(safe-area-inset-bottom,0px))); border-width:1px 0 0; overscroll-behavior:contain; box-shadow:0 -6px 24px rgb(10 14 22 / 18%),0 0 0 100vmax rgb(10 14 22 / 38%); }
  #session-box[open] > summary { min-height:54px; margin:0 -10px 0 0; padding:10px 0 0; border-bottom:0; background:linear-gradient(var(--line),var(--line)) calc(50% - 5px) 6px / 36px 4px no-repeat,var(--surface); }
  #session-box[open] .sidebar-title { font-size:17px; font-weight:650; letter-spacing:-.01em; }
  #session-box[open] > summary::after { display:grid; place-items:center; width:44px; height:44px; font-size:22px; }
  #session-box[open] .dock-disclosure-body { display:flex; flex-direction:column; }
  #session-box[open] .dock-disclosure-body > *:not([hidden]):not(:empty) { margin:0; border-top:1px solid var(--line); }
  #session-box[open] #activity { order:1; }
  #session-box[open] #artifacts-box { order:2; }
  #session-box[open] #editing-box { order:3; }
  #session-box[open] #commands-box { order:4; }
  #session-box[open] .dock-actions { order:5; padding-top:0!important; }
  #session-box[open] #privacy-box { order:6; }
  #session-box[open] :is(.dock-submenu,.disclosure) > summary { display:flex; align-items:center; gap:8px; min-height:48px; padding:0; font-size:15px; list-style:none; }
  #session-box[open] .disclosure > summary::-webkit-details-marker { display:none; }
  #session-box[open] :is(.dock-submenu,.disclosure) > summary::after { content:'▾'; float:none; margin-left:auto; color:var(--muted); font-size:13px; font-weight:400; }
  #session-box[open] :is(.dock-submenu,.disclosure)[open] > summary::after { content:'▴'; }
  #session-box[open] .disclosure > summary { color:var(--ink); font-weight:400; }
  #session-box[open] .disclosure:not([open]) > summary::after { content:'›'; font-size:15px; }
  #session-box[open] :is(.section-count,#commands-summary) { display:block; flex:1; min-width:0; margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:right; font-size:13px; font-weight:400; color:var(--muted); }
  #session-box[open] :is(.dock-submenu,.disclosure)[open] > :last-child { margin-bottom:12px; }
  #session-box[open] #tasks-list { margin-bottom:0; }
  #session-box[open] .dock-actions .btn { align-items:center; min-height:48px; padding:0; font-size:15px; font-weight:400; }
  #session-box[open] #tasks-list .task { min-height:44px; padding:5px 0; align-content:center; font-size:14px; line-height:1.3; border-top:1px solid var(--line); }
  #session-box[open] #tasks-list > :first-child { border-top:0; }
  #session-box[open] #tasks-list:not([data-done]) .task.completed { display:none; }
  #session-box[open] #tasks-list .task-id,#session-box[open] #tasks-list .task-meta { font-size:12px; }
  #session-box[open] #tasks-list .task-fold { display:block; border-top:1px solid var(--line); }
  .task-fold button { display:flex; align-items:center; width:100%; min-height:44px; padding:0; border:0; background:none; color:var(--muted); font:inherit; font-size:14px; text-align:left; cursor:pointer; }
  .task-fold button::after { content:'›'; margin-left:auto; }
  .task-fold button[aria-expanded="true"]::after { content:'▴'; font-size:13px; }

  /* The lobby: tabs and the tab's action on one line, then rows of a name,
     one line of facts and one of preview. A row opens its session; Rename
     and Delete wait behind its ⋯, and Refresh in the header's ⋯ menu. */
  .lobby { padding:0 0 calc(24px + var(--safe-bottom,env(safe-area-inset-bottom,0px))); }
  .lobby-head { gap:4px; margin:0; padding:6px 12px 0; }
  .lobby-head:has(> .lobby-tabs:not([hidden])) .lobby-actions { padding:0 0 4px; }
  .lobby-tabs { gap:0; }
  .lobby-tab { min-height:44px; padding:0 10px; font-size:14px; }
  .lobby-actions .btn { min-height:36px; padding:0 12px; }
  #lobby-refresh,.lobby-new-what { display:none; }
  .lobby > [role="tabpanel"]:not(#lobby-sessions) { padding:12px 16px 0; }
  #lobby-sessions .lobby-empty { margin:14px 16px; }
  #lobby-list .lobby-row { position:relative; flex-wrap:nowrap; gap:4px; padding:11px 4px 11px 16px; border-top:0; border-bottom:1px solid var(--line); }
  #lobby-list .lobby-row:not(:has(.lobby-more)) { padding-right:16px; }
  #lobby-list .lobby-main { flex:1 1 0; display:block; }
  #lobby-list :is(.lobby-name,.lobby-facts,.lobby-late-delivery,.lobby-preview) { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #lobby-list .lobby-name { font-size:15px; line-height:22px; }
  /* The wake-up joins the facts, so only one line is kept for live patches:
     a late-delivery notice takes the preview's line, or a spare one. */
  #lobby-list .lobby-facts { min-height:19px; color:var(--muted); font-size:12px; line-height:19px; }
  #lobby-list .lobby-facts .lobby-meta { font-size:inherit; }
  #lobby-list .lobby-wake-up { min-height:0; }
  #lobby-list .lobby-meta:not(:empty) + .lobby-wake-up:not(:empty)::before { content:' · '; white-space:pre; }
  #lobby-list :is(.lobby-late-delivery,.lobby-preview) { height:21px; font-size:13px; line-height:21px; }
  #lobby-list .lobby-late-delivery:empty:not(:last-child),#lobby-list .lobby-late-delivery:not(:empty) + .lobby-preview { display:none; }
  #lobby-list .lobby-open { position:absolute; inset:0; padding:11px 52px 0 0; border:0; border-radius:0; background:none; color:transparent; font-size:12px; line-height:22px; text-align:right; filter:none; }
  #lobby-list .lobby-open:active { background:color-mix(in srgb,var(--accent-soft) 55%,transparent); }
  #lobby-list .lobby-open:focus-visible { outline-offset:-2px; }
  #lobby-list .lobby-open:disabled { display:flex; justify-content:flex-end; align-items:flex-start; opacity:1; color:var(--muted); background:color-mix(in srgb,var(--ground) 72%,transparent); }
  #lobby-list .lobby-more { position:relative; flex:none; display:grid; place-items:center; width:44px; height:44px; padding:0; border:0; background:none; color:var(--muted); font-size:18px; }
  #lobby-list .lobby-row-menu { display:none; position:fixed; inset:auto; margin:0; min-width:11rem; padding:4px 0; border:1px solid var(--line); border-radius:6px; background:var(--surface); color:var(--ink); box-shadow:var(--shadow); }
  #lobby-list .lobby-row-menu:popover-open { display:grid; }
  #lobby-list .lobby-row-menu .btn { min-height:44px; padding:0 14px; border:0; border-radius:0; background:none; font-size:14px; text-align:left; }
  #lobby-list .lobby-row-menu .btn + .btn { border-top:1px solid var(--line); }
  #lobby-schedules > h2 { margin:0; padding:14px 16px 4px; font-size:11px; font-weight:700; letter-spacing:.07em; text-transform:uppercase; color:var(--muted); }
  #lobby-schedules .lobby-empty { margin:8px 16px; }
  #lobby-schedule-list .lobby-row { gap:8px; padding:9px 16px; border-top:0; border-bottom:1px solid var(--line); }
  #lobby-schedule-list .lobby-name { font-size:15px; }
  #lobby-schedule-list .lobby-meta { font-size:12px; }
  #lobby-schedule-list .btn { min-height:40px; }
}
